]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4con/examples/xf86_stub/include-xorg-7.3.0/picturestr.h
Inital import
[l4.git] / l4 / pkg / l4con / examples / xf86_stub / include-xorg-7.3.0 / picturestr.h
1 /*
2  * Copyright © 2000 SuSE, Inc.
3  *
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.
13  *
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.
20  *
21  * Author:  Keith Packard, SuSE, Inc.
22  */
23
24 #ifndef _PICTURESTR_H_
25 #define _PICTURESTR_H_
26
27 #include "scrnintstr.h"
28 #include "glyphstr.h"
29 #include "resource.h"
30
31 typedef struct _DirectFormat {
32     CARD16          red, redMask;
33     CARD16          green, greenMask;
34     CARD16          blue, blueMask;
35     CARD16          alpha, alphaMask;
36 } DirectFormatRec;
37
38 typedef struct _IndexFormat {
39     VisualID        vid;
40     ColormapPtr     pColormap;
41     int             nvalues;
42     xIndexValue     *pValues;
43     void            *devPrivate;
44 } IndexFormatRec;
45
46 typedef struct _PictFormat {
47     CARD32          id;
48     CARD32          format;         /* except bpp */
49     unsigned char   type;
50     unsigned char   depth;
51     DirectFormatRec direct;
52     IndexFormatRec  index;
53 } PictFormatRec;
54
55 typedef struct pixman_vector PictVector, *PictVectorPtr;
56 typedef struct pixman_transform PictTransform, *PictTransformPtr;
57
58 #define PICT_GRADIENT_STOPTABLE_SIZE 1024
59 #define SourcePictTypeSolidFill 0
60 #define SourcePictTypeLinear 1
61 #define SourcePictTypeRadial 2
62 #define SourcePictTypeConical 3
63
64 #define SourcePictClassUnknown    0
65 #define SourcePictClassHorizontal 1
66 #define SourcePictClassVertical   2
67
68 typedef struct _PictSolidFill {
69     unsigned int type;
70     unsigned int class;
71     CARD32 color;
72 } PictSolidFill, *PictSolidFillPtr;
73
74 typedef struct _PictGradientStop {
75     xFixed x;
76     xRenderColor color;
77 } PictGradientStop, *PictGradientStopPtr;
78
79 typedef struct _PictGradient {
80     unsigned int type;
81     unsigned int class;
82     int nstops;
83     PictGradientStopPtr stops;
84     int stopRange;
85     CARD32 *colorTable;
86     int colorTableSize;
87 } PictGradient, *PictGradientPtr;
88
89 typedef struct _PictLinearGradient {
90     unsigned int type;
91     unsigned int class;
92     int nstops;
93     PictGradientStopPtr stops;
94     int stopRange;
95     CARD32 *colorTable;
96     int colorTableSize;
97     xPointFixed p1;
98     xPointFixed p2;
99 } PictLinearGradient, *PictLinearGradientPtr;
100
101 typedef struct _PictCircle {
102     xFixed x;
103     xFixed y;
104     xFixed radius;
105 } PictCircle, *PictCirclePtr;
106
107 typedef struct _PictRadialGradient {
108     unsigned int type;
109     unsigned int class;
110     int nstops;
111     PictGradientStopPtr stops;
112     int stopRange;
113     CARD32 *colorTable;
114     int colorTableSize;
115     PictCircle c1;
116     PictCircle c2;
117     double cdx;
118     double cdy;
119     double dr;
120     double A;
121 } PictRadialGradient, *PictRadialGradientPtr;
122
123 typedef struct _PictConicalGradient {
124     unsigned int type;
125     unsigned int class;
126     int nstops;
127     PictGradientStopPtr stops;
128     int stopRange;
129     CARD32 *colorTable;
130     int colorTableSize;
131     xPointFixed center;
132     xFixed angle;
133 } PictConicalGradient, *PictConicalGradientPtr;
134
135 typedef union _SourcePict {
136     unsigned int type;
137     PictSolidFill solidFill;
138     PictGradient gradient;
139     PictLinearGradient linear;
140     PictRadialGradient radial;
141     PictConicalGradient conical;
142 } SourcePict, *SourcePictPtr;
143
144 typedef struct _Picture {
145     DrawablePtr     pDrawable;
146     PictFormatPtr   pFormat;
147     PictFormatShort format;         /* PICT_FORMAT */
148     int             refcnt;
149     CARD32          id;
150     PicturePtr      pNext;          /* chain on same drawable */
151
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;
162
163     PicturePtr      alphaMap;
164     DDXPointRec     alphaOrigin;
165
166     DDXPointRec     clipOrigin;
167     pointer         clientClip;
168
169     Atom            dither;
170
171     unsigned long   stateChanges;
172     unsigned long   serialNumber;
173
174     RegionPtr       pCompositeClip;
175
176     DevUnion        *devPrivates;
177
178     PictTransform   *transform;
179
180     int             filter;
181     xFixed          *filter_params;
182     int             filter_nparams;
183     SourcePictPtr   pSourcePict;
184 } PictureRec;
185
186 typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id,
187                                                  xFixed *params, int nparams);
188 typedef struct {
189     char                            *name;
190     int                             id;
191     PictFilterValidateParamsProcPtr ValidateParams;
192 } PictFilterRec, *PictFilterPtr;
193
194 #define PictFilterNearest       0
195 #define PictFilterBilinear      1
196
197 #define PictFilterFast          2
198 #define PictFilterGood          3
199 #define PictFilterBest          4
200
201 #define PictFilterConvolution   5
202
203 typedef struct {
204     char            *alias;
205     int             alias_id;
206     int             filter_id;
207 } PictFilterAliasRec, *PictFilterAliasPtr;
208
209 typedef int     (*CreatePictureProcPtr)     (PicturePtr pPicture);
210 typedef void    (*DestroyPictureProcPtr)    (PicturePtr pPicture);
211 typedef int     (*ChangePictureClipProcPtr) (PicturePtr pPicture,
212                                              int        clipType,
213                                              pointer    value,
214                                              int        n);
215 typedef void    (*DestroyPictureClipProcPtr)(PicturePtr pPicture);
216
217 typedef int     (*ChangePictureTransformProcPtr)    (PicturePtr     pPicture,
218                                                      PictTransform  *transform);
219
220 typedef int     (*ChangePictureFilterProcPtr)   (PicturePtr     pPicture,
221                                                  int            filter,
222                                                  xFixed         *params,
223                                                  int            nparams);
224
225 typedef void    (*DestroyPictureFilterProcPtr)  (PicturePtr pPicture);
226
227 typedef void    (*ChangePictureProcPtr)     (PicturePtr pPicture,
228                                              Mask       mask);
229 typedef void    (*ValidatePictureProcPtr)    (PicturePtr pPicture,
230                                              Mask       mask);
231 typedef void    (*CompositeProcPtr)         (CARD8      op,
232                                              PicturePtr pSrc,
233                                              PicturePtr pMask,
234                                              PicturePtr pDst,
235                                              INT16      xSrc,
236                                              INT16      ySrc,
237                                              INT16      xMask,
238                                              INT16      yMask,
239                                              INT16      xDst,
240                                              INT16      yDst,
241                                              CARD16     width,
242                                              CARD16     height);
243
244 typedef void    (*GlyphsProcPtr)            (CARD8      op,
245                                              PicturePtr pSrc,
246                                              PicturePtr pDst,
247                                              PictFormatPtr  maskFormat,
248                                              INT16      xSrc,
249                                              INT16      ySrc,
250                                              int        nlists,
251                                              GlyphListPtr   lists,
252                                              GlyphPtr   *glyphs);
253
254 typedef void    (*CompositeRectsProcPtr)    (CARD8          op,
255                                              PicturePtr     pDst,
256                                              xRenderColor   *color,
257                                              int            nRect,
258                                              xRectangle     *rects);
259
260 typedef void    (*RasterizeTrapezoidProcPtr)(PicturePtr     pMask,
261                                              xTrapezoid     *trap,
262                                              int            x_off,
263                                              int            y_off);
264
265 typedef void    (*TrapezoidsProcPtr)        (CARD8          op,
266                                              PicturePtr     pSrc,
267                                              PicturePtr     pDst,
268                                              PictFormatPtr  maskFormat,
269                                              INT16          xSrc,
270                                              INT16          ySrc,
271                                              int            ntrap,
272                                              xTrapezoid     *traps);
273
274 typedef void    (*TrianglesProcPtr)         (CARD8          op,
275                                              PicturePtr     pSrc,
276                                              PicturePtr     pDst,
277                                              PictFormatPtr  maskFormat,
278                                              INT16          xSrc,
279                                              INT16          ySrc,
280                                              int            ntri,
281                                              xTriangle      *tris);
282
283 typedef void    (*TriStripProcPtr)          (CARD8          op,
284                                              PicturePtr     pSrc,
285                                              PicturePtr     pDst,
286                                              PictFormatPtr  maskFormat,
287                                              INT16          xSrc,
288                                              INT16          ySrc,
289                                              int            npoint,
290                                              xPointFixed    *points);
291
292 typedef void    (*TriFanProcPtr)            (CARD8          op,
293                                              PicturePtr     pSrc,
294                                              PicturePtr     pDst,
295                                              PictFormatPtr  maskFormat,
296                                              INT16          xSrc,
297                                              INT16          ySrc,
298                                              int            npoint,
299                                              xPointFixed    *points);
300
301 typedef Bool    (*InitIndexedProcPtr)       (ScreenPtr      pScreen,
302                                              PictFormatPtr  pFormat);
303
304 typedef void    (*CloseIndexedProcPtr)      (ScreenPtr      pScreen,
305                                              PictFormatPtr  pFormat);
306
307 typedef void    (*UpdateIndexedProcPtr)     (ScreenPtr      pScreen,
308                                              PictFormatPtr  pFormat,
309                                              int            ndef,
310                                              xColorItem     *pdef);
311
312 typedef void    (*AddTrapsProcPtr)          (PicturePtr     pPicture,
313                                              INT16          xOff,
314                                              INT16          yOff,
315                                              int            ntrap,
316                                              xTrap          *traps);
317
318 typedef void    (*AddTrianglesProcPtr)      (PicturePtr     pPicture,
319                                              INT16          xOff,
320                                              INT16          yOff,
321                                              int            ntri,
322                                              xTriangle      *tris);
323
324 typedef Bool    (*RealizeGlyphProcPtr)      (ScreenPtr      pScreen,
325                                              GlyphPtr       glyph);
326
327 typedef void    (*UnrealizeGlyphProcPtr)    (ScreenPtr      pScreen,
328                                              GlyphPtr       glyph);
329
330 typedef struct _PictureScreen {
331     int                         totalPictureSize;
332     unsigned int                *PicturePrivateSizes;
333     int                         PicturePrivateLen;
334
335     PictFormatPtr               formats;
336     PictFormatPtr               fallback;
337     int                         nformats;
338
339     CreatePictureProcPtr        CreatePicture;
340     DestroyPictureProcPtr       DestroyPicture;
341     ChangePictureClipProcPtr    ChangePictureClip;
342     DestroyPictureClipProcPtr   DestroyPictureClip;
343
344     ChangePictureProcPtr        ChangePicture;
345     ValidatePictureProcPtr      ValidatePicture;
346
347     CompositeProcPtr            Composite;
348     GlyphsProcPtr               Glyphs;
349     CompositeRectsProcPtr       CompositeRects;
350
351     DestroyWindowProcPtr        DestroyWindow;
352     CloseScreenProcPtr          CloseScreen;
353
354     StoreColorsProcPtr          StoreColors;
355
356     InitIndexedProcPtr          InitIndexed;
357     CloseIndexedProcPtr         CloseIndexed;
358     UpdateIndexedProcPtr        UpdateIndexed;
359
360     int                         subpixel;
361
362     PictFilterPtr               filters;
363     int                         nfilters;
364     PictFilterAliasPtr          filterAliases;
365     int                         nfilterAliases;
366
367     /**
368      * Called immediately after a picture's transform is changed through the
369      * SetPictureTransform request.  Not called for source-only pictures.
370      */
371     ChangePictureTransformProcPtr   ChangePictureTransform;
372
373     /**
374      * Called immediately after a picture's transform is changed through the
375      * SetPictureFilter request.  Not called for source-only pictures.
376      */
377     ChangePictureFilterProcPtr  ChangePictureFilter;
378
379     DestroyPictureFilterProcPtr DestroyPictureFilter;
380
381     TrapezoidsProcPtr           Trapezoids;
382     TrianglesProcPtr            Triangles;
383     TriStripProcPtr             TriStrip;
384     TriFanProcPtr               TriFan;
385
386     RasterizeTrapezoidProcPtr   RasterizeTrapezoid;
387
388     AddTrianglesProcPtr         AddTriangles;
389
390     AddTrapsProcPtr             AddTraps;
391
392     int                         totalGlyphPrivateSize;
393     unsigned int                *glyphPrivateSizes;
394     int                         glyphPrivateLen;
395     int                         glyphPrivateOffset;
396
397     RealizeGlyphProcPtr         RealizeGlyph;
398     UnrealizeGlyphProcPtr       UnrealizeGlyph;
399
400 } PictureScreenRec, *PictureScreenPtr;
401
402 extern int              PictureScreenPrivateIndex;
403 extern int              PictureWindowPrivateIndex;
404 extern RESTYPE          PictureType;
405 extern RESTYPE          PictFormatType;
406 extern RESTYPE          GlyphSetType;
407
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))
413
414 #define GetGlyphPrivatesForScreen(glyph, s)                             \
415     ((glyph)->devPrivates + (GetPictureScreen (s))->glyphPrivateOffset)
416
417 #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
418     pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
419     if (!pPicture) { \
420         client->errorValue = pid; \
421         return err; \
422     } \
423 }
424
425 #define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
426     if (pid == None) \
427         pPicture = 0; \
428     else { \
429         VERIFY_PICTURE(pPicture, pid, client, mode, err); \
430     } \
431 } \
432
433 void
434 ResetPicturePrivateIndex (void);
435
436 int
437 AllocatePicturePrivateIndex (void);
438
439 Bool
440 AllocatePicturePrivate (ScreenPtr pScreen, int index2, unsigned int amount);
441
442 Bool
443 PictureDestroyWindow (WindowPtr pWindow);
444
445 Bool
446 PictureCloseScreen (int Index, ScreenPtr pScreen);
447
448 void
449 PictureStoreColors (ColormapPtr pColormap, int ndef, xColorItem *pdef);
450
451 Bool
452 PictureInitIndexedFormats (ScreenPtr pScreen);
453
454 Bool
455 PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel);
456
457 int
458 PictureGetSubpixelOrder (ScreenPtr pScreen);
459
460 PictFormatPtr
461 PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp);
462
463 PictFormatPtr
464 PictureMatchVisual (ScreenPtr pScreen, int depth, VisualPtr pVisual);
465
466 PictFormatPtr
467 PictureMatchFormat (ScreenPtr pScreen, int depth, CARD32 format);
468
469 Bool
470 PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
471
472 int
473 PictureGetFilterId (char *filter, int len, Bool makeit);
474
475 char *
476 PictureGetFilterName (int id);
477
478 int
479 PictureAddFilter (ScreenPtr                         pScreen,
480                   char                              *filter,
481                   PictFilterValidateParamsProcPtr   ValidateParams);
482
483 Bool
484 PictureSetFilterAlias (ScreenPtr pScreen, char *filter, char *alias);
485
486 Bool
487 PictureSetDefaultFilters (ScreenPtr pScreen);
488
489 void
490 PictureResetFilters (ScreenPtr pScreen);
491
492 PictFilterPtr
493 PictureFindFilter (ScreenPtr pScreen, char *name, int len);
494
495 int
496 SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int nparams);
497
498 Bool
499 PictureFinishInit (void);
500
501 void
502 SetPictureToDefaults (PicturePtr pPicture);
503
504 PicturePtr
505 AllocatePicture (ScreenPtr  pScreen);
506
507 #if 0
508 Bool
509 miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats);
510 #endif
511
512
513 PicturePtr
514 CreatePicture (Picture          pid,
515                DrawablePtr      pDrawable,
516                PictFormatPtr    pFormat,
517                Mask             mask,
518                XID              *list,
519                ClientPtr        client,
520                int              *error);
521
522 int
523 ChangePicture (PicturePtr       pPicture,
524                Mask             vmask,
525                XID              *vlist,
526                DevUnion         *ulist,
527                ClientPtr        client);
528
529 int
530 SetPictureClipRects (PicturePtr pPicture,
531                      int        xOrigin,
532                      int        yOrigin,
533                      int        nRect,
534                      xRectangle *rects);
535
536 int
537 SetPictureClipRegion (PicturePtr    pPicture,
538                       int           xOrigin,
539                       int           yOrigin,
540                       RegionPtr     pRegion);
541
542 int
543 SetPictureTransform (PicturePtr     pPicture,
544                      PictTransform  *transform);
545
546 void
547 CopyPicture (PicturePtr pSrc,
548              Mask       mask,
549              PicturePtr pDst);
550
551 void
552 ValidatePicture(PicturePtr pPicture);
553
554 int
555 FreePicture (pointer    pPicture,
556              XID        pid);
557
558 int
559 FreePictFormat (pointer pPictFormat,
560                 XID     pid);
561
562 void
563 CompositePicture (CARD8         op,
564                   PicturePtr    pSrc,
565                   PicturePtr    pMask,
566                   PicturePtr    pDst,
567                   INT16         xSrc,
568                   INT16         ySrc,
569                   INT16         xMask,
570                   INT16         yMask,
571                   INT16         xDst,
572                   INT16         yDst,
573                   CARD16        width,
574                   CARD16        height);
575
576 void
577 CompositeGlyphs (CARD8          op,
578                  PicturePtr     pSrc,
579                  PicturePtr     pDst,
580                  PictFormatPtr  maskFormat,
581                  INT16          xSrc,
582                  INT16          ySrc,
583                  int            nlist,
584                  GlyphListPtr   lists,
585                  GlyphPtr       *glyphs);
586
587 void
588 CompositeRects (CARD8           op,
589                 PicturePtr      pDst,
590                 xRenderColor    *color,
591                 int             nRect,
592                 xRectangle      *rects);
593
594 void
595 CompositeTrapezoids (CARD8          op,
596                      PicturePtr     pSrc,
597                      PicturePtr     pDst,
598                      PictFormatPtr  maskFormat,
599                      INT16          xSrc,
600                      INT16          ySrc,
601                      int            ntrap,
602                      xTrapezoid     *traps);
603
604 void
605 CompositeTriangles (CARD8           op,
606                     PicturePtr      pSrc,
607                     PicturePtr      pDst,
608                     PictFormatPtr   maskFormat,
609                     INT16           xSrc,
610                     INT16           ySrc,
611                     int             ntriangles,
612                     xTriangle       *triangles);
613
614 void
615 CompositeTriStrip (CARD8            op,
616                    PicturePtr       pSrc,
617                    PicturePtr       pDst,
618                    PictFormatPtr    maskFormat,
619                    INT16            xSrc,
620                    INT16            ySrc,
621                    int              npoints,
622                    xPointFixed      *points);
623
624 void
625 CompositeTriFan (CARD8          op,
626                  PicturePtr     pSrc,
627                  PicturePtr     pDst,
628                  PictFormatPtr  maskFormat,
629                  INT16          xSrc,
630                  INT16          ySrc,
631                  int            npoints,
632                  xPointFixed    *points);
633
634 Bool
635 PictureTransformPoint (PictTransformPtr transform,
636                        PictVectorPtr    vector);
637
638 Bool
639 PictureTransformPoint3d (PictTransformPtr transform,
640                          PictVectorPtr  vector);
641
642 CARD32
643 PictureGradientColor (PictGradientStopPtr stop1,
644                       PictGradientStopPtr stop2,
645                       CARD32              x);
646
647 void RenderExtensionInit (void);
648
649 Bool
650 AnimCurInit (ScreenPtr pScreen);
651
652 int
653 AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor);
654
655 void
656 AddTraps (PicturePtr    pPicture,
657           INT16         xOff,
658           INT16         yOff,
659           int           ntraps,
660           xTrap         *traps);
661
662 pixman_image_t *
663 PixmanImageFromPicture (PicturePtr pPict,
664                         Bool hasClip);
665
666 PicturePtr
667 CreateSolidPicture (Picture pid,
668                     xRenderColor *color,
669                     int *error);
670
671 PicturePtr
672 CreateLinearGradientPicture (Picture pid,
673                              xPointFixed *p1,
674                              xPointFixed *p2,
675                              int nStops,
676                              xFixed *stops,
677                              xRenderColor *colors,
678                              int *error);
679
680 PicturePtr
681 CreateRadialGradientPicture (Picture pid,
682                              xPointFixed *inner,
683                              xPointFixed *outer,
684                              xFixed innerRadius,
685                              xFixed outerRadius,
686                              int nStops,
687                              xFixed *stops,
688                              xRenderColor *colors,
689                              int *error);
690
691 PicturePtr
692 CreateConicalGradientPicture (Picture pid,
693                               xPointFixed *center,
694                               xFixed angle,
695                               int nStops,
696                               xFixed *stops,
697                               xRenderColor *colors,
698                               int *error);
699
700 #ifdef PANORAMIX
701 void PanoramiXRenderInit (void);
702 void PanoramiXRenderReset (void);
703 #endif
704
705 #endif /* _PICTURESTR_H_ */