1 /*
2  *
3  * Copyright © 2000 SuSE, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software and its
6  * documentation for any purpose is hereby granted without fee, provided that
7  * the above copyright notice appear in all copies and that both that
8  * copyright notice and this permission notice appear in supporting
9  * documentation, and that the name of SuSE not be used in advertising or
10  * publicity pertaining to distribution of the software without specific,
11  * written prior permission.  SuSE makes no representations about the
12  * suitability of this software for any purpose.  It is provided "as is"
13  * without express or implied warranty.
14  *
15  * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
17  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21  *
22  * Author:  Keith Packard, SuSE, Inc.
23  */
24 
25 #ifndef _MIPICT_H_
26 #define _MIPICT_H_
27 
28 #include "picturestr.h"
29 
30 #define MI_MAX_INDEXED	256     /* XXX depth must be <= 8 */
31 
32 #if MI_MAX_INDEXED <= 256
33 typedef CARD8 miIndexType;
34 #endif
35 
36 typedef struct _miIndexed {
37     Bool color;
38     CARD32 rgba[MI_MAX_INDEXED];
39     miIndexType ent[32768];
40 } miIndexedRec, *miIndexedPtr;
41 
42 #define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
43 			     (((s) >> 6) & 0x03e0) | \
44 			     (((s) >> 9) & 0x7c00))
45 #define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
46 #define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
47 
48 #define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
49 
50 extern _X_EXPORT int
51  miCreatePicture(PicturePtr pPicture);
52 
53 extern _X_EXPORT void
54  miDestroyPicture(PicturePtr pPicture);
55 
56 extern _X_EXPORT void
57  miCompositeSourceValidate(PicturePtr pPicture);
58 
59 extern _X_EXPORT Bool
60 
61 miComputeCompositeRegion(RegionPtr pRegion,
62                          PicturePtr pSrc,
63                          PicturePtr pMask,
64                          PicturePtr pDst,
65                          INT16 xSrc,
66                          INT16 ySrc,
67                          INT16 xMask,
68                          INT16 yMask,
69                          INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
70 
71 extern _X_EXPORT Bool
72  miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
73 
74 extern _X_EXPORT Bool
75  miRealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
76 
77 extern _X_EXPORT void
78  miUnrealizeGlyph(ScreenPtr pScreen, GlyphPtr glyph);
79 
80 extern _X_EXPORT void
81 
82 miGlyphs(CARD8 op,
83          PicturePtr pSrc,
84          PicturePtr pDst,
85          PictFormatPtr maskFormat,
86          INT16 xSrc,
87          INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr * glyphs);
88 
89 extern _X_EXPORT void
90  miRenderColorToPixel(PictFormatPtr pPict, xRenderColor * color, CARD32 *pixel);
91 
92 extern _X_EXPORT void
93  miRenderPixelToColor(PictFormatPtr pPict, CARD32 pixel, xRenderColor * color);
94 
95 extern _X_EXPORT Bool
96  miIsSolidAlpha(PicturePtr pSrc);
97 
98 extern _X_EXPORT void
99 
100 miCompositeRects(CARD8 op,
101                  PicturePtr pDst,
102                  xRenderColor * color, int nRect, xRectangle *rects);
103 
104 extern _X_EXPORT void
105  miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
106 
107 extern _X_EXPORT void
108  miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
109 
110 extern _X_EXPORT void
111  miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds);
112 
113 extern _X_EXPORT Bool
114  miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
115 
116 extern _X_EXPORT void
117  miCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat);
118 
119 extern _X_EXPORT void
120 
121 miUpdateIndexed(ScreenPtr pScreen,
122                 PictFormatPtr pFormat, int ndef, xColorItem * pdef);
123 
124 #endif                          /* _MIPICT_H_ */
125