From 08e0943c9f175df5647258937977fc584cb15a94 Mon Sep 17 00:00:00 2001 From: Dave Beckett Date: Tue, 9 Dec 2003 16:08:16 +0000 Subject: [PATCH] Merged pixregion.h (former name and CVS history of this file) and ic.h (now CVS deleted here). --- pixman/src/pixman.h | 309 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 304 insertions(+), 5 deletions(-) diff --git a/pixman/src/pixman.h b/pixman/src/pixman.h index b2561629d..30fb81145 100644 --- a/pixman/src/pixman.h +++ b/pixman/src/pixman.h @@ -1,3 +1,13 @@ +#ifndef _PIXMAN_H_ +#define _PIXMAN_H_ + + +/* pixman.h - a merge of pixregion.h and ic.h */ + + +/* from pixregion.h */ + + /*********************************************************** Copyright 1987, 1998 The Open Group @@ -44,12 +54,45 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $Id: pixman.h,v 1.5 2003-07-30 17:36:50 cworth Exp $ */ +/* $Id: pixman.h,v 1.6 2003-12-10 00:08:16 dajobe Exp $ */ -#ifndef _PIXREGION_H_ -#define _PIXREGION_H_ +/* libic.h */ -#ifdef _PIXREGIONINT_H_ +/* + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + +#if defined (__SVR4) && defined (__sun) +# include +#else +# if defined (__OpenBSD__) +# include +# else +# include +# endif +#endif + + +#if defined(_PIXREGIONINT_H_) || defined(_ICINT_H_) #include #else #include @@ -59,6 +102,8 @@ SOFTWARE. extern "C" { #endif +/* pixregion.h */ + typedef struct _PixRegion PixRegion; typedef struct _PixRegionBox { @@ -156,10 +201,264 @@ PixRegionReset (PixRegion *region, PixRegionBox *pBox); extern void __external_linkage PixRegionEmpty (PixRegion *region); + +/* ic.h */ + + +/* icformat.c */ +typedef enum _IcOperator { + IcOperatorClear, + IcOperatorSrc, + IcOperatorDst, + IcOperatorOver, + IcOperatorOverReverse, + IcOperatorIn, + IcOperatorInReverse, + IcOperatorOut, + IcOperatorOutReverse, + IcOperatorAtop, + IcOperatorAtopReverse, + IcOperatorXor, + IcOperatorAdd, + IcOperatorSaturate, +} IcOperator; + + +typedef enum _IcFormatName { + IcFormatNameARGB32, + IcFormatNameRGB24, + IcFormatNameA8, + IcFormatNameA1 +} IcFormatName; + +typedef struct _IcFormat IcFormat; + +extern IcFormat * __external_linkage +IcFormatCreate (IcFormatName name); + +extern IcFormat * __external_linkage +IcFormatCreateMasks (int bpp, + int alpha_mask, + int red_mask, + int green_mask, + int blue_mask); + +extern void __external_linkage +IcFormatDestroy (IcFormat *format); + +/* icimage.c */ + +typedef struct _IcImage IcImage; + +extern IcImage * __external_linkage +IcImageCreate (IcFormat *format, + int width, + int height); + +/* + * This single define controls the basic size of data manipulated + * by this software; it must be log2(sizeof (IcBits) * 8) + */ + +#ifndef IC_SHIFT +# if defined(__alpha__) || defined(__alpha) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__sparc64__) || \ + defined(__s390x__) || \ + defined(x86_64) || defined (__x86_64__) +#define IC_SHIFT 6 +typedef uint64_t IcBits; +# else +#define IC_SHIFT 5 +typedef uint32_t IcBits; +# endif +#endif + +extern IcImage * __external_linkage +IcImageCreateForData (IcBits *data, IcFormat *format, int width, int height, int bpp, int stride); + +extern void __external_linkage +IcImageDestroy (IcImage *image); + +extern int __external_linkage +IcImageSetClipRegion (IcImage *image, + PixRegion *region); + +typedef int IcFixed16_16; + +typedef struct _IcPointFixed { + IcFixed16_16 x, y; +} IcPointFixed; + +typedef struct _IcLineFixed { + IcPointFixed p1, p2; +} IcLineFixed; + +/* XXX: It's goofy that IcRectangle has integers while all the other + datatypes have fixed-point values. (Though by design, + IcFillRectangles is designed to fill only whole pixels) */ +typedef struct _IcRectangle { + short x, y; + unsigned short width, height; +} IcRectangle; + +typedef struct _IcTriangle { + IcPointFixed p1, p2, p3; +} IcTriangle; + +typedef struct _IcTrapezoid { + IcFixed16_16 top, bottom; + IcLineFixed left, right; +} IcTrapezoid; + +typedef struct _IcVector { + IcFixed16_16 vector[3]; +} IcVector; + +typedef struct _IcTransform { + IcFixed16_16 matrix[3][3]; +} IcTransform; + +typedef enum { + IcFilterFast, + IcFilterGood, + IcFilterBest, + IcFilterNearest, + IcFilterBilinear +} IcFilter; + +extern int __external_linkage +IcImageSetTransform (IcImage *image, + IcTransform *transform); + +extern void __external_linkage +IcImageSetRepeat (IcImage *image, + int repeat); + +extern void __external_linkage +IcImageSetFilter (IcImage *image, + IcFilter filter); + +extern int __external_linkage +IcImageGetWidth (IcImage *image); + +extern int __external_linkage +IcImageGetHeight (IcImage *image); + +extern int __external_linkage +IcImageGetStride (IcImage *image); + +extern int __external_linkage +IcImageGetDepth (IcImage *image); + +extern IcFormat * __external_linkage +IcImageGetFormat (IcImage *image); + +extern IcBits * __external_linkage +IcImageGetData (IcImage *image); + +/* iccolor.c */ + +/* XXX: Do we really need a struct here? Only IcRectangles uses this. */ +typedef struct { + unsigned short red; + unsigned short green; + unsigned short blue; + unsigned short alpha; +} IcColor; + +extern void __external_linkage +IcColorToPixel (const IcFormat *format, + const IcColor *color, + IcBits *pixel); + +extern void __external_linkage +IcPixelToColor (const IcFormat *format, + IcBits pixel, + IcColor *color); + +/* icrect.c */ + +extern void __external_linkage +IcFillRectangle (IcOperator op, + IcImage *dst, + const IcColor *color, + int x, + int y, + unsigned int width, + unsigned int height); + +extern void __external_linkage +IcFillRectangles (IcOperator op, + IcImage *dst, + const IcColor *color, + const IcRectangle *rects, + int nRects); + +/* ictrap.c */ + +/* XXX: Switch to enum for op */ +extern void __external_linkage +IcCompositeTrapezoids (IcOperator op, + IcImage *src, + IcImage *dst, + int xSrc, + int ySrc, + const IcTrapezoid *traps, + int ntrap); + +/* ictri.c */ + +extern void __external_linkage +IcCompositeTriangles (IcOperator op, + IcImage *src, + IcImage *dst, + int xSrc, + int ySrc, + const IcTriangle *tris, + int ntris); + +extern void __external_linkage +IcCompositeTriStrip (IcOperator op, + IcImage *src, + IcImage *dst, + int xSrc, + int ySrc, + const IcPointFixed *points, + int npoints); + + +extern void __external_linkage +IcCompositeTriFan (IcOperator op, + IcImage *src, + IcImage *dst, + int xSrc, + int ySrc, + const IcPointFixed *points, + int npoints); + +/* ic.c */ + +extern void __external_linkage +IcComposite (IcOperator op, + IcImage *iSrc, + IcImage *iMask, + IcImage *iDst, + int xSrc, + int ySrc, + int xMask, + int yMask, + int xDst, + int yDst, + int width, + int height); + + + #if defined(__cplusplus) || defined(c_plusplus) } #endif #undef __external_linkage -#endif /* _PIXREGION_H_ */ +#endif /* _PIXMAN_H_ */