regionstr.h revision a3f3701cea1ba388e7c877955252bb7375eedebd
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/***********************************************************
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCopyright 1987, 1998 The Open Group
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncPermission to use, copy, modify, distribute, and sell this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation for any purpose is hereby granted without fee, provided that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncthe above copyright notice appear in all copies and that both that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynccopyright notice and this permission notice appear in supporting
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncThe above copyright notice and this permission notice shall be included in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncall copies or substantial portions of the Software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncExcept as contained in this notice, the name of The Open Group shall not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncused in advertising or otherwise to promote the sale, use or other dealings
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncin this Software without prior written authorization from The Open Group.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync All Rights Reserved
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncPermission to use, copy, modify, and distribute this software and its
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncdocumentation for any purpose and without fee is hereby granted,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncprovided that the above copyright notice appear in all copies and that
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncboth that copyright notice and this permission notice appear in
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncsupporting documentation, and that the name of Digital not be
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncused in advertising or publicity pertaining to distribution of the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncsoftware without specific, written prior permission.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync******************************************************************/
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct pixman_region16 RegionRec, *RegionPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* Return values from RectIn() */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * clip region
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsynctypedef struct pixman_region16_data RegDataRec, *RegDataPtr;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* not a region */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline int
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline int
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline size_t
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return pixman_region_init_rects(pReg, boxes, nBoxes);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline BoxPtr
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int /*size */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionIntersect(RegionPtr newReg, /* destination Region */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return pixman_region_intersect(newReg, reg1, reg2);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionUnion(RegionPtr newReg, /* destination Region */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync int /*ctype */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *-----------------------------------------------------------------------
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Subtract --
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Subtract regS from regM and leave the result in regD.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * S stands for subtrahend, M for minuend and D for difference.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * TRUE if successful.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Side Effects:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * regD is overwritten.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *-----------------------------------------------------------------------
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *-----------------------------------------------------------------------
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Inverse --
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Take a region and a box and return a region that is everything
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in the box but not in the region. The careful reader will note
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * that this is the same as subtracting the region from the box...
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Side Effects:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * newReg is overwritten.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *-----------------------------------------------------------------------
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionInverse(RegionPtr newReg, /* Destination region */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return pixman_region_inverse(newReg, reg1, invRect);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline int
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return pixman_region_contains_rectangle(region, prect);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/* TranslateRegion(pReg, x, y)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync translates in place
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline void
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncRegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync return pixman_region_contains_point(pReg, x, y, box);
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstatic inline Bool
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ ,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ );
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_RESET(pScreen, r, b) RegionReset(r, b)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* INCLUDE_LEGACY_REGION_DEFINES */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* REGIONSTRUCT_H */