VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.10.0/picturestr.h

Last change on this file was 36308, checked in by vboxsync, 14 years ago

fix OSE

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette