| 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. |
| 3 | module render |
| 4 | |
| 5 | import vx11 |
| 6 | |
| 7 | #flag -lXrender |
| 8 | #include <X11/extensions/Xrender.h> |
| 9 | |
| 10 | // render.h |
| 11 | |
| 12 | pub const name = 'RENDER' |
| 13 | pub const major_version = 0 |
| 14 | pub const minor_version = 11 |
| 15 | |
| 16 | // Minor request opcodes, for decoding XErrorEvent.minor_code. |
| 17 | pub const x_query_version = 0 |
| 18 | pub const x_query_pict_formats = 1 |
| 19 | pub const x_query_pict_index_values = 2 |
| 20 | pub const x_query_dithers = 3 |
| 21 | pub const x_create_picture = 4 |
| 22 | pub const x_change_picture = 5 |
| 23 | pub const x_set_picture_clip_rectangles = 6 |
| 24 | pub const x_free_picture = 7 |
| 25 | pub const x_composite = 8 |
| 26 | pub const x_scale = 9 |
| 27 | pub const x_trapezoids = 10 |
| 28 | pub const x_triangles = 11 |
| 29 | pub const x_tri_strip = 12 |
| 30 | pub const x_tri_fan = 13 |
| 31 | pub const x_color_trapezoids = 14 |
| 32 | pub const x_color_triangles = 15 |
| 33 | pub const x_create_glyph_set = 17 |
| 34 | pub const x_reference_glyph_set = 18 |
| 35 | pub const x_free_glyph_set = 19 |
| 36 | pub const x_add_glyphs = 20 |
| 37 | pub const x_add_glyphs_from_picture = 21 |
| 38 | pub const x_free_glyphs = 22 |
| 39 | pub const x_composite_glyphs8 = 23 |
| 40 | pub const x_composite_glyphs16 = 24 |
| 41 | pub const x_composite_glyphs32 = 25 |
| 42 | pub const x_fill_rectangles = 26 |
| 43 | pub const x_create_cursor = 27 |
| 44 | pub const x_set_picture_transform = 28 |
| 45 | pub const x_query_filters = 29 |
| 46 | pub const x_set_picture_filter = 30 |
| 47 | pub const x_create_anim_cursor = 31 |
| 48 | pub const x_add_traps = 32 |
| 49 | pub const x_create_solid_fill = 33 |
| 50 | pub const x_create_linear_gradient = 34 |
| 51 | pub const x_create_radial_gradient = 35 |
| 52 | pub const x_create_conical_gradient = 36 |
| 53 | pub const number_requests = 37 |
| 54 | |
| 55 | // Error codes are offsets from the server-assigned error base. |
| 56 | pub const bad_pict_format = 0 |
| 57 | pub const bad_picture = 1 |
| 58 | pub const bad_pict_op = 2 |
| 59 | pub const bad_glyph_set = 3 |
| 60 | pub const bad_glyph = 4 |
| 61 | pub const number_errors = 5 |
| 62 | |
| 63 | pub const pict_type_indexed = 0 |
| 64 | pub const pict_type_direct = 1 |
| 65 | |
| 66 | // Porter-Duff operators. |
| 67 | pub const op_minimum = 0 |
| 68 | pub const op_clear = 0 |
| 69 | pub const op_src = 1 |
| 70 | pub const op_dst = 2 |
| 71 | pub const op_over = 3 |
| 72 | pub const op_over_reverse = 4 |
| 73 | pub const op_in = 5 |
| 74 | pub const op_in_reverse = 6 |
| 75 | pub const op_out = 7 |
| 76 | pub const op_out_reverse = 8 |
| 77 | pub const op_atop = 9 |
| 78 | pub const op_atop_reverse = 10 |
| 79 | pub const op_xor = 11 |
| 80 | pub const op_add = 12 |
| 81 | pub const op_saturate = 13 |
| 82 | pub const op_maximum = 13 |
| 83 | |
| 84 | // Disjoint and conjoint operators (Render 0.2). |
| 85 | pub const op_disjoint_minimum = 0x10 |
| 86 | pub const op_disjoint_clear = 0x10 |
| 87 | pub const op_disjoint_src = 0x11 |
| 88 | pub const op_disjoint_dst = 0x12 |
| 89 | pub const op_disjoint_over = 0x13 |
| 90 | pub const op_disjoint_over_reverse = 0x14 |
| 91 | pub const op_disjoint_in = 0x15 |
| 92 | pub const op_disjoint_in_reverse = 0x16 |
| 93 | pub const op_disjoint_out = 0x17 |
| 94 | pub const op_disjoint_out_reverse = 0x18 |
| 95 | pub const op_disjoint_atop = 0x19 |
| 96 | pub const op_disjoint_atop_reverse = 0x1a |
| 97 | pub const op_disjoint_xor = 0x1b |
| 98 | pub const op_disjoint_maximum = 0x1b |
| 99 | |
| 100 | pub const op_conjoint_minimum = 0x20 |
| 101 | pub const op_conjoint_clear = 0x20 |
| 102 | pub const op_conjoint_src = 0x21 |
| 103 | pub const op_conjoint_dst = 0x22 |
| 104 | pub const op_conjoint_over = 0x23 |
| 105 | pub const op_conjoint_over_reverse = 0x24 |
| 106 | pub const op_conjoint_in = 0x25 |
| 107 | pub const op_conjoint_in_reverse = 0x26 |
| 108 | pub const op_conjoint_out = 0x27 |
| 109 | pub const op_conjoint_out_reverse = 0x28 |
| 110 | pub const op_conjoint_atop = 0x29 |
| 111 | pub const op_conjoint_atop_reverse = 0x2a |
| 112 | pub const op_conjoint_xor = 0x2b |
| 113 | pub const op_conjoint_maximum = 0x2b |
| 114 | |
| 115 | // PDF blend modes (Render 0.11). |
| 116 | pub const op_blend_minimum = 0x30 |
| 117 | pub const op_multiply = 0x30 |
| 118 | pub const op_screen = 0x31 |
| 119 | pub const op_overlay = 0x32 |
| 120 | pub const op_darken = 0x33 |
| 121 | pub const op_lighten = 0x34 |
| 122 | pub const op_color_dodge = 0x35 |
| 123 | pub const op_color_burn = 0x36 |
| 124 | pub const op_hard_light = 0x37 |
| 125 | pub const op_soft_light = 0x38 |
| 126 | pub const op_difference = 0x39 |
| 127 | pub const op_exclusion = 0x3a |
| 128 | pub const op_hsl_hue = 0x3b |
| 129 | pub const op_hsl_saturation = 0x3c |
| 130 | pub const op_hsl_color = 0x3d |
| 131 | pub const op_hsl_luminosity = 0x3e |
| 132 | pub const op_blend_maximum = 0x3e |
| 133 | |
| 134 | pub const poly_edge_sharp = 0 |
| 135 | pub const poly_edge_smooth = 1 |
| 136 | pub const poly_mode_precise = 0 |
| 137 | pub const poly_mode_imprecise = 1 |
| 138 | |
| 139 | // Picture attribute mask bits for create_picture and change_picture. |
| 140 | pub const cp_repeat = vx11.CULong(1 << 0) |
| 141 | pub const cp_alpha_map = vx11.CULong(1 << 1) |
| 142 | pub const cp_alpha_x_origin = vx11.CULong(1 << 2) |
| 143 | pub const cp_alpha_y_origin = vx11.CULong(1 << 3) |
| 144 | pub const cp_clip_x_origin = vx11.CULong(1 << 4) |
| 145 | pub const cp_clip_y_origin = vx11.CULong(1 << 5) |
| 146 | pub const cp_clip_mask = vx11.CULong(1 << 6) |
| 147 | pub const cp_graphics_exposure = vx11.CULong(1 << 7) |
| 148 | pub const cp_subwindow_mode = vx11.CULong(1 << 8) |
| 149 | pub const cp_poly_edge = vx11.CULong(1 << 9) |
| 150 | pub const cp_poly_mode = vx11.CULong(1 << 10) |
| 151 | pub const cp_dither = vx11.CULong(1 << 11) |
| 152 | pub const cp_component_alpha = vx11.CULong(1 << 12) |
| 153 | pub const cp_last_bit = 12 |
| 154 | |
| 155 | pub const filter_nearest = 'nearest' |
| 156 | pub const filter_bilinear = 'bilinear' |
| 157 | pub const filter_convolution = 'convolution' |
| 158 | pub const filter_fast = 'fast' |
| 159 | pub const filter_good = 'good' |
| 160 | pub const filter_best = 'best' |
| 161 | pub const filter_alias_none = -1 |
| 162 | |
| 163 | pub const subpixel_unknown = 0 |
| 164 | pub const subpixel_horizontal_rgb = 1 |
| 165 | pub const subpixel_horizontal_bgr = 2 |
| 166 | pub const subpixel_vertical_rgb = 3 |
| 167 | pub const subpixel_vertical_bgr = 4 |
| 168 | pub const subpixel_none = 5 |
| 169 | |
| 170 | // Repeat modes; pad and reflect require Render 0.10. |
| 171 | pub const repeat_none = 0 |
| 172 | pub const repeat_normal = 1 |
| 173 | pub const repeat_pad = 2 |
| 174 | pub const repeat_reflect = 3 |
| 175 | |
| 176 | pub type Glyph = vx11.XID |
| 177 | pub type GlyphSet = vx11.XID |
| 178 | pub type Picture = vx11.XID |
| 179 | pub type PictFormat = vx11.XID |
| 180 | |
| 181 | // Xrender.h |
| 182 | |
| 183 | // Format mask bits for find_format: which template fields must match. |
| 184 | pub const format_id = vx11.CULong(1 << 0) |
| 185 | pub const format_type = vx11.CULong(1 << 1) |
| 186 | pub const format_depth = vx11.CULong(1 << 2) |
| 187 | pub const format_red = vx11.CULong(1 << 3) |
| 188 | pub const format_red_mask = vx11.CULong(1 << 4) |
| 189 | pub const format_green = vx11.CULong(1 << 5) |
| 190 | pub const format_green_mask = vx11.CULong(1 << 6) |
| 191 | pub const format_blue = vx11.CULong(1 << 7) |
| 192 | pub const format_blue_mask = vx11.CULong(1 << 8) |
| 193 | pub const format_alpha = vx11.CULong(1 << 9) |
| 194 | pub const format_alpha_mask = vx11.CULong(1 << 10) |
| 195 | pub const format_colormap = vx11.CULong(1 << 11) |
| 196 | |
| 197 | pub const standard_argb32 = 0 |
| 198 | pub const standard_rgb24 = 1 |
| 199 | pub const standard_a8 = 2 |
| 200 | pub const standard_a4 = 3 |
| 201 | pub const standard_a1 = 4 |
| 202 | pub const standard_num = 5 |
| 203 | |
| 204 | // Fixed is XFixed, a signed 16.16 fixed-point value; Double is XDouble. |
| 205 | pub type Fixed = i32 |
| 206 | pub type Double = f64 |
| 207 | |
| 208 | @[typedef] |
| 209 | pub struct C.XRenderDirectFormat { |
| 210 | pub 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 | |
| 221 | pub 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] |
| 226 | pub struct C.XRenderPictFormat { |
| 227 | pub mut: |
| 228 | id PictFormat |
| 229 | @type i32 |
| 230 | depth i32 |
| 231 | direct DirectFormat |
| 232 | colormap vx11.Colormap |
| 233 | } |
| 234 | |
| 235 | pub type Format = C.XRenderPictFormat |
| 236 | |
| 237 | @[typedef] |
| 238 | pub struct C.XRenderPictureAttributes { |
| 239 | pub 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 | |
| 255 | pub 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] |
| 260 | pub struct C.XRenderColor { |
| 261 | pub mut: |
| 262 | red u16 |
| 263 | green u16 |
| 264 | blue u16 |
| 265 | alpha u16 |
| 266 | } |
| 267 | |
| 268 | pub type Color = C.XRenderColor |
| 269 | |
| 270 | @[typedef] |
| 271 | pub struct C.XGlyphInfo { |
| 272 | pub mut: |
| 273 | width u16 |
| 274 | height u16 |
| 275 | x i16 |
| 276 | y i16 |
| 277 | xOff i16 |
| 278 | yOff i16 |
| 279 | } |
| 280 | |
| 281 | pub type GlyphInfo = C.XGlyphInfo |
| 282 | |
| 283 | @[typedef] |
| 284 | pub struct C.XGlyphElt8 { |
| 285 | pub mut: |
| 286 | glyphset GlyphSet |
| 287 | chars &char |
| 288 | nchars i32 |
| 289 | xOff i32 |
| 290 | yOff i32 |
| 291 | } |
| 292 | |
| 293 | pub type GlyphElt8 = C.XGlyphElt8 |
| 294 | |
| 295 | @[typedef] |
| 296 | pub struct C.XGlyphElt16 { |
| 297 | pub mut: |
| 298 | glyphset GlyphSet |
| 299 | chars &u16 |
| 300 | nchars i32 |
| 301 | xOff i32 |
| 302 | yOff i32 |
| 303 | } |
| 304 | |
| 305 | pub type GlyphElt16 = C.XGlyphElt16 |
| 306 | |
| 307 | @[typedef] |
| 308 | pub struct C.XGlyphElt32 { |
| 309 | pub mut: |
| 310 | glyphset GlyphSet |
| 311 | chars &u32 |
| 312 | nchars i32 |
| 313 | xOff i32 |
| 314 | yOff i32 |
| 315 | } |
| 316 | |
| 317 | pub type GlyphElt32 = C.XGlyphElt32 |
| 318 | |
| 319 | @[typedef] |
| 320 | pub struct C.XPointDouble { |
| 321 | pub mut: |
| 322 | x Double |
| 323 | y Double |
| 324 | } |
| 325 | |
| 326 | pub type PointDouble = C.XPointDouble |
| 327 | |
| 328 | @[typedef] |
| 329 | pub struct C.XPointFixed { |
| 330 | pub mut: |
| 331 | x Fixed |
| 332 | y Fixed |
| 333 | } |
| 334 | |
| 335 | pub type PointFixed = C.XPointFixed |
| 336 | |
| 337 | @[typedef] |
| 338 | pub struct C.XLineFixed { |
| 339 | pub mut: |
| 340 | p1 PointFixed |
| 341 | p2 PointFixed |
| 342 | } |
| 343 | |
| 344 | pub type LineFixed = C.XLineFixed |
| 345 | |
| 346 | @[typedef] |
| 347 | pub struct C.XTriangle { |
| 348 | pub mut: |
| 349 | p1 PointFixed |
| 350 | p2 PointFixed |
| 351 | p3 PointFixed |
| 352 | } |
| 353 | |
| 354 | pub type Triangle = C.XTriangle |
| 355 | |
| 356 | @[typedef] |
| 357 | pub struct C.XCircle { |
| 358 | pub mut: |
| 359 | x Fixed |
| 360 | y Fixed |
| 361 | radius Fixed |
| 362 | } |
| 363 | |
| 364 | pub type Circle = C.XCircle |
| 365 | |
| 366 | @[typedef] |
| 367 | pub struct C.XTrapezoid { |
| 368 | pub mut: |
| 369 | top Fixed |
| 370 | bottom Fixed |
| 371 | left LineFixed |
| 372 | right LineFixed |
| 373 | } |
| 374 | |
| 375 | pub type Trapezoid = C.XTrapezoid |
| 376 | |
| 377 | @[typedef] |
| 378 | pub struct C.XTransform { |
| 379 | pub mut: |
| 380 | matrix [3][3]Fixed |
| 381 | } |
| 382 | |
| 383 | pub type Transform = C.XTransform |
| 384 | |
| 385 | // Filters is one allocation: release the whole result with vx11.free. |
| 386 | @[typedef] |
| 387 | pub struct C.XFilters { |
| 388 | pub mut: |
| 389 | nfilter i32 |
| 390 | filter &&char |
| 391 | nalias i32 |
| 392 | alias &i16 |
| 393 | } |
| 394 | |
| 395 | pub type Filters = C.XFilters |
| 396 | |
| 397 | @[typedef] |
| 398 | pub struct C.XIndexValue { |
| 399 | pub mut: |
| 400 | pixel vx11.CULong |
| 401 | red u16 |
| 402 | green u16 |
| 403 | blue u16 |
| 404 | alpha u16 |
| 405 | } |
| 406 | |
| 407 | pub type IndexValue = C.XIndexValue |
| 408 | |
| 409 | @[typedef] |
| 410 | pub struct C.XAnimCursor { |
| 411 | pub mut: |
| 412 | cursor vx11.Cursor |
| 413 | delay vx11.CULong |
| 414 | } |
| 415 | |
| 416 | pub type AnimCursor = C.XAnimCursor |
| 417 | |
| 418 | @[typedef] |
| 419 | pub struct C.XSpanFix { |
| 420 | pub mut: |
| 421 | left Fixed |
| 422 | right Fixed |
| 423 | y Fixed |
| 424 | } |
| 425 | |
| 426 | pub type SpanFix = C.XSpanFix |
| 427 | |
| 428 | @[typedef] |
| 429 | pub struct C.XTrap { |
| 430 | pub mut: |
| 431 | top SpanFix |
| 432 | bottom SpanFix |
| 433 | } |
| 434 | |
| 435 | pub type Trap = C.XTrap |
| 436 | |
| 437 | @[typedef] |
| 438 | pub struct C.XLinearGradient { |
| 439 | pub mut: |
| 440 | p1 PointFixed |
| 441 | p2 PointFixed |
| 442 | } |
| 443 | |
| 444 | pub type LinearGradient = C.XLinearGradient |
| 445 | |
| 446 | @[typedef] |
| 447 | pub struct C.XRadialGradient { |
| 448 | pub mut: |
| 449 | inner Circle |
| 450 | outer Circle |
| 451 | } |
| 452 | |
| 453 | pub type RadialGradient = C.XRadialGradient |
| 454 | |
| 455 | // angle is in degrees. |
| 456 | @[typedef] |
| 457 | pub struct C.XConicalGradient { |
| 458 | pub mut: |
| 459 | center PointFixed |
| 460 | angle Fixed |
| 461 | } |
| 462 | |
| 463 | pub 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. |
| 467 | pub 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. |
| 470 | pub fn fixed_to_double(value Fixed) f64 { return f64(value) / 65536.0 } |
| 471 | |
| 472 | fn C.XRenderQueryExtension(&vx11.Display, &i32, &i32) i32 |
| 473 | fn C.XRenderQueryVersion(&vx11.Display, &i32, &i32) i32 |
| 474 | fn C.XRenderQueryFormats(&vx11.Display) i32 |
| 475 | fn C.XRenderQuerySubpixelOrder(&vx11.Display, i32) i32 |
| 476 | fn C.XRenderSetSubpixelOrder(&vx11.Display, i32, i32) i32 |
| 477 | fn C.XRenderFindVisualFormat(&vx11.Display, &vx11.Visual) &Format |
| 478 | fn C.XRenderFindFormat(&vx11.Display, vx11.CULong, &Format, i32) &Format |
| 479 | fn C.XRenderFindStandardFormat(&vx11.Display, i32) &Format |
| 480 | fn C.XRenderQueryPictIndexValues(&vx11.Display, &Format, &i32) &IndexValue |
| 481 | fn C.XRenderCreatePicture(&vx11.Display, vx11.Drawable, &Format, vx11.CULong, &PictureAttributes) Picture |
| 482 | fn C.XRenderFreePicture(&vx11.Display, Picture) |
| 483 | fn C.XRenderChangePicture(&vx11.Display, Picture, vx11.CULong, &PictureAttributes) |
| 484 | fn C.XRenderSetPictureClipRectangles(&vx11.Display, Picture, i32, i32, &vx11.XRectangle, i32) |
| 485 | fn C.XRenderSetPictureClipRegion(&vx11.Display, Picture, vx11.Region) |
| 486 | fn C.XRenderSetPictureTransform(&vx11.Display, Picture, &Transform) |
| 487 | fn C.XRenderComposite(&vx11.Display, i32, Picture, Picture, Picture, i32, i32, i32, i32, i32, i32, u32, u32) |
| 488 | fn C.XRenderCreateGlyphSet(&vx11.Display, &Format) GlyphSet |
| 489 | fn C.XRenderReferenceGlyphSet(&vx11.Display, GlyphSet) GlyphSet |
| 490 | fn C.XRenderFreeGlyphSet(&vx11.Display, GlyphSet) |
| 491 | fn C.XRenderAddGlyphs(&vx11.Display, GlyphSet, &Glyph, &GlyphInfo, i32, &char, i32) |
| 492 | fn C.XRenderFreeGlyphs(&vx11.Display, GlyphSet, &Glyph, i32) |
| 493 | fn C.XRenderCompositeString8(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &char, i32) |
| 494 | fn C.XRenderCompositeString16(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &u16, i32) |
| 495 | fn C.XRenderCompositeString32(&vx11.Display, i32, Picture, Picture, &Format, GlyphSet, i32, i32, i32, i32, &u32, i32) |
| 496 | fn C.XRenderCompositeText8(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt8, i32) |
| 497 | fn C.XRenderCompositeText16(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt16, i32) |
| 498 | fn C.XRenderCompositeText32(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &GlyphElt32, i32) |
| 499 | fn C.XRenderFillRectangle(&vx11.Display, i32, Picture, &Color, i32, i32, u32, u32) |
| 500 | fn C.XRenderFillRectangles(&vx11.Display, i32, Picture, &Color, &vx11.XRectangle, i32) |
| 501 | fn C.XRenderCompositeTrapezoids(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &Trapezoid, i32) |
| 502 | fn C.XRenderCompositeTriangles(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &Triangle, i32) |
| 503 | fn C.XRenderCompositeTriStrip(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &PointFixed, i32) |
| 504 | fn C.XRenderCompositeTriFan(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, &PointFixed, i32) |
| 505 | fn C.XRenderCompositeDoublePoly(&vx11.Display, i32, Picture, Picture, &Format, i32, i32, i32, i32, &PointDouble, i32, i32) |
| 506 | fn C.XRenderParseColor(&vx11.Display, &char, &Color) i32 |
| 507 | fn C.XRenderCreateCursor(&vx11.Display, Picture, u32, u32) vx11.Cursor |
| 508 | fn C.XRenderQueryFilters(&vx11.Display, vx11.Drawable) &Filters |
| 509 | fn C.XRenderSetPictureFilter(&vx11.Display, Picture, &char, &Fixed, i32) |
| 510 | fn C.XRenderCreateAnimCursor(&vx11.Display, i32, &AnimCursor) vx11.Cursor |
| 511 | fn C.XRenderAddTraps(&vx11.Display, Picture, i32, i32, &Trap, i32) |
| 512 | fn C.XRenderCreateSolidFill(&vx11.Display, &Color) Picture |
| 513 | fn C.XRenderCreateLinearGradient(&vx11.Display, &LinearGradient, &Fixed, &Color, i32) Picture |
| 514 | fn C.XRenderCreateRadialGradient(&vx11.Display, &RadialGradient, &Fixed, &Color, i32) Picture |
| 515 | fn C.XRenderCreateConicalGradient(&vx11.Display, &ConicalGradient, &Fixed, &Color, i32) Picture |
| 516 | |
| 517 | // Extension and formats |
| 518 | |
| 519 | pub fn query_extension(d &vx11.Display, event_base &i32, error_base &i32) i32 { |
| 520 | return C.XRenderQueryExtension(d, event_base, error_base) |
| 521 | } |
| 522 | |
| 523 | pub 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. |
| 528 | pub 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. |
| 533 | pub 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. |
| 538 | pub 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. |
| 543 | pub 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. |
| 549 | pub 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. |
| 554 | pub 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. |
| 559 | pub 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. |
| 566 | pub 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 | |
| 570 | pub fn free_picture(d &vx11.Display, picture Picture) { |
| 571 | C.XRenderFreePicture(d, picture) |
| 572 | } |
| 573 | |
| 574 | pub fn change_picture(d &vx11.Display, picture Picture, mask vx11.CULong, attributes &PictureAttributes) { |
| 575 | C.XRenderChangePicture(d, picture, mask, attributes) |
| 576 | } |
| 577 | |
| 578 | pub 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. |
| 583 | pub 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. |
| 588 | pub fn set_picture_transform(d &vx11.Display, picture Picture, transform &Transform) { |
| 589 | C.XRenderSetPictureTransform(d, picture, transform) |
| 590 | } |
| 591 | |
| 592 | pub 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. |
| 599 | pub 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. |
| 608 | pub fn reference_glyph_set(d &vx11.Display, existing GlyphSet) GlyphSet { |
| 609 | return C.XRenderReferenceGlyphSet(d, existing) |
| 610 | } |
| 611 | |
| 612 | pub 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. |
| 617 | pub 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. |
| 622 | pub fn free_glyphs(d &vx11.Display, glyphset GlyphSet, gids &Glyph, count i32) { |
| 623 | C.XRenderFreeGlyphs(d, glyphset, gids, count) |
| 624 | } |
| 625 | |
| 626 | pub 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 | |
| 630 | pub 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 | |
| 634 | pub 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 | |
| 638 | pub 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 | |
| 642 | pub 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 | |
| 646 | pub 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. |
| 653 | pub 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. |
| 658 | pub 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. |
| 663 | pub 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. |
| 668 | pub 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. |
| 673 | pub 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. |
| 678 | pub 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. |
| 684 | pub 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. |
| 690 | pub 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. |
| 695 | pub 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. |
| 700 | pub 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. |
| 705 | pub 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. |
| 711 | pub 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. |
| 716 | pub 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. |
| 721 | pub 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. |
| 727 | pub 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. |
| 733 | pub 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. |
| 739 | pub 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 | |