1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
// x11-rs: Rust bindings for X11 libraries
// The X11 libraries are available under the MIT license.
// These bindings are public domain.

use libc::{
  c_char,
  c_double,
  c_int,
  c_short,
  c_uint,
  c_ulong,
  c_ushort,
};

use ::xlib::{
  Atom,
  Bool,
  Colormap,
  Cursor,
  Display,
  Pixmap,
  Region,
  Visual,
  XID,
  XRectangle,
};


//
// functions
//


x11_link! { Xrender, ["libXrender.so", "libXrender.so.1"],
  pub fn XRenderAddGlyphs (_7: *mut Display, _6: c_ulong, _5: *const c_ulong, _4: *const XGlyphInfo, _3: c_int, _2: *const c_char, _1: c_int) -> (),
  pub fn XRenderAddTraps (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XTrap, _1: c_int) -> (),
  pub fn XRenderChangePicture (_4: *mut Display, _3: c_ulong, _2: c_ulong, _1: *const XRenderPictureAttributes) -> (),
  pub fn XRenderComposite (_13: *mut Display, _12: c_int, _11: c_ulong, _10: c_ulong, _9: c_ulong, _8: c_int, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
  pub fn XRenderCompositeDoublePoly (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_int, _6: c_int, _5: c_int, _4: c_int, _3: *const XPointDouble, _2: c_int, _1: c_int) -> (),
  pub fn XRenderCompositeString16 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_ushort, _1: c_int) -> (),
  pub fn XRenderCompositeString32 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_uint, _1: c_int) -> (),
  pub fn XRenderCompositeString8 (_12: *mut Display, _11: c_int, _10: c_ulong, _9: c_ulong, _8: *const XRenderPictFormat, _7: c_ulong, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const c_char, _1: c_int) -> (),
  pub fn XRenderCompositeText16 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt16, _1: c_int) -> (),
  pub fn XRenderCompositeText32 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt32, _1: c_int) -> (),
  pub fn XRenderCompositeText8 (_11: *mut Display, _10: c_int, _9: c_ulong, _8: c_ulong, _7: *const XRenderPictFormat, _6: c_int, _5: c_int, _4: c_int, _3: c_int, _2: *const XGlyphElt8, _1: c_int) -> (),
  pub fn XRenderCompositeTrapezoids (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTrapezoid, _1: c_int) -> (),
  pub fn XRenderCompositeTriangles (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XTriangle, _1: c_int) -> (),
  pub fn XRenderCompositeTriFan (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (),
  pub fn XRenderCompositeTriStrip (_9: *mut Display, _8: c_int, _7: c_ulong, _6: c_ulong, _5: *const XRenderPictFormat, _4: c_int, _3: c_int, _2: *const XPointFixed, _1: c_int) -> (),
  pub fn XRenderCreateAnimCursor (_3: *mut Display, _2: c_int, _1: *mut XAnimCursor) -> c_ulong,
  pub fn XRenderCreateConicalGradient (_5: *mut Display, _4: *const XConicalGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
  pub fn XRenderCreateCursor (_4: *mut Display, _3: c_ulong, _2: c_uint, _1: c_uint) -> c_ulong,
  pub fn XRenderCreateGlyphSet (_2: *mut Display, _1: *const XRenderPictFormat) -> c_ulong,
  pub fn XRenderCreateLinearGradient (_5: *mut Display, _4: *const XLinearGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
  pub fn XRenderCreatePicture (_5: *mut Display, _4: c_ulong, _3: *const XRenderPictFormat, _2: c_ulong, _1: *const XRenderPictureAttributes) -> c_ulong,
  pub fn XRenderCreateRadialGradient (_5: *mut Display, _4: *const XRadialGradient, _3: *const c_int, _2: *const XRenderColor, _1: c_int) -> c_ulong,
  pub fn XRenderCreateSolidFill (_2: *mut Display, _1: *const XRenderColor) -> c_ulong,
  pub fn XRenderFillRectangle (_8: *mut Display, _7: c_int, _6: c_ulong, _5: *const XRenderColor, _4: c_int, _3: c_int, _2: c_uint, _1: c_uint) -> (),
  pub fn XRenderFillRectangles (_6: *mut Display, _5: c_int, _4: c_ulong, _3: *const XRenderColor, _2: *const XRectangle, _1: c_int) -> (),
  pub fn XRenderFindFormat (_4: *mut Display, _3: c_ulong, _2: *const XRenderPictFormat, _1: c_int) -> *mut XRenderPictFormat,
  pub fn XRenderFindStandardFormat (_2: *mut Display, _1: c_int) -> *mut XRenderPictFormat,
  pub fn XRenderFindVisualFormat (_2: *mut Display, _1: *const Visual) -> *mut XRenderPictFormat,
  pub fn XRenderFreeGlyphs (_4: *mut Display, _3: c_ulong, _2: *const c_ulong, _1: c_int) -> (),
  pub fn XRenderFreeGlyphSet (_2: *mut Display, _1: c_ulong) -> (),
  pub fn XRenderFreePicture (_2: *mut Display, _1: c_ulong) -> (),
  pub fn XRenderParseColor (_3: *mut Display, _2: *mut c_char, _1: *mut XRenderColor) -> c_int,
  pub fn XRenderQueryExtension (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
  pub fn XRenderQueryFilters (_2: *mut Display, _1: c_ulong) -> *mut XFilters,
  pub fn XRenderQueryFormats (_1: *mut Display) -> c_int,
  pub fn XRenderQueryPictIndexValues (_3: *mut Display, _2: *const XRenderPictFormat, _1: *mut c_int) -> *mut XIndexValue,
  pub fn XRenderQuerySubpixelOrder (_2: *mut Display, _1: c_int) -> c_int,
  pub fn XRenderQueryVersion (_3: *mut Display, _2: *mut c_int, _1: *mut c_int) -> c_int,
  pub fn XRenderReferenceGlyphSet (_2: *mut Display, _1: c_ulong) -> c_ulong,
  pub fn XRenderSetPictureClipRectangles (_6: *mut Display, _5: c_ulong, _4: c_int, _3: c_int, _2: *const XRectangle, _1: c_int) -> (),
  pub fn XRenderSetPictureClipRegion (_3: *mut Display, _2: c_ulong, _1: Region) -> (),
  pub fn XRenderSetPictureFilter (_5: *mut Display, _4: c_ulong, _3: *const c_char, _2: *mut c_int, _1: c_int) -> (),
  pub fn XRenderSetPictureTransform (_3: *mut Display, _2: c_ulong, _1: *mut XTransform) -> (),
  pub fn XRenderSetSubpixelOrder (_3: *mut Display, _2: c_int, _1: c_int) -> c_int,
variadic:
globals:
}


//
// types
//


pub type Glyph = XID;
pub type GlyphSet = XID;
pub type PictFormat = XID;
pub type Picture = XID;
pub type XDouble = c_double;
pub type XFixed = c_int;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XAnimCursor {
  pub cursor: Cursor,
  pub delay: c_ulong,
}
pub type XAnimCursor = _XAnimCursor;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XCircle {
  pub x: XFixed,
  pub y: XFixed,
  pub radius: XFixed,
}
pub type XCircle = _XCircle;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XConicalGradient {
  pub center: XPointFixed,
  pub angle: XFixed,
}
pub type XConicalGradient = _XConicalGradient;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XFilters {
  pub nfilter: c_int,
  pub filter: *mut *mut c_char,
  pub nalias: c_int,
  pub alias: *mut c_short,
}
pub type XFilters = _XFilters;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XGlyphElt8 {
  pub glyphset: GlyphSet,
  pub chars: *mut c_char,
  pub nchars: c_int,
  pub xOff: c_int,
  pub yOff: c_int,
}
pub type XGlyphElt8 = _XGlyphElt8;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XGlyphElt16 {
  pub glyphset: GlyphSet,
  pub chars: *mut c_ushort,
  pub nchars: c_int,
  pub xOff: c_int,
  pub yOff: c_int,
}
pub type XGlyphElt16 = _XGlyphElt16;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XGlyphElt32 {
  pub glyphset: GlyphSet,
  pub chars: *mut c_uint,
  pub nchars: c_int,
  pub xOff: c_int,
  pub yOff: c_int,
}
pub type XGlyphElt32 = _XGlyphElt32;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XGlyphInfo {
  pub width: c_ushort,
  pub height: c_ushort,
  pub x: c_short,
  pub y: c_short,
  pub xOff: c_short,
  pub yOff: c_short,
}
pub type XGlyphInfo = _XGlyphInfo;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XIndexValue {
  pub pixel: c_ulong,
  pub red: c_ushort,
  pub green: c_ushort,
  pub blue: c_ushort,
  pub alpha: c_ushort,
}
pub type XIndexValue = _XIndexValue;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XLinearGradient {
  pub p1: XPointFixed,
  pub p2: XPointFixed,
}
pub type XLinearGradient = _XLinearGradient;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XLineFixed {
  pub p1: XPointFixed,
  pub p2: XPointFixed,
}
pub type XLineFixed = _XLineFixed;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XPointDouble {
  pub x: XDouble,
  pub y: XDouble,
}
pub type XPointDouble = _XPointDouble;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XPointFixed {
  pub x: XFixed,
  pub y: XFixed,
}
pub type XPointFixed = _XPointFixed;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XRadialGradient {
  pub inner: XCircle,
  pub outer: XCircle,
}
pub type XRadialGradient = _XRadialGradient;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct XRenderColor {
  pub red: c_ushort,
  pub green: c_ushort,
  pub blue: c_ushort,
  pub alpha: c_ushort,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct XRenderDirectFormat {
  pub red: c_short,
  pub redMask: c_short,
  pub green: c_short,
  pub greenMask: c_short,
  pub blue: c_short,
  pub blueMask: c_short,
  pub alpha: c_short,
  pub alphaMask: c_short,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct XRenderPictFormat {
  pub id: PictFormat,
  pub type_: c_int,
  pub depth: c_int,
  pub direct: XRenderDirectFormat,
  pub colormap: Colormap,
}

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XRenderPictureAttributes {
  pub repeat: c_int,
  pub alpha_map: Picture,
  pub alpha_x_origin: c_int,
  pub alpha_y_origin: c_int,
  pub clip_x_origin: c_int,
  pub clip_y_origin: c_int,
  pub clip_mask: Pixmap,
  pub graphics_exposures: Bool,
  pub subwindow_mode: c_int,
  pub poly_edge: c_int,
  pub poly_mode: c_int,
  pub dither: Atom,
  pub component_alpha: Bool,
}
pub type XRenderPictureAttributes = _XRenderPictureAttributes;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XSpanFix {
  pub left: XFixed,
  pub right: XFixed,
  pub y: XFixed,
}
pub type XSpanFix = _XSpanFix;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XTrap {
  pub top: XSpanFix,
  pub bottom: XSpanFix,
}
pub type XTrap = _XTrap;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XTrapezoid {
  pub top: XFixed,
  pub bottom: XFixed,
  pub left: XLineFixed,
  pub right: XLineFixed,
}
pub type XTrapezoid = _XTrapezoid;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XTriangle {
  pub p1: XPointFixed,
  pub p2: XPointFixed,
  pub p3: XPointFixed,
}
pub type XTriangle = _XTriangle;

#[derive(Clone, Copy)]
#[repr(C)]
pub struct _XTransform {
  pub matrix: [[XFixed; 3]; 3],
}
pub type XTransform = _XTransform;