VirtualBox

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

Last change on this file since 78293 was 54163, checked in by vboxsync, 10 years ago

Additions/x11/vboxvideo: support X.Org Server 1.17 (still untested).

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