home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / liblayer / include / xp_rect.h < prev   
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.1 KB  |  69 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.  *  xp_rect.c - Simple rectangle operations
  20.  */
  21.  
  22.  
  23. #ifndef _XP_RECT_H_
  24. #define _XP_RECT_H_
  25.  
  26. #include "prtypes.h"
  27. #include "cl_types.h"
  28.  
  29. /* A cross-platform rectangle */
  30. struct _XP_Rect {
  31.   int32 top;
  32.   int32 left;
  33.   int32 bottom;
  34.   int32 right;
  35. };
  36.  
  37. XP_BEGIN_PROTOS
  38.  
  39. /* This could be a macro */
  40. extern void XP_CopyRect(XP_Rect *src, XP_Rect *dest);
  41.  
  42. /* Predicate to compare two rectangles */
  43. extern PRBool XP_EqualRect(XP_Rect *r1, XP_Rect *r2);
  44.  
  45. /* Offset rectangle in 2D space. This could be a macro */
  46. extern void XP_OffsetRect(XP_Rect *rect, int32 x_offset, int32 y_offset);
  47.  
  48. /* TRUE if point is within the boundary of the rect */
  49. extern PRBool XP_PointInRect(XP_Rect *rect, int32 x, int32 y);
  50.  
  51. /* TRUE if any parts of the two rectangles overlap */
  52. extern PRBool XP_RectsOverlap(XP_Rect *rect1, XP_Rect *rect2);
  53.  
  54. /* TRUE if rect2 is entirely contained within rect1 */
  55. extern PRBool XP_RectContainsRect(XP_Rect *rect1, XP_Rect *rect2);
  56.  
  57. /* dst = src1 intersect src2. dst can be one of src1 or src2 */
  58. extern void XP_IntersectRect(XP_Rect *src1, XP_Rect *src2, XP_Rect *dst);
  59.  
  60. /* dst = bounding box of src1 and src2. dst can be one of src1 or src2 */
  61. extern void XP_RectsBbox(XP_Rect *src1, XP_Rect *src2, XP_Rect *dst);
  62.  
  63. /* Does the rectangle enclose any pixels? */
  64. extern PRBool XP_IsEmptyRect(XP_Rect *rect);
  65.  
  66. XP_END_PROTOS
  67.  
  68. #endif /* _XP_RECT_H_ */
  69.