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 _XRENDER_H_
26#define _XRENDER_H_
27
28#include <X11/Xlib.h>
29#include <X11/Xfuncproto.h>
30#include <X11/Xosdefs.h>
31#include <X11/Xutil.h>
32
33#include <X11/extensions/render.h>
34
35typedef struct {
36 short red;
37 short redMask;
38 short green;
39 short greenMask;
40 short blue;
41 short blueMask;
42 short alpha;
43 short alphaMask;
44} XRenderDirectFormat;
45
46typedef struct {
47 PictFormat id;
48 int type;
49 int depth;
50 XRenderDirectFormat direct;
51 Colormap colormap;
52} XRenderPictFormat;
53
54#define PictFormatID (1 << 0)
55#define PictFormatType (1 << 1)
56#define PictFormatDepth (1 << 2)
57#define PictFormatRed (1 << 3)
58#define PictFormatRedMask (1 << 4)
59#define PictFormatGreen (1 << 5)
60#define PictFormatGreenMask (1 << 6)
61#define PictFormatBlue (1 << 7)
62#define PictFormatBlueMask (1 << 8)
63#define PictFormatAlpha (1 << 9)
64#define PictFormatAlphaMask (1 << 10)
65#define PictFormatColormap (1 << 11)
66
67typedef struct _XRenderPictureAttributes {
68 int repeat;
69 Picture alpha_map;
70 int alpha_x_origin;
71 int alpha_y_origin;
72 int clip_x_origin;
73 int clip_y_origin;
74 Pixmap clip_mask;
75 Bool graphics_exposures;
76 int subwindow_mode;
77 int poly_edge;
78 int poly_mode;
79 Atom dither;
80 Bool component_alpha;
81} XRenderPictureAttributes;
82
83typedef struct {
84 unsigned short red;
85 unsigned short green;
86 unsigned short blue;
87 unsigned short alpha;
88} XRenderColor;
89
90typedef struct _XGlyphInfo {
91 unsigned short width;
92 unsigned short height;
93 short x;
94 short y;
95 short xOff;
96 short yOff;
97} XGlyphInfo;
98
99typedef struct _XGlyphElt8 {
100 GlyphSet glyphset;
101 _Xconst char *chars;
102 int nchars;
103 int xOff;
104 int yOff;
105} XGlyphElt8;
106
107typedef struct _XGlyphElt16 {
108 GlyphSet glyphset;
109 _Xconst unsigned short *chars;
110 int nchars;
111 int xOff;
112 int yOff;
113} XGlyphElt16;
114
115typedef struct _XGlyphElt32 {
116 GlyphSet glyphset;
117 _Xconst unsigned int *chars;
118 int nchars;
119 int xOff;
120 int yOff;
121} XGlyphElt32;
122
123typedef double XDouble;
124
125typedef struct _XPointDouble {
126 XDouble x, y;
127} XPointDouble;
128
129#define XDoubleToFixed(f) ((XFixed) ((f) * 65536))
130#define XFixedToDouble(f) (((XDouble) (f)) / 65536)
131
132typedef int XFixed;
133
134typedef struct _XPointFixed {
135 XFixed x, y;
136} XPointFixed;
137
138typedef struct _XLineFixed {
139 XPointFixed p1, p2;
140} XLineFixed;
141
142typedef struct _XTriangle {
143 XPointFixed p1, p2, p3;
144} XTriangle;
145
146typedef struct _XCircle {
147 XFixed x;
148 XFixed y;
149 XFixed radius;
150} XCircle;
151
152typedef struct _XTrapezoid {
153 XFixed top, bottom;
154 XLineFixed left, right;
155} XTrapezoid;
156
157typedef struct _XTransform {
158 XFixed matrix[3][3];
159} XTransform;
160
161typedef struct _XFilters {
162 int nfilter;
163 char **filter;
164 int nalias;
165 short *alias;
166} XFilters;
167
168typedef struct _XIndexValue {
169 unsigned long pixel;
170 unsigned short red, green, blue, alpha;
171} XIndexValue;
172
173typedef struct _XAnimCursor {
174 Cursor cursor;
175 unsigned long delay;
176} XAnimCursor;
177
178typedef struct _XSpanFix {
179 XFixed left, right, y;
180} XSpanFix;
181
182typedef struct _XTrap {
183 XSpanFix top, bottom;
184} XTrap;
185
186typedef struct _XLinearGradient {
187 XPointFixed p1;
188 XPointFixed p2;
189} XLinearGradient;
190
191typedef struct _XRadialGradient {
192 XCircle inner;
193 XCircle outer;
194} XRadialGradient;
195
196typedef struct _XConicalGradient {
197 XPointFixed center;
198 XFixed angle; /* in degrees */
199} XConicalGradient;
200
201_XFUNCPROTOBEGIN
202
203Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
204
205Status XRenderQueryVersion (Display *dpy,
206 int *major_versionp,
207 int *minor_versionp);
208
209Status XRenderQueryFormats (Display *dpy);
210
211int XRenderQuerySubpixelOrder (Display *dpy, int screen);
212
213Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
214
215XRenderPictFormat *
216XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual);
217
218XRenderPictFormat *
219XRenderFindFormat (Display *dpy,
220 unsigned long mask,
221 _Xconst XRenderPictFormat *templ,
222 int count);
223
224#define PictStandardARGB32 0
225#define PictStandardRGB24 1
226#define PictStandardA8 2
227#define PictStandardA4 3
228#define PictStandardA1 4
229#define PictStandardNUM 5
230
231XRenderPictFormat *
232XRenderFindStandardFormat (Display *dpy,
233 int format);
234
235XIndexValue *
236XRenderQueryPictIndexValues(Display *dpy,
237 _Xconst XRenderPictFormat *format,
238 int *num);
239
240Picture
241XRenderCreatePicture (Display *dpy,
242 Drawable drawable,
243 _Xconst XRenderPictFormat *format,
244 unsigned long valuemask,
245 _Xconst XRenderPictureAttributes *attributes);
246
247void
248XRenderChangePicture (Display *dpy,
249 Picture picture,
250 unsigned long valuemask,
251 _Xconst XRenderPictureAttributes *attributes);
252
253void
254XRenderSetPictureClipRectangles (Display *dpy,
255 Picture picture,
256 int xOrigin,
257 int yOrigin,
258 _Xconst XRectangle *rects,
259 int n);
260
261void
262XRenderSetPictureClipRegion (Display *dpy,
263 Picture picture,
264 Region r);
265
266void
267XRenderSetPictureTransform (Display *dpy,
268 Picture picture,
269 XTransform *transform);
270
271void
272XRenderFreePicture (Display *dpy,
273 Picture picture);
274
275void
276XRenderComposite (Display *dpy,
277 int op,
278 Picture src,
279 Picture mask,
280 Picture dst,
281 int src_x,
282 int src_y,
283 int mask_x,
284 int mask_y,
285 int dst_x,
286 int dst_y,
287 unsigned int width,
288 unsigned int height);
289
290GlyphSet
291XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format);
292
293GlyphSet
294XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing);
295
296void
297XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
298
299void
300XRenderAddGlyphs (Display *dpy,
301 GlyphSet glyphset,
302 _Xconst Glyph *gids,
303 _Xconst XGlyphInfo *glyphs,
304 int nglyphs,
305 _Xconst char *images,
306 int nbyte_images);
307
308void
309XRenderFreeGlyphs (Display *dpy,
310 GlyphSet glyphset,
311 _Xconst Glyph *gids,
312 int nglyphs);
313
314void
315XRenderCompositeString8 (Display *dpy,
316 int op,
317 Picture src,
318 Picture dst,
319 _Xconst XRenderPictFormat *maskFormat,
320 GlyphSet glyphset,
321 int xSrc,
322 int ySrc,
323 int xDst,
324 int yDst,
325 _Xconst char *string,
326 int nchar);
327
328void
329XRenderCompositeString16 (Display *dpy,
330 int op,
331 Picture src,
332 Picture dst,
333 _Xconst XRenderPictFormat *maskFormat,
334 GlyphSet glyphset,
335 int xSrc,
336 int ySrc,
337 int xDst,
338 int yDst,
339 _Xconst unsigned short *string,
340 int nchar);
341
342void
343XRenderCompositeString32 (Display *dpy,
344 int op,
345 Picture src,
346 Picture dst,
347 _Xconst XRenderPictFormat *maskFormat,
348 GlyphSet glyphset,
349 int xSrc,
350 int ySrc,
351 int xDst,
352 int yDst,
353 _Xconst unsigned int *string,
354 int nchar);
355
356void
357XRenderCompositeText8 (Display *dpy,
358 int op,
359 Picture src,
360 Picture dst,
361 _Xconst XRenderPictFormat *maskFormat,
362 int xSrc,
363 int ySrc,
364 int xDst,
365 int yDst,
366 _Xconst XGlyphElt8 *elts,
367 int nelt);
368
369void
370XRenderCompositeText16 (Display *dpy,
371 int op,
372 Picture src,
373 Picture dst,
374 _Xconst XRenderPictFormat *maskFormat,
375 int xSrc,
376 int ySrc,
377 int xDst,
378 int yDst,
379 _Xconst XGlyphElt16 *elts,
380 int nelt);
381
382void
383XRenderCompositeText32 (Display *dpy,
384 int op,
385 Picture src,
386 Picture dst,
387 _Xconst XRenderPictFormat *maskFormat,
388 int xSrc,
389 int ySrc,
390 int xDst,
391 int yDst,
392 _Xconst XGlyphElt32 *elts,
393 int nelt);
394
395void
396XRenderFillRectangle (Display *dpy,
397 int op,
398 Picture dst,
399 _Xconst XRenderColor *color,
400 int x,
401 int y,
402 unsigned int width,
403 unsigned int height);
404
405void
406XRenderFillRectangles (Display *dpy,
407 int op,
408 Picture dst,
409 _Xconst XRenderColor *color,
410 _Xconst XRectangle *rectangles,
411 int n_rects);
412
413void
414XRenderCompositeTrapezoids (Display *dpy,
415 int op,
416 Picture src,
417 Picture dst,
418 _Xconst XRenderPictFormat *maskFormat,
419 int xSrc,
420 int ySrc,
421 _Xconst XTrapezoid *traps,
422 int ntrap);
423
424void
425XRenderCompositeTriangles (Display *dpy,
426 int op,
427 Picture src,
428 Picture dst,
429 _Xconst XRenderPictFormat *maskFormat,
430 int xSrc,
431 int ySrc,
432 _Xconst XTriangle *triangles,
433 int ntriangle);
434
435void
436XRenderCompositeTriStrip (Display *dpy,
437 int op,
438 Picture src,
439 Picture dst,
440 _Xconst XRenderPictFormat *maskFormat,
441 int xSrc,
442 int ySrc,
443 _Xconst XPointFixed *points,
444 int npoint);
445
446void
447XRenderCompositeTriFan (Display *dpy,
448 int op,
449 Picture src,
450 Picture dst,
451 _Xconst XRenderPictFormat *maskFormat,
452 int xSrc,
453 int ySrc,
454 _Xconst XPointFixed *points,
455 int npoint);
456
457void
458XRenderCompositeDoublePoly (Display *dpy,
459 int op,
460 Picture src,
461 Picture dst,
462 _Xconst XRenderPictFormat *maskFormat,
463 int xSrc,
464 int ySrc,
465 int xDst,
466 int yDst,
467 _Xconst XPointDouble *fpoints,
468 int npoints,
469 int winding);
470Status
471XRenderParseColor(Display *dpy,
472 char *spec,
473 XRenderColor *def);
474
475Cursor
476XRenderCreateCursor (Display *dpy,
477 Picture source,
478 unsigned int x,
479 unsigned int y);
480
481XFilters *
482XRenderQueryFilters (Display *dpy, Drawable drawable);
483
484void
485XRenderSetPictureFilter (Display *dpy,
486 Picture picture,
487 const char *filter,
488 XFixed *params,
489 int nparams);
490
491Cursor
492XRenderCreateAnimCursor (Display *dpy,
493 int ncursor,
494 XAnimCursor *cursors);
495
496
497void
498XRenderAddTraps (Display *dpy,
499 Picture picture,
500 int xOff,
501 int yOff,
502 _Xconst XTrap *traps,
503 int ntrap);
504
505Picture XRenderCreateSolidFill (Display *dpy,
506 const XRenderColor *color);
507
508Picture XRenderCreateLinearGradient (Display *dpy,
509 const XLinearGradient *gradient,
510 const XFixed *stops,
511 const XRenderColor *colors,
512 int nstops);
513
514Picture XRenderCreateRadialGradient (Display *dpy,
515 const XRadialGradient *gradient,
516 const XFixed *stops,
517 const XRenderColor *colors,
518 int nstops);
519
520Picture XRenderCreateConicalGradient (Display *dpy,
521 const XConicalGradient *gradient,
522 const XFixed *stops,
523 const XRenderColor *colors,
524 int nstops);
525
526_XFUNCPROTOEND
527
528#endif /* _XRENDER_H_ */
529

source code of include/X11/extensions/Xrender.h