1e5410a46Smrg                         The Xrender Library
2e5410a46Smrg			    Version 0.7
3e5410a46Smrg			      2002-11-6
4e5410a46Smrg			    Keith Packard
5e5410a46Smrg			  keithp@xfree86.org
6e5410a46Smrg
7e5410a46Smrg1. Introduction
8e5410a46Smrg
9e5410a46SmrgThe Xrender library is designed as a lightweight library interface to the
10e5410a46SmrgRender extension.  This document describes how the library maps to the
11e5410a46Smrgprotocol without duplicating the semantics described by that document.
12e5410a46Smrg
13e5410a46Smrg2. Data Types
14e5410a46Smrg
15e5410a46Smrg2.1 Primitive Types
16e5410a46Smrg
17e5410a46SmrgFor resources represented as CARD32 or XID on the wire, Xrender exposes them
18e5410a46Smrgusing an 'unsigned long' type as is the norm for 32-bit data objects in an
19e5410a46SmrgXlib compatible API.
20e5410a46Smrg
21e5410a46Smrg	typedef unsigned long	Glyph;
22e5410a46Smrg	typedef unsigned long	GlyphSet;
23e5410a46Smrg	typedef unsigned long	Picture;
24e5410a46Smrg	typedef unsigned long	PictFormat;
25e5410a46Smrg
26e5410a46SmrgGlyphs are just CARD32 objects, while GlyphSet, Picture and PictFormat
27e5410a46Smrgvalues are XIDs.
28e5410a46Smrg
29e5410a46Smrg	typedef int XFixed;
30e5410a46Smrg
31e5410a46SmrgFixed point numbers buck the Xlib convention by being represented as ints.
32e5410a46SmrgMachines for which 'int' is smaller than 32 bits cannot support the Xrender
33e5410a46Smrglibrary.
34e5410a46Smrg
35e5410a46Smrg2.2 PictFormat descriptions.
36e5410a46Smrg
37e5410a46SmrgThe definition of a PictFormat is exposed by two data structures:
38e5410a46Smrg
39e5410a46Smrg	typedef struct {
40e5410a46Smrg	    short   red;
41e5410a46Smrg	    short   redMask;
42e5410a46Smrg	    short   green;
43e5410a46Smrg	    short   greenMask;
44e5410a46Smrg	    short   blue;
45e5410a46Smrg	    short   blueMask;
46e5410a46Smrg	    short   alpha;
47e5410a46Smrg	    short   alphaMask;
48e5410a46Smrg	} XRenderDirectFormat;
49e5410a46Smrg
50e5410a46Smrg	typedef struct {
51e5410a46Smrg	    PictFormat		id;
52e5410a46Smrg	    int			type;
53e5410a46Smrg	    int			depth;
54e5410a46Smrg	    XRenderDirectFormat	direct;
55e5410a46Smrg	    Colormap		colormap;
56e5410a46Smrg	} XRenderPictFormat;
57e5410a46Smrg
58e5410a46SmrgThese serve both as a description of the available formats and as patterns
59e5410a46Smrgagainst which available formats are matched.
60e5410a46Smrg
61e5410a46Smrg2.3 Picture Attributes
62e5410a46Smrg
63e5410a46SmrgWhen creating or changing Picture objects, attributes are passed much as
64e5410a46Smrgthey are for XCreateWindow/XChangeWindowAttributes.  A structure capable of
65e5410a46Smrgholding all of the attributes has the relevant ones set and a bitmask passed
66e5410a46Smrgas a separate argument which marks the valid entries.
67e5410a46Smrg
68e5410a46Smrg	typedef struct _XRenderPictureAttributes {
69e5410a46Smrg	    Bool		repeat;
70e5410a46Smrg	    Picture		alpha_map;
71e5410a46Smrg	    int			alpha_x_origin;
72e5410a46Smrg	    int			alpha_y_origin;
73e5410a46Smrg	    int			clip_x_origin;
74e5410a46Smrg	    int			clip_y_origin;
75e5410a46Smrg	    Pixmap		clip_mask;
76e5410a46Smrg	    Bool		graphics_exposures;
77e5410a46Smrg	    int			subwindow_mode;
78e5410a46Smrg	    int			poly_edge;
79e5410a46Smrg	    int			poly_mode;
80e5410a46Smrg	    Atom		dither;
81e5410a46Smrg	    Bool		component_alpha;
82e5410a46Smrg	} XRenderPictureAttributes;
83e5410a46Smrg
84e5410a46Smrg2.4 Colors
85e5410a46Smrg
86e5410a46SmrgThe core protocol XColor type doesn't include an alpha component, so Xrender
872fd96bc7Smrghas a separate type. Note that XRender expects premultiplied alpha in all
882fd96bc7Smrgcases except with the gradient operations.
89e5410a46Smrg
90e5410a46Smrg	typedef struct {
91e5410a46Smrg	    unsigned short   red;
92e5410a46Smrg	    unsigned short   green;
93e5410a46Smrg	    unsigned short   blue;
94e5410a46Smrg	    unsigned short   alpha;
95e5410a46Smrg	} XRenderColor;
96e5410a46Smrg
97e5410a46Smrg2.5 Glyph Types
98e5410a46Smrg
99e5410a46SmrgGlyphs are stored in the server, so these definitions are passed from the
100e5410a46Smrgclient to the library and on to the server as glyphs are rasterized and
101e5410a46Smrgtransmitted over the wire.
102e5410a46Smrg
103e5410a46Smrg	typedef struct _XGlyphInfo {
104e5410a46Smrg	    unsigned short  width;
105e5410a46Smrg	    unsigned short  height;
106e5410a46Smrg	    short	    x;
107e5410a46Smrg	    short	    y;
108e5410a46Smrg	    short	    xOff;
109e5410a46Smrg	    short	    yOff;
110e5410a46Smrg	} XGlyphInfo;
111e5410a46Smrg
112e5410a46Smrg2.6 Glyph Rendering types
113e5410a46Smrg
114e5410a46SmrgGlyph rendering can either take a single string of glyph indices or an array
115e5410a46Smrgof one of the following structures.
116e5410a46Smrg
117e5410a46Smrg	typedef struct _XGlyphElt8 {
118e5410a46Smrg	    GlyphSet		    glyphset;
119e5410a46Smrg	    _Xconst char	    *chars;
120e5410a46Smrg	    int			    nchars;
121e5410a46Smrg	    int			    xOff;
122e5410a46Smrg	    int			    yOff;
123e5410a46Smrg	} XGlyphElt8;
124e5410a46Smrg
125e5410a46Smrg	typedef struct _XGlyphElt16 {
126e5410a46Smrg	    GlyphSet		    glyphset;
127e5410a46Smrg	    _Xconst unsigned short  *chars;
128e5410a46Smrg	    int			    nchars;
129e5410a46Smrg	    int			    xOff;
130e5410a46Smrg	    int			    yOff;
131e5410a46Smrg	} XGlyphElt16;
132e5410a46Smrg
133e5410a46Smrg	typedef struct _XGlyphElt32 {
134e5410a46Smrg	    GlyphSet		    glyphset;
135e5410a46Smrg	    _Xconst unsigned int    *chars;
136e5410a46Smrg	    int			    nchars;
137e5410a46Smrg	    int			    xOff;
138e5410a46Smrg	    int			    yOff;
139e5410a46Smrg	} XGlyphElt32;
140e5410a46Smrg
141e5410a46Smrg2.7 Geometric Types
142e5410a46Smrg
143e5410a46SmrgGeometric operations directly expose the available protocol datatypes
144e5410a46Smrg
145e5410a46Smrg	typedef struct _XPointFixed {
146e5410a46Smrg	    XFixed  x, y;
147e5410a46Smrg	} XPointFixed;
148e5410a46Smrg
149e5410a46Smrg	typedef struct _XLineFixed {
150e5410a46Smrg	    XPointFixed	p1, p2;
151e5410a46Smrg	} XLineFixed;
152e5410a46Smrg
153e5410a46Smrg	typedef struct _XTriangle {
154e5410a46Smrg	    XPointFixed	p1, p2, p3;
155e5410a46Smrg	} XTriangle;
156e5410a46Smrg
157e5410a46Smrg	typedef struct _XTrapezoid {
158e5410a46Smrg	    XFixed  top, bottom;
159e5410a46Smrg	    XLineFixed	left, right;
160e5410a46Smrg	} XTrapezoid;
161e5410a46Smrg
162e5410a46Smrg	typedef struct _XTransform {
163e5410a46Smrg	    XFixed  matrix[3][3];
164e5410a46Smrg	} XTransform;
165e5410a46Smrg
166e5410a46Smrg2.8 Transformation Filters
167e5410a46Smrg
168e5410a46SmrgAll of the filters are named simultaneously; Xrender provides no convenience
169e5410a46Smrgfunctions for dealing with them.
170e5410a46Smrg
171e5410a46Smrg	typedef struct _XFilters {
172e5410a46Smrg	    int	    nfilter;
173e5410a46Smrg	    char    **filter;
174e5410a46Smrg	    int	    nalias;
175e5410a46Smrg	    short   *alias;
176e5410a46Smrg	} XFilters;
177e5410a46Smrg
178e5410a46Smrg2.9 Index type PictFormat colors
179e5410a46Smrg
180e5410a46SmrgPictFormats of Index type advertise which colors will be used for drawing
181e5410a46Smrgthrough this type.
182e5410a46Smrg
183e5410a46Smrg	typedef struct _XIndexValue {
184e5410a46Smrg	    unsigned long    pixel;
185e5410a46Smrg	    unsigned short   red, green, blue, alpha;
186e5410a46Smrg	} XIndexValue;
187e5410a46Smrg
188e5410a46Smrg
189e5410a46Smrg3 Application Startup Functions
190e5410a46Smrg
191e5410a46Smrg3.1 Initialization functions
192e5410a46Smrg
193e5410a46Smrg	Bool XRenderQueryExtension (Display *dpy,
194e5410a46Smrg			            int     *event_basep,
195e5410a46Smrg				    int     *error_basep)
196e5410a46Smrg
197e5410a46SmrgThis function returns True if the Render extension is available on dpy.
198e5410a46Smrgevent_basep and error_basep will be filled in with the first event and error
199e5410a46Smrgnumbers used by the extension (note that Render currently uses no events).
200e5410a46Smrg
201e5410a46Smrg	Status XRenderQueryVersion (Display *dpy,
202e5410a46Smrg				    int     *major_versionp,
203e5410a46Smrg				    int     *minor_versionp)
204e5410a46Smrg
205e5410a46SmrgXRenderQueryVersion returns zero if the Render extension is not present or
206e5410a46Smrgsome error occurred while attempting to discover the current Render version
207e5410a46Smrgnumber.  Otherwise, XRenderQueryVersion returns 1 and stores the version
208e5410a46Smrgnumber returned by the server in *major_versionp and *minor_versionp, which
209e5410a46Smrgwill be less than or equal to the library version numbers RENDER_MAJOR and
210e5410a46SmrgRENDER_MINOR.
211e5410a46Smrg
212e5410a46Smrg	Status XRenderQueryFormats (Display *dpy)
213e5410a46Smrg
214e5410a46SmrgXRenderQueryFormats returns 1 if it successfully fetches the available
215e5410a46SmrgPictFormat information from the X server, 0 otherwise.  Applications needn't
216e5410a46Smrginvoke this function directly (hmm, perhaps it should be removed from the
217e5410a46Smrgexternal interfaces then).
218e5410a46Smrg
219e5410a46Smrg3.2 Subpixel Order
220e5410a46Smrg
221e5410a46Smrg	int XRenderQuerySubpixelOrder (Display *dpy, int screen)
222e5410a46Smrg
223e5410a46Smrg	Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel)
224e5410a46Smrg
225e5410a46SmrgApplications interested in the geometry of the elements making up a single
226e5410a46Smrgpixel on the screen should use XRenderQuerySubpixelOrder and not cache the
227e5410a46Smrgreturn value.  XRenderSetSubpixelOrder is used by the XRandR library to
228e5410a46Smrgupdate the value stored by Xrender when the subpixel order changes as a
229e5410a46Smrgresult of screen reconfiguration.
230e5410a46Smrg
231e5410a46Smrg3.3 PictFormat matching
232e5410a46Smrg
233e5410a46SmrgXrender provides these APIs to help locate appropriate PictFormats; they are
234e5410a46Smrgintended to work much like the Visual matching APIs in Xlib.  The
235e5410a46Smrgapplication provides a specification including the necessary PictFormat
236e5410a46Smrgcharacteristics and Xrender returns a matching XRenderPictFormat structure
237e5410a46Smrgwhich describes the PictFormat.
238e5410a46Smrg
239e5410a46Smrg	XRenderPictFormat *
240e5410a46Smrg	XRenderFindFormat (Display			*dpy,
241e5410a46Smrg			   unsigned long		mask,
242e5410a46Smrg			   _Xconst XRenderPictFormat	*templ,
243e5410a46Smrg			   int				count)
244e5410a46Smrg
245e5410a46Smrg	#define PictFormatID	    (1 << 0)
246e5410a46Smrg	#define PictFormatType	    (1 << 1)
247e5410a46Smrg	#define PictFormatDepth	    (1 << 2)
248e5410a46Smrg	#define PictFormatRed	    (1 << 3)
249e5410a46Smrg	#define PictFormatRedMask   (1 << 4)
250e5410a46Smrg	#define PictFormatGreen	    (1 << 5)
251e5410a46Smrg	#define PictFormatGreenMask (1 << 6)
252e5410a46Smrg	#define PictFormatBlue	    (1 << 7)
253e5410a46Smrg	#define PictFormatBlueMask  (1 << 8)
254e5410a46Smrg	#define PictFormatAlpha	    (1 << 9)
255e5410a46Smrg	#define PictFormatAlphaMask (1 << 10)
256e5410a46Smrg	#define PictFormatColormap  (1 << 11)
257e5410a46Smrg
258e5410a46SmrgXRenderFindFormat locates a PictFormat matching the characteristics provided
259e5410a46Smrgin the templ.  Only elements whose associated bit in mask are compared.
260e5410a46Smrg
261e5410a46Smrg	XRenderPictFormat *
262e5410a46Smrg	XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual)
263e5410a46Smrg
264e5410a46SmrgFinds the PictFormat suitable for use with the specified visual.
265e5410a46Smrg
266e5410a46Smrg	XRenderPictFormat *
267e5410a46Smrg	XRenderFindStandardFormat (Display		*dpy,
268e5410a46Smrg				   int			format)
269e5410a46Smrg
270e5410a46Smrg	#define PictStandardARGB32  0
271e5410a46Smrg	#define PictStandardRGB24   1
272e5410a46Smrg	#define PictStandardA8	    2
273e5410a46Smrg	#define PictStandardA4	    3
274e5410a46Smrg	#define PictStandardA1	    4
275e5410a46Smrg	#define PictStandardNUM	    5
276e5410a46Smrg
2776fae4e5dSmrgAs a convenience, this function locates PictFormats that correspond to
278e5410a46Smrgcommonly used formats.
279e5410a46Smrg
280e5410a46Smrg	ARGB32		depth 32, bits 31-24 A, 23-16 R, 15-8 G, 7-0 B
281e5410a46Smrg	RGB24		depth 24, bits 23-16 R, 15-8 G, 7-0 B
282e5410a46Smrg	A8		depth 8, bits 7-0 A
283e5410a46Smrg	A4		depth 4, bits 3-0 A
284e5410a46Smrg	A1		depth 1, bits 0 A
285e5410a46Smrg
2866fae4e5dSmrgAny server supporting Render must have a PictFormat corresponding to each of
287e5410a46Smrgthese standard formats.
288e5410a46Smrg
289e5410a46Smrg3.4 Index type PictFormat color values
290e5410a46Smrg
291e5410a46Smrg	XIndexValue *
292e5410a46Smrg	XRenderQueryPictIndexValues(Display			*dpy,
293e5410a46Smrg				    _Xconst XRenderPictFormat	*format,
294e5410a46Smrg				    int				*num)
295e5410a46Smrg
296e5410a46SmrgIf format refers to an Index type PictFormat, XRenderQueryPictIndexValues
297e5410a46Smrgreturns the set of pixel values and their associated colors used when
298e5410a46Smrgdrawing to Pictures created with that format.  Otherwise,
299e5410a46SmrgXRenderQueryPictIndexValues generates a BadMatch error.
300e5410a46Smrg
301e5410a46Smrg3.5 Querying available filters
302e5410a46Smrg
303e5410a46Smrg	XFilters *
304e5410a46Smrg	XRenderQueryFilters (Display *dpy, Drawable drawable);
305e5410a46Smrg
306e5410a46SmrgFilters are used with non-identity transformation matrices, this function
307e5410a46Smrgreturns a datastructure identifying the available filters on display that
308e5410a46Smrgcan be associated with pictures for the screen associated with drawable.
309e5410a46Smrg
310e5410a46SmrgFree this structure with XFree.
311e5410a46Smrg
312e5410a46Smrg4 Picture Functions
313e5410a46Smrg
314e5410a46Smrg	Picture
315e5410a46Smrg	XRenderCreatePicture (Display				*dpy,
316e5410a46Smrg			      Drawable				drawable,
317e5410a46Smrg			      _Xconst XRenderPictFormat		*format,
318e5410a46Smrg			      unsigned long			valuemask,
319e5410a46Smrg			      _Xconst XRenderPictureAttributes	*attributes)
320e5410a46Smrg
321e5410a46Smrg	#define CPRepeat			    (1 << 0)
322e5410a46Smrg	#define CPAlphaMap			    (1 << 1)
323e5410a46Smrg	#define CPAlphaXOrigin			    (1 << 2)
324e5410a46Smrg	#define CPAlphaYOrigin			    (1 << 3)
325e5410a46Smrg	#define CPClipXOrigin			    (1 << 4)
326e5410a46Smrg	#define CPClipYOrigin			    (1 << 5)
327e5410a46Smrg	#define CPClipMask			    (1 << 6)
328e5410a46Smrg	#define CPGraphicsExposure		    (1 << 7)
329e5410a46Smrg	#define CPSubwindowMode			    (1 << 8)
330e5410a46Smrg	#define CPPolyEdge			    (1 << 9)
331e5410a46Smrg	#define CPPolyMode			    (1 << 10)
332e5410a46Smrg	#define CPDither			    (1 << 11)
333e5410a46Smrg	#define CPComponentAlpha		    (1 << 12)
3346fae4e5dSmrg	#define CPLastBit			    12
335e5410a46Smrg
336e5410a46SmrgCreates a picture for drawable in the specified format.  Any values
337e5410a46Smrgspecified in 'attributes' and 'valuemask' are used in place of the default
338e5410a46Smrgvalues.
339e5410a46Smrg
340e5410a46Smrg	void
341e5410a46Smrg	XRenderChangePicture (Display				*dpy,
342e5410a46Smrg			      Picture				picture,
343e5410a46Smrg			      unsigned long			valuemask,
344e5410a46Smrg			      _Xconst XRenderPictureAttributes  *attributes)
345e5410a46Smrg
346e5410a46SmrgChange values in picture to those specified by valuemask and attributes.
347e5410a46Smrg
348e5410a46Smrg
349e5410a46Smrg	void
350e5410a46Smrg	XRenderSetPictureClipRectangles (Display	    *dpy,
351e5410a46Smrg					 Picture	    picture,
352e5410a46Smrg					 int		    xOrigin,
353e5410a46Smrg					 int		    yOrigin,
354e5410a46Smrg					 _Xconst XRectangle *rects,
355e5410a46Smrg					 int		    n)
356e5410a46Smrg
357e5410a46SmrgSets the clip mask in picture to the union of rects offset by
358e5410a46SmrgxOrigin/yOrigin.
359e5410a46Smrg
360e5410a46Smrg	void
361e5410a46Smrg	XRenderSetPictureClipRegion (Display	    *dpy,
362e5410a46Smrg				     Picture	    picture,
363e5410a46Smrg				     Region	    r)
364e5410a46Smrg
365e5410a46SmrgSets the clip mask in picture to r.
366e5410a46Smrg
367e5410a46Smrg	void
368e5410a46Smrg	XRenderSetPictureTransform (Display	    *dpy,
369e5410a46Smrg				    Picture	    picture,
370e5410a46Smrg				    XTransform	    *transform)
371e5410a46Smrg
372e5410a46SmrgSets the projective transformation matrix of picture to transform.
373e5410a46Smrg
374e5410a46Smrg	void
375e5410a46Smrg	XRenderFreePicture (Display                   *dpy,
376e5410a46Smrg			    Picture                   picture)
377e5410a46Smrg
378e5410a46SmrgInstructs the server to free picture.
379e5410a46Smrg
380e5410a46Smrg5 GlyphSet functions
381e5410a46Smrg
382e5410a46Smrg	GlyphSet
383e5410a46Smrg	XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format)
384e5410a46Smrg
385e5410a46SmrgCreates a glyphset, every glyph in the set will use PictFormat format.
386e5410a46Smrg
387e5410a46Smrg	GlyphSet
388e5410a46Smrg	XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing)
389e5410a46Smrg
390e5410a46SmrgCreates a new GlyphSet ID which references an existing GlyphSet.  The
391e5410a46Smrgtwo IDs refer to the same object so that changes using one ID will be
392e5410a46Smrgvisible through the other ID.  This is designed to allow multiple clients to
393e5410a46Smrgshare the same GlyphSet so that it doesn't get destroyed when the first
394e5410a46Smrgclient exits.
395e5410a46Smrg
396e5410a46Smrg	void
397e5410a46Smrg	XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset)
398e5410a46Smrg
399e5410a46SmrgFrees the glyphset ID.  If no other GlyphSet IDs refer to the underlying
400e5410a46SmrgGlyphSet, it will be destroyed.
401e5410a46Smrg
402e5410a46Smrg	void
403e5410a46Smrg	XRenderAddGlyphs (Display		*dpy,
404e5410a46Smrg			  GlyphSet		glyphset,
405e5410a46Smrg			  _Xconst Glyph		*gids,
406e5410a46Smrg			  _Xconst XGlyphInfo	*glyphs,
407e5410a46Smrg			  int			nglyphs,
408e5410a46Smrg			  _Xconst char		*images,
409e5410a46Smrg			  int			nbyte_images)
410e5410a46Smrg
411e5410a46SmrgAdd glyphs to glyphset.  The images are packed together in Z-pixmap format
412e5410a46Smrgaccording to the depth of the PictFormat used in creating glyphset.
413e5410a46Smrg
414e5410a46Smrg	void
415e5410a46Smrg	XRenderFreeGlyphs (Display	    *dpy,
416e5410a46Smrg			   GlyphSet	    glyphset,
417e5410a46Smrg			   _Xconst Glyph    *gids,
418e5410a46Smrg			   int		    nglyphs)
419e5410a46Smrg
420e5410a46SmrgFree some glyphs from glyphset.
421e5410a46Smrg
422e5410a46Smrg6 Glyph Drawing Routines
423e5410a46Smrg
424e5410a46SmrgXrender provides two parallel APIs for glyph rendering, a simple API which
425e5410a46Smrgaccepts a single string similar to XDrawString and a more complex API which
426e5410a46Smrgaccepts an array of XGlyphElt{8,16,32} structures, each of which includes a
427e5410a46Smrgglyphset, string and x/y offsets which parallel the XDrawText API.  Xrender
428e5410a46Smrgalso provides glyphs in three sizes, 8 16 and 32 bits.  The simple API is
429e5410a46Smrgjust a convenience for the user as both forms generate the same underlying
430e5410a46SmrgRender protocol.
431e5410a46Smrg
432e5410a46Smrg6.1 Simple single-string glyph drawing functions
433e5410a46Smrg
434e5410a46SmrgThese are identical except for the format of the glyph ids.
435e5410a46Smrg
436e5410a46Smrg	void
437e5410a46Smrg	XRenderCompositeString8 (Display		    *dpy,
438e5410a46Smrg				 int			    op,
439e5410a46Smrg				 Picture		    src,
440e5410a46Smrg				 Picture		    dst,
441e5410a46Smrg				 _Xconst XRenderPictFormat  *maskFormat,
442e5410a46Smrg				 GlyphSet		    glyphset,
443e5410a46Smrg				 int			    xSrc,
444e5410a46Smrg				 int			    ySrc,
445e5410a46Smrg				 int			    xDst,
446e5410a46Smrg				 int			    yDst,
447e5410a46Smrg				 _Xconst char		    *string,
448e5410a46Smrg				 int			    nchar)
449e5410a46Smrg
450e5410a46Smrg	void
451e5410a46Smrg	XRenderCompositeString16 (Display		    *dpy,
452e5410a46Smrg				  int			    op,
453e5410a46Smrg				  Picture		    src,
454e5410a46Smrg				  Picture		    dst,
455e5410a46Smrg				  _Xconst XRenderPictFormat *maskFormat,
456e5410a46Smrg				  GlyphSet		    glyphset,
457e5410a46Smrg				  int			    xSrc,
458e5410a46Smrg				  int			    ySrc,
459e5410a46Smrg				  int			    xDst,
460e5410a46Smrg				  int			    yDst,
461e5410a46Smrg				  _Xconst unsigned short    *string,
462e5410a46Smrg				  int			    nchar)
463e5410a46Smrg
464e5410a46Smrg	void
465e5410a46Smrg	XRenderCompositeString32 (Display		    *dpy,
466e5410a46Smrg				  int			    op,
467e5410a46Smrg				  Picture		    src,
468e5410a46Smrg				  Picture		    dst,
469e5410a46Smrg				  _Xconst XRenderPictFormat *maskFormat,
470e5410a46Smrg				  GlyphSet		    glyphset,
471e5410a46Smrg				  int			    xSrc,
472e5410a46Smrg				  int			    ySrc,
473e5410a46Smrg				  int			    xDst,
474e5410a46Smrg				  int			    yDst,
475e5410a46Smrg				  _Xconst unsigned int	    *string,
476e5410a46Smrg				  int			    nchar)
477e5410a46Smrg
478e5410a46Smrg6.2 Complete glyph drawing functions
479e5410a46Smrg
480e5410a46SmrgAs with the simple functions above, these differ only in the type of the
481e5410a46Smrgunderlying glyph id storage type.
482e5410a46Smrg
483e5410a46Smrg	void
484e5410a46Smrg	XRenderCompositeText8 (Display			    *dpy,
485e5410a46Smrg			       int			    op,
486e5410a46Smrg			       Picture			    src,
487e5410a46Smrg			       Picture			    dst,
488e5410a46Smrg			       _Xconst XRenderPictFormat    *maskFormat,
489e5410a46Smrg			       int			    xSrc,
490e5410a46Smrg			       int			    ySrc,
491e5410a46Smrg			       int			    xDst,
492e5410a46Smrg			       int			    yDst,
493e5410a46Smrg			       _Xconst XGlyphElt8	    *elts,
494e5410a46Smrg			       int			    nelt)
495e5410a46Smrg
496e5410a46Smrg	void
497e5410a46Smrg	XRenderCompositeText16 (Display			    *dpy,
498e5410a46Smrg				int			    op,
499e5410a46Smrg				Picture			    src,
500e5410a46Smrg				Picture			    dst,
501e5410a46Smrg				_Xconst XRenderPictFormat   *maskFormat,
502e5410a46Smrg				int			    xSrc,
503e5410a46Smrg				int			    ySrc,
504e5410a46Smrg				int			    xDst,
505e5410a46Smrg				int			    yDst,
506e5410a46Smrg				_Xconst XGlyphElt16	    *elts,
507e5410a46Smrg				int			    nelt)
508e5410a46Smrg
509e5410a46Smrg	void
510e5410a46Smrg	XRenderCompositeText32 (Display			    *dpy,
511e5410a46Smrg				int			    op,
512e5410a46Smrg				Picture			    src,
513e5410a46Smrg				Picture			    dst,
514e5410a46Smrg				_Xconst XRenderPictFormat   *maskFormat,
515e5410a46Smrg				int			    xSrc,
516e5410a46Smrg				int			    ySrc,
517e5410a46Smrg				int			    xDst,
518e5410a46Smrg				int			    yDst,
519e5410a46Smrg				_Xconst XGlyphElt32	    *elts,
520e5410a46Smrg				int			    nelt)
521e5410a46Smrg
522e5410a46Smrg7 Basic Graphics Functions
523e5410a46Smrg
524e5410a46SmrgThese are the simplest graphics functions upon which the other functions are
525e5410a46Smrgconceptually built.
526e5410a46Smrg
527e5410a46Smrg7.1 Composite
528e5410a46Smrg
529e5410a46SmrgXRenderComposite exposes the RenderComposite protocol request directly.
5302fd96bc7SmrgIf a format with alpha is used, make sure it is premultiplied into the
5312fd96bc7Smrgcolor channels.
532e5410a46Smrg
533e5410a46Smrg	void
534e5410a46Smrg	XRenderComposite (Display   *dpy,
535e5410a46Smrg			  int	    op,
536e5410a46Smrg			  Picture   src,
537e5410a46Smrg			  Picture   mask,
538e5410a46Smrg			  Picture   dst,
539e5410a46Smrg			  int	    src_x,
540e5410a46Smrg			  int	    src_y,
541e5410a46Smrg			  int	    mask_x,
542e5410a46Smrg			  int	    mask_y,
543e5410a46Smrg			  int	    dst_x,
544e5410a46Smrg			  int	    dst_y,
545e5410a46Smrg			  unsigned int	width,
546e5410a46Smrg			  unsigned int	height)
547e5410a46Smrg
548e5410a46Smrg
549e5410a46Smrg7.2 Rectangles
550e5410a46Smrg
551e5410a46SmrgThese functions composite rectangles of the specified color, they differ
552e5410a46Smrgonly in that XRenderFillRectangles draws more than one at a time.
553e5410a46Smrg
554e5410a46Smrg	void
555e5410a46Smrg	XRenderFillRectangle (Display		    *dpy,
556e5410a46Smrg			      int		    op,
557e5410a46Smrg			      Picture		    dst,
558e5410a46Smrg			      _Xconst XRenderColor  *color,
559e5410a46Smrg			      int		    x,
560e5410a46Smrg			      int		    y,
561e5410a46Smrg			      unsigned int	    width,
562e5410a46Smrg			      unsigned int	    height)
563e5410a46Smrg
564e5410a46Smrg	void
565e5410a46Smrg	XRenderFillRectangles (Display		    *dpy,
566e5410a46Smrg			       int		    op,
567e5410a46Smrg			       Picture		    dst,
568e5410a46Smrg			       _Xconst XRenderColor *color,
569e5410a46Smrg			       _Xconst XRectangle   *rectangles,
570e5410a46Smrg			       int		    n_rects)
571e5410a46Smrg
572e5410a46Smrg8 Geometric Objects
573e5410a46Smrg
574e5410a46SmrgAll geometric drawing with Render is performed with sequences of trapezoids
575e5410a46Smrgor triangles; the client is responsible for breaking more complex figures
576e5410a46Smrginto these simple shapes.
577e5410a46Smrg
578e5410a46Smrg8.1 Trapezoids
579e5410a46Smrg
580e5410a46Smrg	void
581e5410a46Smrg	XRenderCompositeTrapezoids (Display		*dpy,
582e5410a46Smrg				    int			op,
583e5410a46Smrg				    Picture		src,
584e5410a46Smrg				    Picture		dst,
585e5410a46Smrg				    _Xconst XRenderPictFormat	*maskFormat,
586e5410a46Smrg				    int			xSrc,
587e5410a46Smrg				    int			ySrc,
588e5410a46Smrg				    _Xconst XTrapezoid	*traps,
589e5410a46Smrg				    int			ntrap)
590e5410a46Smrg
591e5410a46SmrgXRenderCompositeTrapezoids builds RenderTrapezoids requests to composite the
592e5410a46Smrgspecified list of trapezoids to dst.  XRenderCompositeTrapezoids will split
593e5410a46Smrgthe list of trapezoids to build requests no larger than the maximum request
594e5410a46Smrgsize supported by the server.  This can create rendering artifacts as the
595e5410a46Smrgprecompositing done by RenderTrapezoids when a maskFormat is specified
596e5410a46Smrgcannot span multiple requests.
597e5410a46Smrg
598e5410a46Smrg8.2 Triangles
599e5410a46Smrg
600e5410a46SmrgRender provides three different ways of encoding triangles on the wire,
601e5410a46SmrgXrender exposes those with three separate triangle drawing routines.  As
602e5410a46Smrgwith trapezoids above, Xrender will split the arguments to fit requests into
603e5410a46Smrgthe servers limits, but this may cause rendering artifacts.
604