Added RFC 2190 H.263 code as created by Guilhem Tardy and AliceStreet
[pwlib.git] / include / pwlib / region.h
blob1d8cafa3d35615fecbcd2374140d76d7111f876e
1 /*
2 * region.h
4 * Arbitrarily shaped region.
6 * Portable Windows Library
8 * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
20 * The Original Code is Portable Windows Library.
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
27 * Contributor(s): ______________________________________.
29 * $Log$
30 * Revision 1.15 2001/05/22 12:49:33 robertj
31 * Did some seriously wierd rewrite of platform headers to eliminate the
32 * stupid GNU compiler warning about braces not matching.
34 * Revision 1.14 1999/03/10 03:49:53 robertj
35 * More documentation adjustments.
37 * Revision 1.13 1999/03/09 08:01:49 robertj
38 * Changed comments for doc++ support (more to come).
40 * Revision 1.12 1999/02/16 08:08:46 robertj
41 * MSVC 6.0 compatibility changes.
43 * Revision 1.11 1998/09/23 06:28:48 robertj
44 * Added open source copyright license.
46 * Revision 1.10 1995/03/14 12:42:25 robertj
47 * Updated documentation to use HTML codes.
49 * Revision 1.9 1995/01/14 06:19:30 robertj
50 * Documentation
52 * Revision 1.8 1994/08/23 11:32:52 robertj
53 * Oops
55 * Revision 1.7 1994/08/22 00:46:48 robertj
56 * Added pragma fro GNU C++ compiler.
58 * Revision 1.6 1994/01/03 04:42:23 robertj
59 * Mass changes to common container classes and interactors etc etc etc.
61 * Revision 1.5 1993/12/06 22:06:45 robertj
62 * Destructor should be virtual for classes with virtual member functions.
64 * Revision 1.4 1993/10/16 20:33:20 robertj
65 * Added function to determine if a rectangle and region overlap.
67 * Revision 1.3 1993/08/21 01:50:33 robertj
68 * Made Clone() function optional, default will assert if called.
70 * Revision 1.2 1993/07/14 12:49:16 robertj
71 * Fixed RCS keywords.
76 #define _PREGION
78 #ifdef __GNUC__
79 #pragma interface
80 #endif
83 /**A class representing a region of the graphics system drawing plane. This
84 is an arbitrary enclosed shape. It is often made up from a collection of
85 rectangles.
87 class PRegion : public PObject
89 PCLASSINFO(PRegion, PObject);
91 public:
92 /**Create new region object. The first, parameterless, constructor creates
93 an empty region. The second creates a region that initially encloses
94 the specified rectangle.
96 PRegion();
97 PRegion(
98 const PRect & rect /// Rectangle for initial region.
101 /** Create a copy of the specified region. */
102 PRegion(
103 const PRegion & rgn /// Region to copy.
106 /** Assign one region to another. */
107 PRegion & operator=(
108 const PRegion & rgn /// Region to assign to the current region.
111 /** Destroy the region. */
112 virtual ~PRegion();
115 /**@name Overrides from class PObject */
116 /**Determine if the two regions are identical.
118 @return
119 #EqualTo# if the regions enclose the identical part of the
120 drawing plane, otherwise #GreaterThan# is returned.
122 virtual Comparison Compare(
123 const PObject & obj /// Region to compare against.
124 ) const;
127 /**@name New functions for class */
128 /**Add the specified area of the drawing plane to the region. The region
129 will include the area specified into its enclosed space.
131 void Add(
132 const PRect & rect /// Rectangle to add to teh region.
134 void Add(
135 const PRegion & rgn /// Another region to add to region.
138 /**Determine if the point is contined within the regions space.
140 @return
141 TRUE if point is in region.
143 BOOL ContainsPoint(
144 const PPoint & pt /// Point to determine if is inside region.
145 ) const;
147 /**Determine if the rectangle is wholly contiained within the region.
149 @return
150 TRUE if rectangle is in region.
152 BOOL ContainsRect(const PRect & rect) const;
154 /**Determine if any part of the rectangle overlapps any part of the region.
156 @return
157 TRUE if rectangle intersect region.
159 BOOL OverlapsRect(const PRect & rect) const;
161 /**Determine if the region is empty.
163 @return
164 TRUE if region encloses no space.
166 BOOL IsEmpty() const;
168 /**Move the region the specified delta amount. The shape of the region does
169 not change, only its origin.
171 void Offset(
172 PORDINATE dx, /// Amount to move region horizontally.
173 PORDINATE dy /// Amount ot move region vertically.
176 /**Calculate the smallest enclosing bounding box around the region.
178 @return
179 rectangle that encloses the region.
181 PRect GetBounds() const;
183 /**Calculate the region that is the intersection of the object and the
184 specified region.
186 @return
187 region that is inside both regions.
189 PRegion Intersection(const PRegion & rgn) const;
191 /**Calcaulte the region that is the union of the object and the specified
192 region.
194 @return
195 region that is inside either region.
197 PRegion Union(const PRegion & rgn) const;
200 // Include platform dependent part of class
201 #include <pwlib/region.h>
205 // End Of File ///////////////////////////////////////////////////////////////