2 * Copyright © 2000 SuSE, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of SuSE not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. SuSE makes no representations about the
11 * suitability of this software for any purpose. It is provided "as is"
12 * without express or implied warranty.
14 * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
16 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
18 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
19 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Author: Keith Packard, SuSE, Inc.
24 #ifndef _PICTURESTR_H_
25 #define _PICTURESTR_H_
27 #include "scrnintstr.h"
31 typedef struct _DirectFormat {
33 CARD16 green, greenMask;
34 CARD16 blue, blueMask;
35 CARD16 alpha, alphaMask;
38 typedef struct _IndexFormat {
40 ColormapPtr pColormap;
46 typedef struct _PictFormat {
48 CARD32 format; /* except bpp */
51 DirectFormatRec direct;
55 typedef struct pixman_vector PictVector, *PictVectorPtr;
56 typedef struct pixman_transform PictTransform, *PictTransformPtr;
58 #define PICT_GRADIENT_STOPTABLE_SIZE 1024
59 #define SourcePictTypeSolidFill 0
60 #define SourcePictTypeLinear 1
61 #define SourcePictTypeRadial 2
62 #define SourcePictTypeConical 3
64 #define SourcePictClassUnknown 0
65 #define SourcePictClassHorizontal 1
66 #define SourcePictClassVertical 2
68 typedef struct _PictSolidFill {
72 } PictSolidFill, *PictSolidFillPtr;
74 typedef struct _PictGradientStop {
77 } PictGradientStop, *PictGradientStopPtr;
79 typedef struct _PictGradient {
83 PictGradientStopPtr stops;
87 } PictGradient, *PictGradientPtr;
89 typedef struct _PictLinearGradient {
93 PictGradientStopPtr stops;
99 } PictLinearGradient, *PictLinearGradientPtr;
101 typedef struct _PictCircle {
105 } PictCircle, *PictCirclePtr;
107 typedef struct _PictRadialGradient {
111 PictGradientStopPtr stops;
121 } PictRadialGradient, *PictRadialGradientPtr;
123 typedef struct _PictConicalGradient {
127 PictGradientStopPtr stops;
133 } PictConicalGradient, *PictConicalGradientPtr;
135 typedef union _SourcePict {
137 PictSolidFill solidFill;
138 PictGradient gradient;
139 PictLinearGradient linear;
140 PictRadialGradient radial;
141 PictConicalGradient conical;
142 } SourcePict, *SourcePictPtr;
144 typedef struct _Picture {
145 DrawablePtr pDrawable;
146 PictFormatPtr pFormat;
147 PictFormatShort format; /* PICT_FORMAT */
150 PicturePtr pNext; /* chain on same drawable */
152 unsigned int repeat : 1;
153 unsigned int graphicsExposures : 1;
154 unsigned int subWindowMode : 1;
155 unsigned int polyEdge : 1;
156 unsigned int polyMode : 1;
157 unsigned int freeCompClip : 1;
158 unsigned int clientClipType : 2;
159 unsigned int componentAlpha : 1;
160 unsigned int repeatType : 2;
161 unsigned int unused : 21;
164 DDXPointRec alphaOrigin;
166 DDXPointRec clipOrigin;
171 unsigned long stateChanges;
172 unsigned long serialNumber;
174 RegionPtr pCompositeClip;
176 DevUnion *devPrivates;
178 PictTransform *transform;
181 xFixed *filter_params;
183 SourcePictPtr pSourcePict;
186 typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id,
187 xFixed *params, int nparams);
191 PictFilterValidateParamsProcPtr ValidateParams;
192 } PictFilterRec, *PictFilterPtr;
194 #define PictFilterNearest 0
195 #define PictFilterBilinear 1
197 #define PictFilterFast 2
198 #define PictFilterGood 3
199 #define PictFilterBest 4
201 #define PictFilterConvolution 5
207 } PictFilterAliasRec, *PictFilterAliasPtr;
209 typedef int (*CreatePictureProcPtr) (PicturePtr pPicture);
210 typedef void (*DestroyPictureProcPtr) (PicturePtr pPicture);
211 typedef int (*ChangePictureClipProcPtr) (PicturePtr pPicture,
215 typedef void (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
217 typedef int (*ChangePictureTransformProcPtr) (PicturePtr pPicture,
218 PictTransform *transform);
220 typedef int (*ChangePictureFilterProcPtr) (PicturePtr pPicture,
225 typedef void (*DestroyPictureFilterProcPtr) (PicturePtr pPicture);
227 typedef void (*ChangePictureProcPtr) (PicturePtr pPicture,
229 typedef void (*ValidatePictureProcPtr) (PicturePtr pPicture,
231 typedef void (*CompositeProcPtr) (CARD8 op,
244 typedef void (*GlyphsProcPtr) (CARD8 op,
247 PictFormatPtr maskFormat,
254 typedef void (*CompositeRectsProcPtr) (CARD8 op,
260 typedef void (*RasterizeTrapezoidProcPtr)(PicturePtr pMask,
265 typedef void (*TrapezoidsProcPtr) (CARD8 op,
268 PictFormatPtr maskFormat,
274 typedef void (*TrianglesProcPtr) (CARD8 op,
277 PictFormatPtr maskFormat,
283 typedef void (*TriStripProcPtr) (CARD8 op,
286 PictFormatPtr maskFormat,
290 xPointFixed *points);
292 typedef void (*TriFanProcPtr) (CARD8 op,
295 PictFormatPtr maskFormat,
299 xPointFixed *points);
301 typedef Bool (*InitIndexedProcPtr) (ScreenPtr pScreen,
302 PictFormatPtr pFormat);
304 typedef void (*CloseIndexedProcPtr) (ScreenPtr pScreen,
305 PictFormatPtr pFormat);
307 typedef void (*UpdateIndexedProcPtr) (ScreenPtr pScreen,
308 PictFormatPtr pFormat,
312 typedef void (*AddTrapsProcPtr) (PicturePtr pPicture,
318 typedef void (*AddTrianglesProcPtr) (PicturePtr pPicture,
324 typedef Bool (*RealizeGlyphProcPtr) (ScreenPtr pScreen,
327 typedef void (*UnrealizeGlyphProcPtr) (ScreenPtr pScreen,
330 typedef struct _PictureScreen {
331 int totalPictureSize;
332 unsigned int *PicturePrivateSizes;
333 int PicturePrivateLen;
335 PictFormatPtr formats;
336 PictFormatPtr fallback;
339 CreatePictureProcPtr CreatePicture;
340 DestroyPictureProcPtr DestroyPicture;
341 ChangePictureClipProcPtr ChangePictureClip;
342 DestroyPictureClipProcPtr DestroyPictureClip;
344 ChangePictureProcPtr ChangePicture;
345 ValidatePictureProcPtr ValidatePicture;
347 CompositeProcPtr Composite;
348 GlyphsProcPtr Glyphs;
349 CompositeRectsProcPtr CompositeRects;
351 DestroyWindowProcPtr DestroyWindow;
352 CloseScreenProcPtr CloseScreen;
354 StoreColorsProcPtr StoreColors;
356 InitIndexedProcPtr InitIndexed;
357 CloseIndexedProcPtr CloseIndexed;
358 UpdateIndexedProcPtr UpdateIndexed;
362 PictFilterPtr filters;
364 PictFilterAliasPtr filterAliases;
368 * Called immediately after a picture's transform is changed through the
369 * SetPictureTransform request. Not called for source-only pictures.
371 ChangePictureTransformProcPtr ChangePictureTransform;
374 * Called immediately after a picture's transform is changed through the
375 * SetPictureFilter request. Not called for source-only pictures.
377 ChangePictureFilterProcPtr ChangePictureFilter;
379 DestroyPictureFilterProcPtr DestroyPictureFilter;
381 TrapezoidsProcPtr Trapezoids;
382 TrianglesProcPtr Triangles;
383 TriStripProcPtr TriStrip;
384 TriFanProcPtr TriFan;
386 RasterizeTrapezoidProcPtr RasterizeTrapezoid;
388 AddTrianglesProcPtr AddTriangles;
390 AddTrapsProcPtr AddTraps;
392 int totalGlyphPrivateSize;
393 unsigned int *glyphPrivateSizes;
395 int glyphPrivateOffset;
397 RealizeGlyphProcPtr RealizeGlyph;
398 UnrealizeGlyphProcPtr UnrealizeGlyph;
400 } PictureScreenRec, *PictureScreenPtr;
402 extern int PictureScreenPrivateIndex;
403 extern int PictureWindowPrivateIndex;
404 extern RESTYPE PictureType;
405 extern RESTYPE PictFormatType;
406 extern RESTYPE GlyphSetType;
408 #define GetPictureScreen(s) ((PictureScreenPtr) ((s)->devPrivates[PictureScreenPrivateIndex].ptr))
409 #define GetPictureScreenIfSet(s) ((PictureScreenPrivateIndex != -1) ? GetPictureScreen(s) : NULL)
410 #define SetPictureScreen(s,p) ((s)->devPrivates[PictureScreenPrivateIndex].ptr = (pointer) (p))
411 #define GetPictureWindow(w) ((PicturePtr) ((w)->devPrivates[PictureWindowPrivateIndex].ptr))
412 #define SetPictureWindow(w,p) ((w)->devPrivates[PictureWindowPrivateIndex].ptr = (pointer) (p))
414 #define GetGlyphPrivatesForScreen(glyph, s) \
415 ((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset)
417 #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
418 pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
420 client->errorValue = pid; \
425 #define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
429 VERIFY_PICTURE(pPicture, pid, client, mode, err); \
434 ResetPicturePrivateIndex (void);
437 AllocatePicturePrivateIndex (void);
440 AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount);
443 PictureDestroyWindow (WindowPtr pWindow);
446 PictureCloseScreen (int Index, ScreenPtr pScreen);
449 PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
452 PictureInitIndexedFormats (ScreenPtr pScreen);
455 PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
458 PictureGetSubpixelOrder (ScreenPtr pScreen);
461 PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
464 PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
467 PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
470 PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
473 PictureGetFilterId (char *filter, int len, Bool makeit);
476 PictureGetFilterName (int id);
479 PictureAddFilter (ScreenPtr pScreen,
481 PictFilterValidateParamsProcPtr ValidateParams);
484 PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
487 PictureSetDefaultFilters (ScreenPtr pScreen);
490 PictureResetFilters (ScreenPtr pScreen);
493 PictureFindFilter (ScreenPtr pScreen, char *name, int len);
496 SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams);
499 PictureFinishInit (void);
502 SetPictureToDefaults (PicturePtr pPicture);
505 AllocatePicture (ScreenPtr pScreen);
509 miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
514 CreatePicture (Picture pid,
515 DrawablePtr pDrawable,
516 PictFormatPtr pFormat,
523 ChangePicture (PicturePtr pPicture,
530 SetPictureClipRects (PicturePtr pPicture,
537 SetPictureClipRegion (PicturePtr pPicture,
543 SetPictureTransform (PicturePtr pPicture,
544 PictTransform *transform);
547 CopyPicture (PicturePtr pSrc,
552 ValidatePicture(PicturePtr pPicture);
555 FreePicture (pointer pPicture,
559 FreePictFormat (pointer pPictFormat,
563 CompositePicture (CARD8 op,
577 CompositeGlyphs (CARD8 op,
580 PictFormatPtr maskFormat,
588 CompositeRects (CARD8 op,
595 CompositeTrapezoids (CARD8 op,
598 PictFormatPtr maskFormat,
605 CompositeTriangles (CARD8 op,
608 PictFormatPtr maskFormat,
612 xTriangle *triangles);
615 CompositeTriStrip (CARD8 op,
618 PictFormatPtr maskFormat,
622 xPointFixed *points);
625 CompositeTriFan (CARD8 op,
628 PictFormatPtr maskFormat,
632 xPointFixed *points);
635 PictureTransformPoint (PictTransformPtr transform,
636 PictVectorPtr vector);
639 PictureTransformPoint3d (PictTransformPtr transform,
640 PictVectorPtr vector);
643 PictureGradientColor (PictGradientStopPtr stop1,
644 PictGradientStopPtr stop2,
647 void RenderExtensionInit (void);
650 AnimCurInit (ScreenPtr pScreen);
653 AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor);
656 AddTraps (PicturePtr pPicture,
663 PixmanImageFromPicture (PicturePtr pPict,
667 CreateSolidPicture (Picture pid,
672 CreateLinearGradientPicture (Picture pid,
677 xRenderColor *colors,
681 CreateRadialGradientPicture (Picture pid,
688 xRenderColor *colors,
692 CreateConicalGradientPicture (Picture pid,
697 xRenderColor *colors,
701 void PanoramiXRenderInit (void);
702 void PanoramiXRenderReset (void);
705 #endif /* _PICTURESTR_H_ */