vx11 / render / raw.c.v
741 lines · 623 sloc · 24.43 KB · 6de7c1113616d30335010eea79fd03d19722b474
Raw
1// Public API from X11/extensions/Xrender.h and render.h. The C headers own the ABI.
2// Raw calls retain Xlib ownership rules and asynchronous error semantics.
3module render
4
5import vx11
6
7#flag -lXrender
8#include <X11/extensions/Xrender.h>
9
10// render.h
11
12pub const name = 'RENDER'
13pub const major_version = 0
14pub const minor_version = 11
15
16// Minor request opcodes, for decoding XErrorEvent.minor_code.
17pub const x_query_version = 0
18pub const x_query_pict_formats = 1
19pub const x_query_pict_index_values = 2
20pub const x_query_dithers = 3
21pub const x_create_picture = 4
22pub const x_change_picture = 5
23pub const x_set_picture_clip_rectangles = 6
24pub const x_free_picture = 7
25pub const x_composite = 8
26pub const x_scale = 9
27pub const x_trapezoids = 10
28pub const x_triangles = 11
29pub const x_tri_strip = 12
30pub const x_tri_fan = 13
31pub const x_color_trapezoids = 14
32pub const x_color_triangles = 15
33pub const x_create_glyph_set = 17
34pub const x_reference_glyph_set = 18
35pub const x_free_glyph_set = 19
36pub const x_add_glyphs = 20
37pub const x_add_glyphs_from_picture = 21
38pub const x_free_glyphs = 22
39pub const x_composite_glyphs8 = 23
40pub const x_composite_glyphs16 = 24
41pub const x_composite_glyphs32 = 25
42pub const x_fill_rectangles = 26
43pub const x_create_cursor = 27
44pub const x_set_picture_transform = 28
45pub const x_query_filters = 29
46pub const x_set_picture_filter = 30
47pub const x_create_anim_cursor = 31
48pub const x_add_traps = 32
49pub const x_create_solid_fill = 33
50pub const x_create_linear_gradient = 34
51pub const x_create_radial_gradient = 35
52pub const x_create_conical_gradient = 36
53pub const number_requests = 37
54
55// Error codes are offsets from the server-assigned error base.
56pub const bad_pict_format = 0
57pub const bad_picture = 1
58pub const bad_pict_op = 2
59pub const bad_glyph_set = 3
60pub const bad_glyph = 4
61pub const number_errors = 5
62
63pub const pict_type_indexed = 0
64pub const pict_type_direct = 1
65
66// Porter-Duff operators.
67pub const op_minimum = 0
68pub const op_clear = 0
69pub const op_src = 1
70pub const op_dst = 2
71pub const op_over = 3
72pub const op_over_reverse = 4
73pub const op_in = 5
74pub const op_in_reverse = 6
75pub const op_out = 7
76pub const op_out_reverse = 8
77pub const op_atop = 9
78pub const op_atop_reverse = 10
79pub const op_xor = 11
80pub const op_add = 12
81pub const op_saturate = 13
82pub const op_maximum = 13
83
84// Disjoint and conjoint operators (Render 0.2).
85pub const op_disjoint_minimum = 0x10
86pub const op_disjoint_clear = 0x10
87pub const op_disjoint_src = 0x11
88pub const op_disjoint_dst = 0x12
89pub const op_disjoint_over = 0x13
90pub const op_disjoint_over_reverse = 0x14
91pub const op_disjoint_in = 0x15
92pub const op_disjoint_in_reverse = 0x16
93pub const op_disjoint_out = 0x17
94pub const op_disjoint_out_reverse = 0x18
95pub const op_disjoint_atop = 0x19
96pub const op_disjoint_atop_reverse = 0x1a
97pub const op_disjoint_xor = 0x1b
98pub const op_disjoint_maximum = 0x1b
99
100pub const op_conjoint_minimum = 0x20
101pub const op_conjoint_clear = 0x20
102pub const op_conjoint_src = 0x21
103pub const op_conjoint_dst = 0x22
104pub const op_conjoint_over = 0x23
105pub const op_conjoint_over_reverse = 0x24
106pub const op_conjoint_in = 0x25
107pub const op_conjoint_in_reverse = 0x26
108pub const op_conjoint_out = 0x27
109pub const op_conjoint_out_reverse = 0x28
110pub const op_conjoint_atop = 0x29
111pub const op_conjoint_atop_reverse = 0x2a
112pub const op_conjoint_xor = 0x2b
113pub const op_conjoint_maximum = 0x2b
114
115// PDF blend modes (Render 0.11).
116pub const op_blend_minimum = 0x30
117pub const op_multiply = 0x30
118pub const op_screen = 0x31
119pub const op_overlay = 0x32
120pub const op_darken = 0x33
121pub const op_lighten = 0x34
122pub const op_color_dodge = 0x35
123pub const op_color_burn = 0x36
124pub const op_hard_light = 0x37
125pub const op_soft_light = 0x38
126pub const op_difference = 0x39
127pub const op_exclusion = 0x3a
128pub const op_hsl_hue = 0x3b
129pub const op_hsl_saturation = 0x3c
130pub const op_hsl_color = 0x3d
131pub const op_hsl_luminosity = 0x3e
132pub const op_blend_maximum = 0x3e
133
134pub const poly_edge_sharp = 0
135pub const poly_edge_smooth = 1
136pub const poly_mode_precise = 0
137pub const poly_mode_imprecise = 1
138
139// Picture attribute mask bits for create_picture and change_picture.
140pub const cp_repeat = vx11.CULong(1 << 0)
141pub const cp_alpha_map = vx11.CULong(1 << 1)
142pub const cp_alpha_x_origin = vx11.CULong(1 << 2)
143pub const cp_alpha_y_origin = vx11.CULong(1 << 3)
144pub const cp_clip_x_origin = vx11.CULong(1 << 4)
145pub const cp_clip_y_origin = vx11.CULong(1 << 5)
146pub const cp_clip_mask = vx11.CULong(1 << 6)
147pub const cp_graphics_exposure = vx11.CULong(1 << 7)
148pub const cp_subwindow_mode = vx11.CULong(1 << 8)
149pub const cp_poly_edge = vx11.CULong(1 << 9)
150pub const cp_poly_mode = vx11.CULong(1 << 10)
151pub const cp_dither = vx11.CULong(1 << 11)
152pub const cp_component_alpha = vx11.CULong(1 << 12)
153pub const cp_last_bit = 12
154
155pub const filter_nearest = 'nearest'
156pub const filter_bilinear = 'bilinear'
157pub const filter_convolution = 'convolution'
158pub const filter_fast = 'fast'
159pub const filter_good = 'good'
160pub const filter_best = 'best'
161pub const filter_alias_none = -1
162
163pub const subpixel_unknown = 0
164pub const subpixel_horizontal_rgb = 1
165pub const subpixel_horizontal_bgr = 2
166pub const subpixel_vertical_rgb = 3
167pub const subpixel_vertical_bgr = 4
168pub const subpixel_none = 5
169
170// Repeat modes; pad and reflect require Render 0.10.
171pub const repeat_none = 0
172pub const repeat_normal = 1
173pub const repeat_pad = 2
174pub const repeat_reflect = 3
175
176pub type Glyph = vx11.XID
177pub type GlyphSet = vx11.XID
178pub type Picture = vx11.XID
179pub type PictFormat = vx11.XID
180
181// Xrender.h
182
183// Format mask bits for find_format: which template fields must match.
184pub const format_id = vx11.CULong(1 << 0)
185pub const format_type = vx11.CULong(1 << 1)
186pub const format_depth = vx11.CULong(1 << 2)
187pub const format_red = vx11.CULong(1 << 3)
188pub const format_red_mask = vx11.CULong(1 << 4)
189pub const format_green = vx11.CULong(1 << 5)
190pub const format_green_mask = vx11.CULong(1 << 6)
191pub const format_blue = vx11.CULong(1 << 7)
192pub const format_blue_mask = vx11.CULong(1 << 8)
193pub const format_alpha = vx11.CULong(1 << 9)
194pub const format_alpha_mask = vx11.CULong(1 << 10)
195pub const format_colormap = vx11.CULong(1 << 11)
196
197pub const standard_argb32 = 0
198pub const standard_rgb24 = 1
199pub const standard_a8 = 2
200pub const standard_a4 = 3
201pub const standard_a1 = 4
202pub const standard_num = 5
203
204// Fixed is XFixed, a signed 16.16 fixed-point value; Double is XDouble.
205pub type Fixed = i32
206pub type Double = f64
207
208@[typedef]
209pub struct C.XRenderDirectFormat {
210pub mut:
211 red i16
212 redMask i16
213 green i16
214 greenMask i16
215 blue i16
216 blueMask i16
217 alpha i16
218 alphaMask i16
219}
220
221pub type DirectFormat = C.XRenderDirectFormat
222
223// Format is XRenderPictFormat. Pointers returned by the find functions are
224// borrowed from libXrender's per-display cache; never free them.
225@[typedef]
226pub struct C.XRenderPictFormat {
227pub mut:
228 id PictFormat
229 @type i32
230 depth i32
231 direct DirectFormat
232 colormap vx11.Colormap
233}
234
235pub type Format = C.XRenderPictFormat
236
237@[typedef]
238pub struct C.XRenderPictureAttributes {
239pub mut:
240 repeat i32
241 alpha_map Picture
242 alpha_x_origin i32
243 alpha_y_origin i32
244 clip_x_origin i32
245 clip_y_origin i32
246 clip_mask vx11.Pixmap
247 graphics_exposures i32
248 subwindow_mode i32
249 poly_edge i32
250 poly_mode i32
251 dither vx11.Atom
252 component_alpha i32
253}
254
255pub type PictureAttributes = C.XRenderPictureAttributes
256
257// Color is XRenderColor. Fill and solid-fill colors are premultiplied by
258// alpha; gradient stop colors are not.
259@[typedef]
260pub struct C.XRenderColor {
261pub mut:
262 red u16
263 green u16
264 blue u16
265 alpha u16
266}
267
268pub type Color = C.XRenderColor
269
270@[typedef]
271pub struct C.XGlyphInfo {
272pub mut:
273 width u16
274 height u16
275 x i16
276 y i16
277 xOff i16
278 yOff i16
279}
280
281pub type GlyphInfo = C.XGlyphInfo
282
283@[typedef]
284pub struct C.XGlyphElt8 {
285pub mut:
286 glyphset GlyphSet
287 chars &char
288 nchars i32
289 xOff i32
290 yOff i32
291}
292
293pub type GlyphElt8 = C.XGlyphElt8
294
295@[typedef]
296pub struct C.XGlyphElt16 {
297pub mut:
298 glyphset GlyphSet
299 chars &u16
300 nchars i32
301 xOff i32
302 yOff i32
303}
304
305pub type GlyphElt16 = C.XGlyphElt16
306
307@[typedef]
308pub struct C.XGlyphElt32 {
309pub mut:
310 glyphset GlyphSet
311 chars &u32
312 nchars i32
313 xOff i32
314 yOff i32
315}
316
317pub type GlyphElt32 = C.XGlyphElt32
318
319@[typedef]
320pub struct C.XPointDouble {
321pub mut:
322 x Double
323 y Double
324}
325
326pub type PointDouble = C.XPointDouble
327
328@[typedef]
329pub struct C.XPointFixed {
330pub mut:
331 x Fixed
332 y Fixed
333}
334
335pub type PointFixed = C.XPointFixed
336
337@[typedef]
338pub struct C.XLineFixed {
339pub mut:
340 p1 PointFixed
341 p2 PointFixed
342}
343
344pub type LineFixed = C.XLineFixed
345
346@[typedef]
347pub struct C.XTriangle {
348pub mut:
349 p1 PointFixed
350 p2 PointFixed
351 p3 PointFixed
352}
353
354pub type Triangle = C.XTriangle
355
356@[typedef]
357pub struct C.XCircle {
358pub mut:
359 x Fixed
360 y Fixed
361 radius Fixed
362}
363
364pub type Circle = C.XCircle
365
366@[typedef]
367pub struct C.XTrapezoid {
368pub mut:
369 top Fixed
370 bottom Fixed
371 left LineFixed
372 right LineFixed
373}
374
375pub type Trapezoid = C.XTrapezoid
376
377@[typedef]
378pub struct C.XTransform {
379pub mut:
380 matrix [3][3]Fixed
381}
382
383pub type Transform = C.XTransform
384
385// Filters is one allocation: release the whole result with vx11.free.
386@[typedef]
387pub struct C.XFilters {
388pub mut:
389 nfilter i32
390 filter &&char
391 nalias i32
392 alias &i16
393}
394
395pub type Filters = C.XFilters
396
397@[typedef]
398pub struct C.XIndexValue {
399pub mut:
400 pixel vx11.CULong
401 red u16
402 green u16
403 blue u16
404 alpha u16
405}
406
407pub type IndexValue = C.XIndexValue
408
409@[typedef]
410pub struct C.XAnimCursor {
411pub mut:
412 cursor vx11.Cursor
413 delay vx11.CULong
414}
415
416pub type AnimCursor = C.XAnimCursor
417
418@[typedef]
419pub struct C.XSpanFix {
420pub mut:
421 left Fixed
422 right Fixed
423 y Fixed
424}
425
426pub type SpanFix = C.XSpanFix
427
428@[typedef]
429pub struct C.XTrap {
430pub mut:
431 top SpanFix
432 bottom SpanFix
433}
434
435pub type Trap = C.XTrap
436
437@[typedef]
438pub struct C.XLinearGradient {
439pub mut:
440 p1 PointFixed
441 p2 PointFixed
442}
443
444pub type LinearGradient = C.XLinearGradient
445
446@[typedef]
447pub struct C.XRadialGradient {
448pub mut:
449 inner Circle
450 outer Circle
451}
452
453pub type RadialGradient = C.XRadialGradient
454
455// angle is in degrees.
456@[typedef]
457pub struct C.XConicalGradient {
458pub mut:
459 center PointFixed
460 angle Fixed
461}
462
463pub type ConicalGradient = C.XConicalGradient
464
465// fixed converts a float to XRender 16.16 notation, like XDoubleToFixed. The
466// value must lie within Fixed's range.
467pub fn fixed(value f64) Fixed { return Fixed(value * 65536.0) }
468
469// fixed_to_double converts 16.16 notation back to a float, like XFixedToDouble.
470pub fn fixed_to_double(value Fixed) f64 { return f64(value) / 65536.0 }
471
472fn C.XRenderQueryExtension(&vx11.Display, &i32, &i32) i32
473fn C.XRenderQueryVersion(&vx11.Display, &i32, &i32) i32
474fn C.XRenderQueryFormats(&vx11.Display) i32
475fn C.XRenderQuerySubpixelOrder(&vx11.Display, i32) i32
476fn C.XRenderSetSubpixelOrder(&vx11.Display, i32, i32) i32
477fn C.XRenderFindVisualFormat(&vx11.Display, &vx11.Visual) &Format
478fn C.XRenderFindFormat(&vx11.Display, vx11.CULong, &Format, i32) &Format
479fn C.XRenderFindStandardFormat(&vx11.Display, i32) &Format
480fn C.XRenderQueryPictIndexValues(&vx11.Display, &Format, &i32) &IndexValue
481fn C.XRenderCreatePicture(&vx11.Display, vx11.Drawable, &Format, vx11.CULong, &PictureAttributes) Picture
482fn C.XRenderFreePicture(&vx11.Display, Picture)
483fn C.XRenderChangePicture(&vx11.Display, Picture, vx11.CULong, &PictureAttributes)
484fn C.XRenderSetPictureClipRectangles(&vx11.Display, Picture, i32, i32, &vx11.XRectangle, i32)
485fn C.XRenderSetPictureClipRegion(&vx11.Display, Picture, vx11.Region)
486fn C.XRenderSetPictureTransform(&vx11.Display, Picture, &Transform)
487fn C.XRenderComposite(&vx11.Display, i32, Picture, Picture, Picture, i32, i32, i32, i32, i32, i32, u32, u32)
488fn C.XRenderCreateGlyphSet(&vx11.Display, &Format) GlyphSet
489fn C.XRenderReferenceGlyphSet(&vx11.Display, GlyphSet) GlyphSet
490fn C.XRenderFreeGlyphSet(&vx11.Display, GlyphSet)
491fn C.XRenderAddGlyphs(&vx11.Display, GlyphSet, &Glyph, &GlyphInfo, i32, &char, i32)
492fn C.XRenderFreeGlyphs(&vx11.Display, GlyphSet, &Glyph, i32)
493fn C.XRenderCompositeString8(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &char, i32)
494fn C.XRenderCompositeString16(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &u16, i32)
495fn C.XRenderCompositeString32(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &u32, i32)
496fn C.XRenderCompositeText8(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt8, i32)
497fn C.XRenderCompositeText16(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt16, i32)
498fn C.XRenderCompositeText32(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt32, i32)
499fn C.XRenderFillRectangle(&vx11.Display, i32, Picture, &Color, i32, i32, u32, u32)
500fn C.XRenderFillRectangles(&vx11.Display, i32, Picture, &Color, &vx11.XRectangle, i32)
501fn C.XRenderCompositeTrapezoids(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &Trapezoid, i32)
502fn C.XRenderCompositeTriangles(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &Triangle, i32)
503fn C.XRenderCompositeTriStrip(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &PointFixed, i32)
504fn C.XRenderCompositeTriFan(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &PointFixed, i32)
505fn C.XRenderCompositeDoublePoly(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &PointDouble, i32, i32)
506fn C.XRenderParseColor(&vx11.Display, &char, &Color) i32
507fn C.XRenderCreateCursor(&vx11.Display, Picture, u32, u32) vx11.Cursor
508fn C.XRenderQueryFilters(&vx11.Display, vx11.Drawable) &Filters
509fn C.XRenderSetPictureFilter(&vx11.Display, Picture, &char, &Fixed, i32)
510fn C.XRenderCreateAnimCursor(&vx11.Display, i32, &AnimCursor) vx11.Cursor
511fn C.XRenderAddTraps(&vx11.Display, Picture, i32, i32, &Trap, i32)
512fn C.XRenderCreateSolidFill(&vx11.Display, &Color) Picture
513fn C.XRenderCreateLinearGradient(&vx11.Display, &LinearGradient, &Fixed, &Color, i32) Picture
514fn C.XRenderCreateRadialGradient(&vx11.Display, &RadialGradient, &Fixed, &Color, i32) Picture
515fn C.XRenderCreateConicalGradient(&vx11.Display, &ConicalGradient, &Fixed, &Color, i32) Picture
516
517// Extension and formats
518
519pub fn query_extension(d &vx11.Display, event_base &i32, error_base &i32) i32 {
520 return C.XRenderQueryExtension(d, event_base, error_base)
521}
522
523pub fn query_version(d &vx11.Display, major &i32, minor &i32) i32 {
524 return C.XRenderQueryVersion(d, major, minor)
525}
526
527// Loads libXrender's format cache. Returns nonzero on success.
528pub fn query_formats(d &vx11.Display) i32 {
529 return C.XRenderQueryFormats(d)
530}
531
532// Returns a subpixel_* value, or subpixel_unknown when the server does not say.
533pub fn query_subpixel_order(d &vx11.Display, screen i32) i32 {
534 return C.XRenderQuerySubpixelOrder(d, screen)
535}
536
537// Changes only libXrender's client-side cache, not the server.
538pub fn set_subpixel_order(d &vx11.Display, screen i32, subpixel i32) i32 {
539 return C.XRenderSetSubpixelOrder(d, screen, subpixel)
540}
541
542// The result is borrowed from libXrender's cache; NULL when no format matches.
543pub fn find_visual_format(d &vx11.Display, visual &vx11.Visual) &Format {
544 return C.XRenderFindVisualFormat(d, visual)
545}
546
547// Returns the count-th cached format whose mask-selected fields equal template.
548// The result is borrowed; NULL when there are no more matches.
549pub fn find_format(d &vx11.Display, mask vx11.CULong, template &Format, count i32) &Format {
550 return C.XRenderFindFormat(d, mask, template, count)
551}
552
553// format is a standard_* value. The result is borrowed; NULL when unsupported.
554pub fn find_standard_format(d &vx11.Display, format i32) &Format {
555 return C.XRenderFindStandardFormat(d, format)
556}
557
558// Requires Render 0.7 and an indexed format. Release the result with vx11.free.
559pub fn query_pict_index_values(d &vx11.Display, format &Format, count &i32) &IndexValue {
560 return C.XRenderQueryPictIndexValues(d, format, count)
561}
562
563// Pictures
564
565// The caller owns the picture; release it with free_picture before its drawable.
566pub fn create_picture(d &vx11.Display, drawable vx11.Drawable, format &Format, mask vx11.CULong, attributes &PictureAttributes) Picture {
567 return C.XRenderCreatePicture(d, drawable, format, mask, attributes)
568}
569
570pub fn free_picture(d &vx11.Display, picture Picture) {
571 C.XRenderFreePicture(d, picture)
572}
573
574pub fn change_picture(d &vx11.Display, picture Picture, mask vx11.CULong, attributes &PictureAttributes) {
575 C.XRenderChangePicture(d, picture, mask, attributes)
576}
577
578pub fn set_picture_clip_rectangles(d &vx11.Display, picture Picture, x_origin i32, y_origin i32, rectangles &vx11.XRectangle, count i32) {
579 C.XRenderSetPictureClipRectangles(d, picture, x_origin, y_origin, rectangles, count)
580}
581
582// The region is copied; the caller keeps ownership of r.
583pub fn set_picture_clip_region(d &vx11.Display, picture Picture, r vx11.Region) {
584 C.XRenderSetPictureClipRegion(d, picture, r)
585}
586
587// Requires Render 0.6.
588pub fn set_picture_transform(d &vx11.Display, picture Picture, transform &Transform) {
589 C.XRenderSetPictureTransform(d, picture, transform)
590}
591
592pub fn composite(d &vx11.Display, op i32, src Picture, mask Picture, dst Picture, src_x i32, src_y i32, mask_x i32, mask_y i32, dst_x i32, dst_y i32, width u32, height u32) {
593 C.XRenderComposite(d, op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height)
594}
595
596// Glyphs
597
598// The caller owns the glyph set; release it with free_glyph_set.
599pub fn create_glyph_set(d &vx11.Display, format &Format) GlyphSet {
600 return C.XRenderCreateGlyphSet(d, format)
601}
602
603// Returns a new ID sharing existing's glyphs. Free each ID separately.
604// Upstream defect: renderproto.h gives sz_xRenderReferenceGlyphSetReq as 24
605// bytes, but the request is 12, so libXrender sends a bad length and servers
606// that check it (Xorg, Xvfb) report a fatal BadLength. Avoid it, or call it
607// under an error handler.
608pub fn reference_glyph_set(d &vx11.Display, existing GlyphSet) GlyphSet {
609 return C.XRenderReferenceGlyphSet(d, existing)
610}
611
612pub fn free_glyph_set(d &vx11.Display, glyphset GlyphSet) {
613 C.XRenderFreeGlyphSet(d, glyphset)
614}
615
616// images holds each glyph as a Z-format image whose rows are padded to 32 bits.
617pub fn add_glyphs(d &vx11.Display, glyphset GlyphSet, gids &Glyph, glyphs &GlyphInfo, count i32, images &char, image_bytes i32) {
618 C.XRenderAddGlyphs(d, glyphset, gids, glyphs, count, images, image_bytes)
619}
620
621// Every glyph must exist in glyphset, or the server reports a Match error.
622pub fn free_glyphs(d &vx11.Display, glyphset GlyphSet, gids &Glyph, count i32) {
623 C.XRenderFreeGlyphs(d, glyphset, gids, count)
624}
625
626pub fn composite_string8(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, glyphset GlyphSet, src_x i32, src_y i32, dst_x i32, dst_y i32, text &char, count i32) {
627 C.XRenderCompositeString8(d, op, src, dst, mask_format, glyphset, src_x, src_y, dst_x, dst_y, text, count)
628}
629
630pub fn composite_string16(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, glyphset GlyphSet, src_x i32, src_y i32, dst_x i32, dst_y i32, text &u16, count i32) {
631 C.XRenderCompositeString16(d, op, src, dst, mask_format, glyphset, src_x, src_y, dst_x, dst_y, text, count)
632}
633
634pub fn composite_string32(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, glyphset GlyphSet, src_x i32, src_y i32, dst_x i32, dst_y i32, text &u32, count i32) {
635 C.XRenderCompositeString32(d, op, src, dst, mask_format, glyphset, src_x, src_y, dst_x, dst_y, text, count)
636}
637
638pub fn composite_text8(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, dst_x i32, dst_y i32, elements &GlyphElt8, count i32) {
639 C.XRenderCompositeText8(d, op, src, dst, mask_format, src_x, src_y, dst_x, dst_y, elements, count)
640}
641
642pub fn composite_text16(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, dst_x i32, dst_y i32, elements &GlyphElt16, count i32) {
643 C.XRenderCompositeText16(d, op, src, dst, mask_format, src_x, src_y, dst_x, dst_y, elements, count)
644}
645
646pub fn composite_text32(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, dst_x i32, dst_y i32, elements &GlyphElt32, count i32) {
647 C.XRenderCompositeText32(d, op, src, dst, mask_format, src_x, src_y, dst_x, dst_y, elements, count)
648}
649
650// Filling and geometry
651
652// color is premultiplied by alpha.
653pub fn fill_rectangle(d &vx11.Display, op i32, dst Picture, color &Color, x i32, y i32, width u32, height u32) {
654 C.XRenderFillRectangle(d, op, dst, color, x, y, width, height)
655}
656
657// color is premultiplied by alpha.
658pub fn fill_rectangles(d &vx11.Display, op i32, dst Picture, color &Color, rectangles &vx11.XRectangle, count i32) {
659 C.XRenderFillRectangles(d, op, dst, color, rectangles, count)
660}
661
662// Requires Render 0.4. A NULL mask_format composites each trapezoid separately.
663pub fn composite_trapezoids(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, traps &Trapezoid, count i32) {
664 C.XRenderCompositeTrapezoids(d, op, src, dst, mask_format, src_x, src_y, traps, count)
665}
666
667// Requires Render 0.4.
668pub fn composite_triangles(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, triangles &Triangle, count i32) {
669 C.XRenderCompositeTriangles(d, op, src, dst, mask_format, src_x, src_y, triangles, count)
670}
671
672// Requires Render 0.4 and at least three points.
673pub fn composite_tri_strip(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, points &PointFixed, count i32) {
674 C.XRenderCompositeTriStrip(d, op, src, dst, mask_format, src_x, src_y, points, count)
675}
676
677// Requires Render 0.4 and at least three points.
678pub fn composite_tri_fan(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, points &PointFixed, count i32) {
679 C.XRenderCompositeTriFan(d, op, src, dst, mask_format, src_x, src_y, points, count)
680}
681
682// Tessellates the polygon into trapezoids client-side. winding is nonzero for
683// the nonzero rule and 0 for even-odd. Requires Render 0.4.
684pub fn composite_double_poly(d &vx11.Display, op i32, src Picture, dst Picture, mask_format &Format, src_x i32, src_y i32, dst_x i32, dst_y i32, points &PointDouble, count i32, winding i32) {
685 C.XRenderCompositeDoublePoly(d, op, src, dst, mask_format, src_x, src_y, dst_x, dst_y, points, count, winding)
686}
687
688// Accepts XParseColor specifications and rgba:r/g/b/a. The result is
689// premultiplied. Returns nonzero on success.
690pub fn parse_color(d &vx11.Display, spec &char, def &Color) i32 {
691 return C.XRenderParseColor(d, spec, def)
692}
693
694// Requires Render 0.5. The caller owns the cursor; release it with vx11.free_cursor.
695pub fn create_cursor(d &vx11.Display, source Picture, x u32, y u32) vx11.Cursor {
696 return C.XRenderCreateCursor(d, source, x, y)
697}
698
699// Requires Render 0.6. Release the result with vx11.free; NULL on failure.
700pub fn query_filters(d &vx11.Display, drawable vx11.Drawable) &Filters {
701 return C.XRenderQueryFilters(d, drawable)
702}
703
704// Requires Render 0.6. Unknown filter names produce a BadName error.
705pub fn set_picture_filter(d &vx11.Display, picture Picture, filter &char, params &Fixed, count i32) {
706 C.XRenderSetPictureFilter(d, picture, filter, params, count)
707}
708
709// Requires Render 0.8. delay is in milliseconds. The frame cursors are copied;
710// the caller owns the result and releases it with vx11.free_cursor.
711pub fn create_anim_cursor(d &vx11.Display, count i32, cursors &AnimCursor) vx11.Cursor {
712 return C.XRenderCreateAnimCursor(d, count, cursors)
713}
714
715// Requires Render 0.9. picture must have an alpha-only format.
716pub fn add_traps(d &vx11.Display, picture Picture, x_offset i32, y_offset i32, traps &Trap, count i32) {
717 C.XRenderAddTraps(d, picture, x_offset, y_offset, traps, count)
718}
719
720// Requires Render 0.10. color is premultiplied. Release with free_picture.
721pub fn create_solid_fill(d &vx11.Display, color &Color) Picture {
722 return C.XRenderCreateSolidFill(d, color)
723}
724
725// Requires Render 0.10. Stops lie in [0, 1] in increasing order; colors are
726// not premultiplied. Release with free_picture.
727pub fn create_linear_gradient(d &vx11.Display, gradient &LinearGradient, stops &Fixed, colors &Color, count i32) Picture {
728 return C.XRenderCreateLinearGradient(d, gradient, stops, colors, count)
729}
730
731// Requires Render 0.10. Stops lie in [0, 1] in increasing order; colors are
732// not premultiplied. Release with free_picture.
733pub fn create_radial_gradient(d &vx11.Display, gradient &RadialGradient, stops &Fixed, colors &Color, count i32) Picture {
734 return C.XRenderCreateRadialGradient(d, gradient, stops, colors, count)
735}
736
737// Requires Render 0.10. Stops lie in [0, 1] in increasing order; colors are
738// not premultiplied. Release with free_picture.
739pub fn create_conical_gradient(d &vx11.Display, gradient &ConicalGradient, stops &Fixed, colors &Color, count i32) Picture {
740 return C.XRenderCreateConicalGradient(d, gradient, stops, colors, count)
741}
742