Debian Codegraph @

include/X11/extensions/Xrender.h

raw
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 /**
26 * @file Xrender.h
27 * @brief XRender library API.
28 */
29
30 #ifndef _XRENDER_H_
31 #define _XRENDER_H_
32
33 #include <X11/Xfuncproto.h>
34 #include <X11/Xlib.h>
35 #include <X11/Xosdefs.h>
36 #include <X11/Xutil.h>
37
38 #include <X11/extensions/render.h>
39
40 /**
41 * @mainpage libXrender API Documentation.
42 *
43 * Dummy text down here.
44 */
45
46 /**
47 * The direct component of a PictFormat.
48 *
49 * It contains a binary description of the color format used by the Picture.
50 *
51 * * A Zero bit alphaMask is declared to have an opaque alpha everywhere.
52 * * A Zero bit redMask, greenMask and blueMask is declared to have red, green,
53 * blue == 0 everywhere.
54 * * If any of redMask, greenMask or blueMask are zero, all other masks are
55 * zero.
56 */
57 typedef struct {
58 /** Red component binary displacement. */
59 short red;
60 /** Red component bit mask. */
61 short redMask;
62 /** Green component binary displacement. */
63 short green;
64 /** Green component bit mask. */
65 short greenMask;
66 /** Blue component binary displacement. */
67 short blue;
68 /** Blue component bit mask. */
69 short blueMask;
70 /** Alpha component binary displacement. */
71 short alpha;
72 /** Alpha component bit mask. */
73 short alphaMask;
74 } XRenderDirectFormat;
75
76 /**
77 * A Picture pixel format description.
78 *
79 * It describes the format used by the server to display colors.
80 *
81 * There are two types:
82 * * Direct: Doesn't have a Colormap and the DirectFormat structure describes
83 * the pixel format.
84 * * Indexed: Has a Colormap and it's DirectFormat structure is filled with
85 * zeros.
86 */
87 typedef struct {
88 /** XID of this structure server instance. */
89 PictFormat id;
90 /** Color management type. */
91 int type;
92 /** Pixel bit depth. */
93 int depth;
94 /** Color component description. */
95 XRenderDirectFormat direct;
96 /** XID of the map of indexed colors on the server. */
97 Colormap colormap;
98 } XRenderPictFormat;
99
100 /*< XRenderPictFormat template field masks.
101 * @{
102 */
103 /** Include ID field. @hideinitializer */
104 #define PictFormatID (1 << 0)
105 /** Include Type field. @hideinitializer */
106 #define PictFormatType (1 << 1)
107 /** Include Depth field. @hideinitializer */
108 #define PictFormatDepth (1 << 2)
109
110 /*<--- XRenderPictFormat->direct fields. */
111 /** Include Direct->Red field. @hideinitializer */
112 #define PictFormatRed (1 << 3)
113 /** Include Direct->RedMask field. @hideinitializer */
114 #define PictFormatRedMask (1 << 4)
115 /** Include Direct->Green field. @hideinitializer */
116 #define PictFormatGreen (1 << 5)
117 /** Include Direct->GreenMask field. @hideinitializer */
118 #define PictFormatGreenMask (1 << 6)
119 /** Include Direct->Blue field. @hideinitializer */
120 #define PictFormatBlue (1 << 7)
121 /** Include Direct->BlueMask field. @hideinitializer */
122 #define PictFormatBlueMask (1 << 8)
123 /** Include Direct->Alpha field. @hideinitializer */
124 #define PictFormatAlpha (1 << 9)
125 /** Include Direct->AlphaMask field. @hideinitializer */
126 #define PictFormatAlphaMask (1 << 10)
127
128 /** Include Colormap field. @hideinitializer */
129 #define PictFormatColormap (1 << 11)
130 /** @} */
131
132 /**
133 * Picture rendering attributes.
134 */
135 typedef struct _XRenderPictureAttributes {
136 /** How to repeat the picture. */
137 int repeat;
138
139 /** A replacement alpha-map. Must be a pixmap-containing Picture. */
140 Picture alpha_map;
141 /** Horizontal displacement of the replacement alpha-map. */
142 int alpha_x_origin;
143 /** Vertical displacement of the replacement alpha-map. */
144 int alpha_y_origin;
145
146 /** Horizontal displacement of the clip mask. */
147 int clip_x_origin;
148 /** Vertical displacement of the clip mask. */
149 int clip_y_origin;
150 /** A r/w restriction to the drawable. */
151 Pixmap clip_mask;
152
153 /** Whether to receive GraphicsExpose events. @note Ignored field. */
154 Bool graphics_exposures;
155 /** How to clip pixels on subwindow overlap. */
156 int subwindow_mode;
157 /** Alpha mask generation mode. */
158 int poly_edge;
159 /** Alpha value rasterization mode. */
160 int poly_mode;
161 /** Dithering mode. @note Ignored field. */
162 Atom dither;
163 /** Treat alpha channels independently. */
164 Bool component_alpha;
165 } XRenderPictureAttributes;
166
167 /** An alpha-blended color with premultiplied components.
168 *
169 * Values are in the range from 0 to 65535 inclusive, scaled down to the right
170 * hardware values by the server. Colors must be premultiplied by alpha by the
171 * client in all cases but gradient operations.
172 */
173 typedef struct {
174 /** Red color channel. */
175 unsigned short red;
176 /** Green color channel. */
177 unsigned short green;
178 /** Blue color channel. */
179 unsigned short blue;
180 /** Alpha color channel. */
181 unsigned short alpha;
182 } XRenderColor;
183
184 /**
185 * Glyph positioning and sizing information.
186 *
187 * A glyph is positioned by taking the requested position and substracting the
188 * center offset.
189 */
190 typedef struct _XGlyphInfo {
191 /** Glyph width. */
192 unsigned short width;
193 /** Glyph height. */
194 unsigned short height;
195
196 /** Horizontal Glyph center offset relative to the upper-left corner. */
197 short x;
198 /** Vertical Glyph center offset relative to the upper-left corner. */
199 short y;
200
201 /** Horizontal margin to the next Glyph. */
202 short xOff;
203 /** Vertical margin to the next Glyph. */
204 short yOff;
205 } XGlyphInfo;
206
207 /*< Glyph Elements.
208 * Group of glyphs to be rendered.
209 * While selecting the right element type, you should use as a reference the
210 * largest identifier in Elt->glyphset.
211 */
212 /** @{ */
213
214 /**
215 * 8-bit Glyph Element.
216 */
217 typedef struct _XGlyphElt8 {
218 /** Set of available glyphs. */
219 GlyphSet glyphset;
220
221 /** 8-bit glyph id array. */
222 _Xconst char *chars;
223 /** Glyph array size. */
224 int nchars;
225
226 /** Horizontal offset. */
227 int xOff;
228 /** Vertical offset. */
229 int yOff;
230 } XGlyphElt8;
231
232 /**
233 * 16-bit Glyph Element.
234 */
235 typedef struct _XGlyphElt16 {
236 /** Set of available glyphs. */
237 GlyphSet glyphset;
238
239 /** 16-bit glyph id array. */
240 _Xconst unsigned short *chars;
241 /** Glyph array size. */
242 int nchars;
243
244 /** Horizontal offset. */
245 int xOff;
246 /** Vertical offset. */
247 int yOff;
248 } XGlyphElt16;
249
250 /**
251 * 32-bit Glyph Element.
252 */
253 typedef struct _XGlyphElt32 {
254 /** Set of available glyphs. */
255 GlyphSet glyphset;
256
257 /** 32-bit glyph id array. */
258 _Xconst unsigned int *chars;
259 /** Glyph array size. */
260 int nchars;
261
262 /** Horizontal offset. */
263 int xOff;
264 /** Vertical offset. */
265 int yOff;
266 } XGlyphElt32;
267 /**@} */
268
269 /*< Utility number types.
270 *
271 */
272 /**@{ */
273
274 /**
275 * Floating-point number.
276 */
277 typedef double XDouble;
278
279 /**
280 * Fixed-point number.
281 */
282 typedef int XFixed;
283
284 /** Turn XDouble into XFixed. @hideinitializer */
285 #define XDoubleToFixed(f) ((XFixed)((f)*65536))
286 /** Turn XFixed into XDouble. @hideinitializer */
287 #define XFixedToDouble(f) (((XDouble)(f)) / 65536)
288 /** @} */
289
290 /**
291 * Point coordinates stored as floats.
292 */
293 typedef struct _XPointDouble {
294 XDouble x, y;
295 } XPointDouble;
296
297 /**
298 * Point coordinates as integers.
299 */
300 typedef struct _XPointFixed {
301 XFixed x, y;
302 } XPointFixed;
303
304 /**
305 * Line described by two points.
306 */
307 typedef struct _XLineFixed {
308 XPointFixed p1, p2;
309 } XLineFixed;
310
311 /**
312 * Triangle described by it's vertices.
313 * @see XTrap
314 */
315 typedef struct _XTriangle {
316 XPointFixed p1, p2, p3;
317 } XTriangle;
318
319 /**
320 * Circle described by it's center point and a radius.
321 */
322 typedef struct _XCircle {
323 XFixed x;
324 XFixed y;
325 XFixed radius;
326 } XCircle;
327
328 /** A trapezoid.
329 *
330 * @deprecated Use XTrap instead
331 * @see
332 * * XTriangle
333 * * XTrap
334 */
335 typedef struct _XTrapezoid {
336 XFixed top, bottom;
337 XLineFixed left, right;
338 } XTrapezoid;
339
340 /**
341 * A transform matrix.
342 */
343 typedef struct _XTransform {
344 XFixed matrix[3][3];
345 } XTransform;
346
347 /**
348 * Group filters and filter aliases.
349 */
350 typedef struct _XFilters {
351 /** Filter names count. */
352 int nfilter;
353 /** Filter names array. */
354 char **filter;
355 /** Aliases array count. */
356 int nalias;
357 /** Array of «Index in .filter of the aliased filter or 0xffff». */
358 short *alias;
359 } XFilters;
360
361 /**
362 * The value of an indexed color.
363 */
364 typedef struct _XIndexValue {
365 /** Index ID. */
366 unsigned long pixel;
367 /** Color components. */
368 unsigned short red, green, blue, alpha;
369 } XIndexValue;
370
371 /**
372 * A single cursor frame.
373 */
374 typedef struct _XAnimCursor {
375 /** Existing cursor. */
376 Cursor cursor;
377 /** Animation delay. */
378 unsigned long delay;
379 } XAnimCursor;
380
381 /**
382 * An horizontal line.
383 */
384 typedef struct _XSpanFix {
385 XFixed left, right, y;
386 } XSpanFix;
387
388 /**
389 * A trapezoid defined by two lines.
390 * @see XTriangle
391 */
392 typedef struct _XTrap {
393 XSpanFix top, bottom;
394 } XTrap;
395
396 /**
397 * Linear gradient shape.
398 */
399 typedef struct _XLinearGradient {
400 XPointFixed p1;
401 XPointFixed p2;
402 } XLinearGradient;
403
404 /**
405 * Radial gradient shape.
406 */
407 typedef struct _XRadialGradient {
408 XCircle inner;
409 XCircle outer;
410 } XRadialGradient;
411
412 /**
413 * Conical gradient shape.
414 */
415 typedef struct _XConicalGradient {
416 XPointFixed center;
417 XFixed angle; /* in degrees */
418 } XConicalGradient;
419
420 _XFUNCPROTOBEGIN
421
422 /** @defgroup queries Early check queries.
423 * @{
424 */
425
426 /**
427 * Ask for the Render extension presence and its base numbers.
428 *
429 * @param dpy Connection to the X server.
430 * @param[out] event_basep first event number for the extension.
431 * @param[out] error_basep first error number for the extension.
432 * @return True if Render is present.
433 */
434 Bool XRenderQueryExtension(Display *dpy, int *event_basep, int *error_basep);
435
436 /**
437 * Ask for the extension version.
438 *
439 * @param dpy Connection to the X server.
440 * @param[out] major_versionp Extension's major version.
441 * @param[out] minor_versionp Extension's major version.
442 * @return Status «1» on success.
443 */
444 Status XRenderQueryVersion(Display *dpy, int *major_versionp,
445 int *minor_versionp);
446
447 /**
448 * Check for and cache compatible picture formats.
449 *
450 * @param dpy Connection to the X server.
451 * @return Status «1» on success.
452 */
453 Status XRenderQueryFormats(Display *dpy);
454
455 /**
456 * Ask for the current subpixel order of a screen.
457 *
458 * @param dpy Connection to the X server.
459 * @param[in] screen Target screen number.
460 * @return SubPixelUnknown on error, else a subpixel order.
461 */
462 int XRenderQuerySubpixelOrder(Display *dpy, int screen);
463
464 /**
465 * Change the subpixel order of a screen.
466 *
467 * @param dpy Connection to the X server
468 * @param[in] screen Target screen number.
469 * @param[in] subpixel Requested subpixel order.
470 * @return True if the operation was successful.
471 */
472 Bool XRenderSetSubpixelOrder(Display *dpy, int screen, int subpixel);
473 /** @} */
474
475 /**
476 * Ask for the Picture format for a Visual.
477 *
478 * @param dpy Connection to the X server.
479 * @param[in] visual Reference Visual object.
480 * @return The requested Picture format.
481 */
482 XRenderPictFormat *XRenderFindVisualFormat(Display *dpy,
483 _Xconst Visual *visual);
484
485 /**
486 * Ask for matching Picture formats from a template.
487 *
488 * @param dpy Connection to the X server.
489 * @param[in] mask `templ` fields mask to use.
490 * @param[in] templ Requested Picture format template.
491 * @param[in] count Skip `count` formats.
492 * @return NULL if no matching format found, else a Picture format.
493 */
494 XRenderPictFormat *XRenderFindFormat(Display *dpy, unsigned long mask,
495 _Xconst XRenderPictFormat *templ,
496 int count);
497
498 /** Standard format specifiers.
499 * @{
500 */
501 /** 8-bit RGB with Alpha. @hideinitializer */
502 #define PictStandardARGB32 0
503 /** 8-bit RGB. @hideinitializer */
504 #define PictStandardRGB24 1
505 /** 8-bit Alpha map. @hideinitializer */
506 #define PictStandardA8 2
507 /** 4-bit Alpha map. @hideinitializer */
508 #define PictStandardA4 3
509 /** 1-bit Alpha map. @hideinitializer */
510 #define PictStandardA1 4
511 /** Supported standard formats count. @hideinitializer */
512 #define PictStandardNUM 5
513 /** @} */
514
515 /**
516 * Ask for a predefined standard picture format.
517 *
518 * This is a shorthand to XRenderFindFormat for finding common formats.
519 *
520 * @param dpy Connection to the X server.
521 * @param[in] format Desired format specifier.
522 * @return NULL if no matching format found, else a Picture format.
523 */
524 XRenderPictFormat *XRenderFindStandardFormat(Display *dpy, int format);
525
526 /**
527 * Ask for the indexed colors of a Picture format.
528 *
529 * @param dpy Connection to the X server.
530 * @param[in] format Queried picture format.
531 * @param[out] num Size of the output array.
532 * @return An array of XIndexValue.
533 */
534 XIndexValue *XRenderQueryPictIndexValues(Display *dpy,
535 _Xconst XRenderPictFormat *format,
536 int *num);
537
538 /**
539 * Creates a Picture for a drawable.
540 *
541 * @param dpy Connection to the X server.
542 * @param[in] drawable Target Drawable.
543 * @param[in] format Format for the Picture.
544 * @param[in] valuemask `attributes` fields mask to use.
545 * @param[in] attributes Desired attributes for the Picture.
546 * @return A Picture tied to the drawable.
547 */
548 Picture XRenderCreatePicture(Display *dpy, Drawable drawable,
549 _Xconst XRenderPictFormat *format,
550 unsigned long valuemask,
551 _Xconst XRenderPictureAttributes *attributes);
552
553 /**
554 * Free allocated structures for a Picture.
555 *
556 * @warning A freed Picture shouldn't be used again.
557 *
558 * @param dpy Connection to the X server.
559 * @param[in] picture Target Picture.
560 */
561 void XRenderFreePicture(Display *dpy, Picture picture);
562
563 /**
564 * Change a Picture's attributes structure.
565 *
566 * @param dpy Connection to the X server.
567 * @param[in] picture Target Picture.
568 * @param[in] valuemask `attributes` fields mask to use.
569 * @param[in] attributes Desired attributes for the Picture.
570 */
571 void XRenderChangePicture(Display *dpy, Picture picture,
572 unsigned long valuemask,
573 _Xconst XRenderPictureAttributes *attributes);
574
575 /**
576 * Change a Picture's clip mask to the specified rectangles.
577 *
578 * @param dpy Connection to the X server.
579 * @param[in] picture Target Picture.
580 * @param[in] xOrigin Horizontal mask origin.
581 * @param[in] yOrigin Vertical mask origin.
582 * @param[in] rects Array of rectangles to clip with.
583 * @param[in] n `rects` array size.
584 */
585 void XRenderSetPictureClipRectangles(Display *dpy, Picture picture, int xOrigin,
586 int yOrigin, _Xconst XRectangle *rects,
587 int n);
588
589 /**
590 * Change a Picture's clip mask to the specified Region.
591 *
592 * @param dpy Connection to the X server.
593 * @param[in] picture Target Picture.
594 * @param[in] r Region to clip with.
595 */
596 void XRenderSetPictureClipRegion(Display *dpy, Picture picture, Region r);
597
598 /**
599 * Change a Picture's Transform matrix.
600 *
601 * @param dpy Connection to the X server
602 * @param[in] picture Target Picture.
603 * @param[in] transform Transform matrix to use.
604 */
605 void XRenderSetPictureTransform(Display *dpy, Picture picture,
606 XTransform *transform);
607
608 /**
609 * Combines two Pictures with the specified compositing operation.
610 *
611 * @param dpy Connection to the X server.
612 * @param[in] op Compositing operation to perform.
613 * @param[in] src Picture to combine with.
614 * @param[in] mask Composition mask.
615 * @param[in] dst Picture to combine into.
616 * @param[in] src_x Horizontal `src` origin offset.
617 * @param[in] src_y Vertical `src` origin offset
618 * @param[in] mask_x Horizontal `mask` origin offset.
619 * @param[in] mask_y Vertical `mask` origin offset.
620 * @param[in] dst_x Horizontal `dst` origin offset.
621 * @param[in] dst_y Vertical `dst` origin offset.
622 * @param[in] width Maximum composition width.
623 * @param[in] height Maximum composition height.
624 */
625 void XRenderComposite(Display *dpy, int op, Picture src, Picture mask,
626 Picture dst, int src_x, int src_y, int mask_x, int mask_y,
627 int dst_x, int dst_y, unsigned int width,
628 unsigned int height);
629
630 /**
631 * Create a Glyph Set.
632 *
633 * @param dpy Connection to the X server.
634 * @param[in] format Desired format for the Glyphs Picture.
635 * @return A GlyphSet.
636 */
637 GlyphSet XRenderCreateGlyphSet(Display *dpy, _Xconst XRenderPictFormat *format);
638
639 /**
640 * Generate a new reference for an existing Glyph Set.
641 *
642 * @param dpy Connection to the X server.
643 * @param[in] existing Target Glyph Set.
644 * @return A GlyphSet identical to `existing`.
645 */
646 GlyphSet XRenderReferenceGlyphSet(Display *dpy, GlyphSet existing);
647
648 /**
649 * Free allocated structures for a GlyphSet.
650 *
651 * If there's more references to the underlying GlyphSet structures, this will
652 * remove only the specified GlyphSet reference.
653 *
654 * @warning A freed GlyphSet shouldn't be used again.
655 *
656 * @param dpy Connection to the X server.
657 * @param[in] glyphset Target GlyphSet.
658 */
659 void XRenderFreeGlyphSet(Display *dpy, GlyphSet glyphset);
660
661 /**
662 * Add new Glyphs to a GlyphSet.
663 *
664 * @param dpy Connection to the X server.
665 * @param[in] glyphset Glyph storage destination.
666 * @param[in] gids Array of ids for the new Glyphs.
667 * @param[in] glyphs Array of new Glyphs info.
668 * @param[in] nglyphs Number of Glyphs to add.
669 * @param[in] images Byte array containing the Glyphs graphics.
670 * @param[in] nbyte_images Size of the `images` byte array.
671 */
672 void XRenderAddGlyphs(Display *dpy, GlyphSet glyphset, _Xconst Glyph *gids,
673 _Xconst XGlyphInfo *glyphs, int nglyphs,
674 _Xconst char *images, int nbyte_images);
675
676 /**
677 * Free allocated Glyphs.
678 *
679 * @param dpy Connection to the X server.
680 * @param[in] glyphset GlyphSet storing the Glyphs.
681 * @param[in] gids Identifier array of the Glyphs to dellocate.
682 * @param[in] nglyphs Glyph count.
683 */
684 void XRenderFreeGlyphs(Display *dpy, GlyphSet glyphset, _Xconst Glyph *gids,
685 int nglyphs);
686
687 /**
688 * Draw a 8-bit character string into a Picture.
689 *
690 * @param dpy Connection to the X server.
691 * @param[in] op Compositing operation to perform.
692 * @param[in] src Picture to combine with.
693 * @param[in] dst Picture to combine into.
694 * @param[in] maskFormat Picture format of the generated Picture mask.
695 * @param[in] glyphset Glyph Source.
696 * @param[in] xSrc Horizontal `src` origin offset.
697 * @param[in] ySrc Vertical `src` origin offset.
698 * @param[in] xDst Horizontal `dst` origin offset.
699 * @param[in] yDst Vertical `dst` origin offset.
700 * @param[in] string String to clip to.
701 * @param[in] nchar String length.
702 */
703 void XRenderCompositeString8(Display *dpy, int op, Picture src, Picture dst,
704 _Xconst XRenderPictFormat *maskFormat,
705 GlyphSet glyphset, int xSrc, int ySrc, int xDst,
706 int yDst, _Xconst char *string, int nchar);
707
708 /**
709 * Draw a 16-bit character string into a Picture.
710 *
711 * @param dpy Connection to the X server.
712 * @param[in] op Compositing operation to perform.
713 * @param[in] src Picture to combine with.
714 * @param[in] dst Picture to combine into.
715 * @param[in] maskFormat Picture format of the generated Picture mask.
716 * @param[in] glyphset Glyph Source.
717 * @param[in] xSrc Horizontal `src` origin offset.
718 * @param[in] ySrc Vertical `src` origin offset.
719 * @param[in] xDst Horizontal `dst` origin offset.
720 * @param[in] yDst Vertical `dst` origin offset.
721 * @param[in] string String to clip to.
722 * @param[in] nchar String length.
723 */
724 void XRenderCompositeString16(Display *dpy, int op, Picture src, Picture dst,
725 _Xconst XRenderPictFormat *maskFormat,
726 GlyphSet glyphset, int xSrc, int ySrc, int xDst,
727 int yDst, _Xconst unsigned short *string,
728 int nchar);
729
730 /**
731 * Draw a 32-bit character string into a Picture.
732 *
733 * @param dpy Connection to the X server.
734 * @param[in] op Compositing operation to perform.
735 * @param[in] src Picture to combine with.
736 * @param[in] dst Picture to combine into.
737 * @param[in] maskFormat Picture format of the generated Picture mask.
738 * @param[in] glyphset Glyph Source.
739 * @param[in] xSrc Horizontal `src` origin offset.
740 * @param[in] ySrc Vertical `src` origin offset.
741 * @param[in] xDst Horizontal `dst` origin offset.
742 * @param[in] yDst Vertical `dst` origin offset.
743 * @param[in] string String to clip to.
744 * @param[in] nchar String length.
745 */
746 void XRenderCompositeString32(Display *dpy, int op, Picture src, Picture dst,
747 _Xconst XRenderPictFormat *maskFormat,
748 GlyphSet glyphset, int xSrc, int ySrc, int xDst,
749 int yDst, _Xconst unsigned int *string,
750 int nchar);
751
752 /**
753 * Draw several 8-bit Glyph Elements into a Picture.
754 *
755 * @param dpy Connection to the X server.
756 * @param[in] op Compositing operation to perform.
757 * @param[in] src Picture to combine with.
758 * @param[in] dst Picture to combine into.
759 * @param[in] maskFormat Picture format of the generated Picture mask.
760 * @param[in] xSrc Horizontal `src` origin offset.
761 * @param[in] ySrc Vertical `src` origin offset.
762 * @param[in] xDst Horizontal `dst` origin offset.
763 * @param[in] yDst Vertical `dst` origin offset.
764 * @param[in] elts Glyph Elements array to clip with.
765 * @param[in] nelt Glyph Elements array size.
766 */
767 void XRenderCompositeText8(Display *dpy, int op, Picture src, Picture dst,
768 _Xconst XRenderPictFormat *maskFormat, int xSrc,
769 int ySrc, int xDst, int yDst,
770 _Xconst XGlyphElt8 *elts, int nelt);
771
772 /**
773 * Draw several 16-bit Glyph Elements into a Picture.
774 *
775 * @param dpy Connection to the X server.
776 * @param[in] op Compositing operation to perform.
777 * @param[in] src Picture to combine with.
778 * @param[in] dst Picture to combine into.
779 * @param[in] maskFormat Picture format of the generated Picture mask.
780 * @param[in] xSrc Horizontal `src` origin offset.
781 * @param[in] ySrc Vertical `src` origin offset.
782 * @param[in] xDst Horizontal `dst` origin offset.
783 * @param[in] yDst Vertical `dst` origin offset.
784 * @param[in] elts Glyph Elements array to clip with.
785 * @param[in] nelt Glyph Elements array size.
786 */
787 void XRenderCompositeText16(Display *dpy, int op, Picture src, Picture dst,
788 _Xconst XRenderPictFormat *maskFormat, int xSrc,
789 int ySrc, int xDst, int yDst,
790 _Xconst XGlyphElt16 *elts, int nelt);
791
792 /**
793 * Draw several 32-bit Glyph Elements into a Picture.
794 *
795 * @param dpy Connection to the X server.
796 * @param[in] op Compositing operation to perform.
797 * @param[in] src Picture to combine with.
798 * @param[in] dst Picture to combine into.
799 * @param[in] maskFormat Picture format of the generated Picture mask.
800 * @param[in] xSrc Horizontal `src` origin offset.
801 * @param[in] ySrc Vertical `src` origin offset.
802 * @param[in] xDst Horizontal `dst` origin offset.
803 * @param[in] yDst Vertical `dst` origin offset.
804 * @param[in] elts Glyph Elements to clip with.
805 * @param[in] nelt Glyph Elements array size.
806 */
807 void XRenderCompositeText32(Display *dpy, int op, Picture src, Picture dst,
808 _Xconst XRenderPictFormat *maskFormat, int xSrc,
809 int ySrc, int xDst, int yDst,
810 _Xconst XGlyphElt32 *elts, int nelt);
811
812 /**
813 * Fill a Rectangle with the given color.
814 *
815 * @param dpy Connection to the X server.
816 * @param[in] op Compositing operation to perform.
817 * @param[in] dst Picture to draw into.
818 * @param[in] color Color to fill with.
819 * @param[in] x Horizontal offset.
820 * @param[in] y Vertical offset.
821 * @param[in] width Rectangle width.
822 * @param[in] height Rectangle height.
823 */
824 void XRenderFillRectangle(Display *dpy, int op, Picture dst,
825 _Xconst XRenderColor *color, int x, int y,
826 unsigned int width, unsigned int height);
827
828 /**
829 * Fill a bunch of Rectangle with the given color.
830 *
831 * @param dpy Connection to the X server.
832 * @param[in] op Compositing operation to perform.
833 * @param[in] dst Picture to draw into.
834 * @param[in] color Color to fill with.
835 * @param[in] rectangles Array of Rectangles to fill.
836 * @param[in] n_rects `rectangles` array size.
837 */
838 void XRenderFillRectangles(Display *dpy, int op, Picture dst,
839 _Xconst XRenderColor *color,
840 _Xconst XRectangle *rectangles, int n_rects);
841
842 /**
843 * Combine two Pictures using a bunch of Trapezoids as the mask.
844 *
845 * @param dpy Connection to the X server.
846 * @param[in] op Compositing operation to perform.
847 * @param[in] src Picture to combine with.
848 * @param[in] dst Picture to combine into.
849 * @param[in] maskFormat Picture format of the generated Picture mask.
850 * @param[in] xSrc Horizontal `src` origin offset.
851 * @param[in] ySrc Vertical `src` origin offset.
852 * @param[in] traps Array of Trapezoids to clip with.
853 * @param[in] ntrap `traps` Array size.
854 */
855 void XRenderCompositeTrapezoids(Display *dpy, int op, Picture src, Picture dst,
856 _Xconst XRenderPictFormat *maskFormat, int xSrc,
857 int ySrc, _Xconst XTrapezoid *traps, int ntrap);
858
859 /**
860 * Combine two Pictures using a bunch of Triangles as the mask.
861 *
862 * @param dpy Connection to the X server.
863 * @param[in] op Compositing operation to perform.
864 * @param[in] src Picture to combine with.
865 * @param[in] dst Picture to combine into.
866 * @param[in] maskFormat Picture format of the generated Picture mask.
867 * @param[in] xSrc Horizontal `src` origin offset.
868 * @param[in] ySrc Vertical `src` origin offset.
869 * @param[in] triangles Array of Triangles to clip with.
870 * @param[in] ntriangle `triangles` array size.
871 */
872 void XRenderCompositeTriangles(Display *dpy, int op, Picture src, Picture dst,
873 _Xconst XRenderPictFormat *maskFormat, int xSrc,
874 int ySrc, _Xconst XTriangle *triangles,
875 int ntriangle);
876
877 /**
878 * Combine two Pictures using a Triangle Strip as the mask.
879 *
880 * @param dpy Connection to the X server.
881 * @param[in] op Compositing operation to perform.
882 * @param[in] src Picture to combine with.
883 * @param[in] dst Picture to combine into.
884 * @param[in] maskFormat Picture format of the generated Picture mask.
885 * @param[in] xSrc Horizontal `src` origin offset.
886 * @param[in] ySrc Vertical `src` origin offset.
887 * @param[in] points Array of Points to create Triangles with.
888 * @param[in] npoint `points` array size.
889 */
890 void XRenderCompositeTriStrip(Display *dpy, int op, Picture src, Picture dst,
891 _Xconst XRenderPictFormat *maskFormat, int xSrc,
892 int ySrc, _Xconst XPointFixed *points,
893 int npoint);
894
895 /**
896 * Combine two Pictures using a Triangle Fan as the mask.
897 *
898 * @param dpy Connection to the X server.
899 * @param[in] op Compositing operation to perform.
900 * @param[in] src Picture to combine with.
901 * @param[in] dst Picture to combine into.
902 * @param[in] maskFormat Picture format of the generated Picture mask.
903 * @param[in] xSrc Horizontal `src` origin offset.
904 * @param[in] ySrc Vertical `src` origin offset.
905 * @param[in] points Array of Points to create Triangles with.
906 * @param[in] npoint `points` array size.
907 */
908 void XRenderCompositeTriFan(Display *dpy, int op, Picture src, Picture dst,
909 _Xconst XRenderPictFormat *maskFormat, int xSrc,
910 int ySrc, _Xconst XPointFixed *points, int npoint);
911
912 /**
913 * Combine two Pictures using a Polygon as the mask.
914 *
915 * @param dpy Connection to the X server.
916 * @param[in] op Compositing operation to perform.
917 * @param[in] src Picture to combine with.
918 * @param[in] dst Picture to combine into.
919 * @param[in] maskFormat Picture format of the generated Picture mask.
920 * @param[in] xSrc Horizontal `src` origin offset.
921 * @param[in] ySrc Vertical `src` origin offset.
922 * @param[in] xDst Horizontal `dst` origin offset.
923 * @param[in] yDst Vertical `dst` origin offset.
924 * @param[in] fpoints Array of DoublePoints to create a Polygon with.
925 * @param[in] npoints `points` array size.
926 * @param winding Unused.
927 */
928 void XRenderCompositeDoublePoly(Display *dpy, int op, Picture src, Picture dst,
929 _Xconst XRenderPictFormat *maskFormat, int xSrc,
930 int ySrc, int xDst, int yDst,
931 _Xconst XPointDouble *fpoints, int npoints,
932 int winding);
933
934 /**
935 * Parse a color string.
936 *
937 * @param dpy Connection to the X server.
938 * @param[in] spec Null-terminated string.
939 * @param[out] def Parsing result.
940 * @return Status «1» on success.
941 */
942 Status XRenderParseColor(Display *dpy, char *spec, XRenderColor *def);
943
944 /**
945 * Creates a cursor looking like a Picture.
946 *
947 * @param dpy Connection to the X server.
948 * @param[in] source Picture defining the cursor look.
949 * @param[in] x Horizontal offset.
950 * @param[in] y Vertical offset.
951 * @return A Cursor.
952 */
953 Cursor XRenderCreateCursor(Display *dpy, Picture source, unsigned int x,
954 unsigned int y);
955
956 /**
957 * Ask for Filters applicable to some Drawable.
958 *
959 * @param dpy Connection to the X server.
960 * @param[in] drawable Target Drawable.
961 * @return Available Filters and Aliases.
962 */
963 XFilters *XRenderQueryFilters(Display *dpy, Drawable drawable);
964
965 /**
966 * Set the current filter of a Picture.
967 *
968 * @note On Picture creation, the «Nearest» filter is set by default.
969 *
970 * @param dpy Connection to the X server.
971 * @param[in] picture Target.
972 * @param[in] filter Filter name.
973 * @param[in] params Filter parameters array.
974 * @param[in] nparams `params` array size.
975 */
976 void XRenderSetPictureFilter(Display *dpy, Picture picture, const char *filter,
977 XFixed *params, int nparams);
978
979 /**
980 * Create an animated Cursor from the given Cursor frames.
981 *
982 * @param dpy Connection to the X server.
983 * @param[in] ncursor Cursor frames count.
984 * @param[in] cursors Cursor frames array.
985 * @return An animated Cursor.
986 */
987 Cursor XRenderCreateAnimCursor(Display *dpy, int ncursor, XAnimCursor *cursors);
988
989 /**
990 * Add the given Trapezoids to a single-channel Picture.
991 *
992 * @param dpy Connection to the X server.
993 * @param[in] picture An alpha-only Picture.
994 * @param[in] xOff Horizontal offset.
995 * @param[in] yOff Vertical offset.
996 * @param[in] traps Array of trapezoids.
997 * @param[in] ntrap `traps` array size.
998 */
999 void XRenderAddTraps(Display *dpy, Picture picture, int xOff, int yOff,
1000 _Xconst XTrap *traps, int ntrap);
1001
1002 /**
1003 * Create a Picture filled with a single Color.
1004 *
1005 * @param dpy Connection to the X server.
1006 * @param[in] color Desired filling.
1007 * @return A single Color Picture.
1008 */
1009 Picture XRenderCreateSolidFill(Display *dpy, const XRenderColor *color);
1010
1011 /**
1012 * Create a Picture filled with a Linear Gradient.
1013 *
1014 * @param dpy Connection to the X server.
1015 * @param[in] gradient Gradient geometry.
1016 * @param[in] stops Stop sections.
1017 * @param[in] colors Stop colors.
1018 * @param[in] nstops Stops count.
1019 * @return A Picture filled with a Linear Gradient.
1020 */
1021 Picture XRenderCreateLinearGradient(Display *dpy,
1022 const XLinearGradient *gradient,
1023 const XFixed *stops,
1024 const XRenderColor *colors, int nstops);
1025
1026 /**
1027 * Create a Picture filled with a Radial Gradient.
1028 *
1029 * @param dpy Connection to the X server.
1030 * @param[in] gradient Gradient geometry.
1031 * @param[in] stops Stop sections.
1032 * @param[in] colors Stop colors.
1033 * @param[in] nstops Stops count.
1034 * @return A Picture filled with a Radial Gradient.
1035 */
1036 Picture XRenderCreateRadialGradient(Display *dpy,
1037 const XRadialGradient *gradient,
1038 const XFixed *stops,
1039 const XRenderColor *colors, int nstops);
1040
1041 /**
1042 * Create a Picture filled with a Conical Gradient.
1043 *
1044 * @param dpy Connection to the X server.
1045 * @param[in] gradient Gradient geometry.
1046 * @param[in] stops Stop sections.
1047 * @param[in] colors Stop colors.
1048 * @param[in] nstops Stops count.
1049 * @return A Picture filled with a Conical Gradient.
1050 */
1051 Picture XRenderCreateConicalGradient(Display *dpy,
1052 const XConicalGradient *gradient,
1053 const XFixed *stops,
1054 const XRenderColor *colors, int nstops);
1055
1056 _XFUNCPROTOEND
1057
1058 #endif /* _XRENDER_H_ */