/binding/x/Xrender.d

http://github.com/wilkie/djehuty · D · 557 lines · 442 code · 79 blank · 36 comment · 0 complexity · 98e3dda539fed1a09a0332a5bbe340e3 MD5 · raw file

  1. /*
  2. * Xrender.d
  3. *
  4. * This file holds bindings to Xrender. This file was created from xrender.h
  5. * which is provided with Xrender proper. The original copyright notice is
  6. * displayed below, but does not pertain to this file.
  7. *
  8. * Author: Dave Wilkinson
  9. *
  10. */
  11. module binding.x.Xrender;
  12. /*
  13. *
  14. * Copyright © 2000 SuSE, Inc.
  15. *
  16. * Permission to use, copy, modify, distribute, and sell this software and its
  17. * documentation for any purpose is hereby granted without fee, provided that
  18. * the above copyright notice appear in all copies and that both that
  19. * copyright notice and this permission notice appear in supporting
  20. * documentation, and that the name of SuSE not be used in advertising or
  21. * publicity pertaining to distribution of the software without specific,
  22. * written prior permission. SuSE makes no representations about the
  23. * suitability of this software for any purpose. It is provided "as is"
  24. * without express or implied warranty.
  25. *
  26. * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
  28. * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  29. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  30. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  31. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  32. *
  33. * Author: Keith Packard, SuSE, Inc.
  34. */
  35. import binding.x.render;
  36. import binding.x.Xlib;
  37. //#include <X11/Xfuncproto.h>
  38. //#include <X11/Xosdefs.h>
  39. //#include <X11/Xutil.h>
  40. struct XRenderDirectFormat {
  41. short red;
  42. short redMask;
  43. short green;
  44. short greenMask;
  45. short blue;
  46. short blueMask;
  47. short alpha;
  48. short alphaMask;
  49. }
  50. struct XRenderPictFormat {
  51. PictFormat id;
  52. int type;
  53. int depth;
  54. XRenderDirectFormat direct;
  55. Colormap colormap;
  56. }
  57. enum:uint
  58. {
  59. PictFormatID = (1 << 0);
  60. PictFormatType = (1 << 1);
  61. PictFormatDepth = (1 << 2);
  62. PictFormatRed = (1 << 3);
  63. PictFormatRedMask = (1 << 4);
  64. PictFormatGreen = (1 << 5);
  65. PictFormatGreenMask = (1 << 6);
  66. PictFormatBlue = (1 << 7);
  67. PictFormatBlueMask = (1 << 8);
  68. PictFormatAlpha = (1 << 9);
  69. PictFormatAlphaMask = (1 << 10);
  70. PictFormatColormap = (1 << 11);
  71. }
  72. struct XRenderPictureAttributes {
  73. int repeat;
  74. Picture alpha_map;
  75. int alpha_x_origin;
  76. int alpha_y_origin;
  77. int clip_x_origin;
  78. int clip_y_origin;
  79. Pixmap clip_mask;
  80. Bool graphics_exposures;
  81. int subwindow_mode;
  82. int poly_edge;
  83. int poly_mode;
  84. Atom dither;
  85. Bool component_alpha;
  86. }
  87. struct {
  88. unsigned short red;
  89. unsigned short green;
  90. unsigned short blue;
  91. unsigned short alpha;
  92. } XRenderColor;
  93. struct XGlyphInfo {
  94. unsigned short width;
  95. unsigned short height;
  96. short x;
  97. short y;
  98. short xOff;
  99. short yOff;
  100. }
  101. struct XGlyphElt8 {
  102. GlyphSet glyphset;
  103. _Xconst char *chars;
  104. int nchars;
  105. int xOff;
  106. int yOff;
  107. }
  108. struct XGlyphElt16 {
  109. GlyphSet glyphset;
  110. _Xconst unsigned short *chars;
  111. int nchars;
  112. int xOff;
  113. int yOff;
  114. }
  115. struct XGlyphElt32 {
  116. GlyphSet glyphset;
  117. _Xconst uint *chars;
  118. int nchars;
  119. int xOff;
  120. int yOff;
  121. }
  122. typedef double XDouble;
  123. struct XPointDouble {
  124. XDouble x, y;
  125. }
  126. XFixed XDoubleToFixed(XDouble f)
  127. {
  128. return cast(XFixed)(f * 65536);
  129. }
  130. XDouble XFixedToDouble(XFixed f)
  131. {
  132. return cast(XDouble)(f) / cast(XDouble)65536.0;
  133. }
  134. alias int XFixed;
  135. typedef struct XPointFixed {
  136. XFixed x;
  137. XFixed y;
  138. }
  139. struct XLineFixed {
  140. XPointFixed p1;
  141. XPointFixed p2;
  142. }
  143. struct XTriangle {
  144. XPointFixed p1;
  145. XPointFixed p2;
  146. XPointFixed p3;
  147. }
  148. struct XCircle {
  149. XFixed x;
  150. XFixed y;
  151. XFixed radius;
  152. }
  153. struct XTrapezoid {
  154. XFixed top;
  155. XFixed bottom;
  156. XLineFixed left;
  157. XLineFixed right;
  158. }
  159. struct XTransform {
  160. XFixed matrix[3][3];
  161. }
  162. struct XFilters {
  163. int nfilter;
  164. char **filter;
  165. int nalias;
  166. short *alias;
  167. }
  168. struct XIndexValue {
  169. Culong pixel;
  170. ushort red;
  171. ushort green;
  172. ushort blue;
  173. ushort alpha;
  174. }
  175. struct XAnimCursor {
  176. Cursor cursor;
  177. Culong delay;
  178. }
  179. struct XSpanFix {
  180. XFixed left;
  181. XFixed right;
  182. XFixed y;
  183. }
  184. struct XTrap {
  185. XSpanFix top;
  186. XSpanFix bottom;
  187. }
  188. struct XLinearGradient {
  189. XPointFixed p1;
  190. XPointFixed p2;
  191. }
  192. struct XRadialGradient {
  193. XCircle inner;
  194. XCircle outer;
  195. }
  196. struct XConicalGradient {
  197. XPointFixed center;
  198. XFixed angle; /* in degrees */
  199. }
  200. _XFUNCPROTOBEGIN
  201. Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
  202. Status XRenderQueryVersion (Display *dpy,
  203. int *major_versionp,
  204. int *minor_versionp);
  205. Status XRenderQueryFormats (Display *dpy);
  206. int XRenderQuerySubpixelOrder (Display *dpy, int screen);
  207. Bool XRenderSetSubpixelOrder (Display *dpy, int screen, int subpixel);
  208. XRenderPictFormat *
  209. XRenderFindVisualFormat (Display *dpy, _Xconst Visual *visual);
  210. XRenderPictFormat *
  211. XRenderFindFormat (Display *dpy,
  212. Culong mask,
  213. _Xconst XRenderPictFormat *templ,
  214. int count);
  215. #define PictStandardARGB32 0
  216. #define PictStandardRGB24 1
  217. #define PictStandardA8 2
  218. #define PictStandardA4 3
  219. #define PictStandardA1 4
  220. #define PictStandardNUM 5
  221. XRenderPictFormat *
  222. XRenderFindStandardFormat (Display *dpy,
  223. int format);
  224. XIndexValue *
  225. XRenderQueryPictIndexValues(Display *dpy,
  226. _Xconst XRenderPictFormat *format,
  227. int *num);
  228. Picture
  229. XRenderCreatePicture (Display *dpy,
  230. Drawable drawable,
  231. _Xconst XRenderPictFormat *format,
  232. Culong valuemask,
  233. _Xconst XRenderPictureAttributes *attributes);
  234. void
  235. XRenderChangePicture (Display *dpy,
  236. Picture picture,
  237. Culong valuemask,
  238. _Xconst XRenderPictureAttributes *attributes);
  239. void
  240. XRenderSetPictureClipRectangles (Display *dpy,
  241. Picture picture,
  242. int xOrigin,
  243. int yOrigin,
  244. _Xconst XRectangle *rects,
  245. int n);
  246. void
  247. XRenderSetPictureClipRegion (Display *dpy,
  248. Picture picture,
  249. Region r);
  250. void
  251. XRenderSetPictureTransform (Display *dpy,
  252. Picture picture,
  253. XTransform *transform);
  254. void
  255. XRenderFreePicture (Display *dpy,
  256. Picture picture);
  257. void
  258. XRenderComposite (Display *dpy,
  259. int op,
  260. Picture src,
  261. Picture mask,
  262. Picture dst,
  263. int src_x,
  264. int src_y,
  265. int mask_x,
  266. int mask_y,
  267. int dst_x,
  268. int dst_y,
  269. unsigned int width,
  270. unsigned int height);
  271. GlyphSet
  272. XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format);
  273. GlyphSet
  274. XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing);
  275. void
  276. XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
  277. void
  278. XRenderAddGlyphs (Display *dpy,
  279. GlyphSet glyphset,
  280. _Xconst Glyph *gids,
  281. _Xconst XGlyphInfo *glyphs,
  282. int nglyphs,
  283. _Xconst char *images,
  284. int nbyte_images);
  285. void
  286. XRenderFreeGlyphs (Display *dpy,
  287. GlyphSet glyphset,
  288. _Xconst Glyph *gids,
  289. int nglyphs);
  290. void
  291. XRenderCompositeString8 (Display *dpy,
  292. int op,
  293. Picture src,
  294. Picture dst,
  295. _Xconst XRenderPictFormat *maskFormat,
  296. GlyphSet glyphset,
  297. int xSrc,
  298. int ySrc,
  299. int xDst,
  300. int yDst,
  301. _Xconst char *string,
  302. int nchar);
  303. void
  304. XRenderCompositeString16 (Display *dpy,
  305. int op,
  306. Picture src,
  307. Picture dst,
  308. _Xconst XRenderPictFormat *maskFormat,
  309. GlyphSet glyphset,
  310. int xSrc,
  311. int ySrc,
  312. int xDst,
  313. int yDst,
  314. _Xconst unsigned short *string,
  315. int nchar);
  316. void
  317. XRenderCompositeString32 (Display *dpy,
  318. int op,
  319. Picture src,
  320. Picture dst,
  321. _Xconst XRenderPictFormat *maskFormat,
  322. GlyphSet glyphset,
  323. int xSrc,
  324. int ySrc,
  325. int xDst,
  326. int yDst,
  327. _Xconst unsigned int *string,
  328. int nchar);
  329. void
  330. XRenderCompositeText8 (Display *dpy,
  331. int op,
  332. Picture src,
  333. Picture dst,
  334. _Xconst XRenderPictFormat *maskFormat,
  335. int xSrc,
  336. int ySrc,
  337. int xDst,
  338. int yDst,
  339. _Xconst XGlyphElt8 *elts,
  340. int nelt);
  341. void
  342. XRenderCompositeText16 (Display *dpy,
  343. int op,
  344. Picture src,
  345. Picture dst,
  346. _Xconst XRenderPictFormat *maskFormat,
  347. int xSrc,
  348. int ySrc,
  349. int xDst,
  350. int yDst,
  351. _Xconst XGlyphElt16 *elts,
  352. int nelt);
  353. void
  354. XRenderCompositeText32 (Display *dpy,
  355. int op,
  356. Picture src,
  357. Picture dst,
  358. _Xconst XRenderPictFormat *maskFormat,
  359. int xSrc,
  360. int ySrc,
  361. int xDst,
  362. int yDst,
  363. _Xconst XGlyphElt32 *elts,
  364. int nelt);
  365. void
  366. XRenderFillRectangle (Display *dpy,
  367. int op,
  368. Picture dst,
  369. _Xconst XRenderColor *color,
  370. int x,
  371. int y,
  372. unsigned int width,
  373. unsigned int height);
  374. void
  375. XRenderFillRectangles (Display *dpy,
  376. int op,
  377. Picture dst,
  378. _Xconst XRenderColor *color,
  379. _Xconst XRectangle *rectangles,
  380. int n_rects);
  381. void
  382. XRenderCompositeTrapezoids (Display *dpy,
  383. int op,
  384. Picture src,
  385. Picture dst,
  386. _Xconst XRenderPictFormat *maskFormat,
  387. int xSrc,
  388. int ySrc,
  389. _Xconst XTrapezoid *traps,
  390. int ntrap);
  391. void
  392. XRenderCompositeTriangles (Display *dpy,
  393. int op,
  394. Picture src,
  395. Picture dst,
  396. _Xconst XRenderPictFormat *maskFormat,
  397. int xSrc,
  398. int ySrc,
  399. _Xconst XTriangle *triangles,
  400. int ntriangle);
  401. void
  402. XRenderCompositeTriStrip (Display *dpy,
  403. int op,
  404. Picture src,
  405. Picture dst,
  406. _Xconst XRenderPictFormat *maskFormat,
  407. int xSrc,
  408. int ySrc,
  409. _Xconst XPointFixed *points,
  410. int npoint);
  411. void
  412. XRenderCompositeTriFan (Display *dpy,
  413. int op,
  414. Picture src,
  415. Picture dst,
  416. _Xconst XRenderPictFormat *maskFormat,
  417. int xSrc,
  418. int ySrc,
  419. _Xconst XPointFixed *points,
  420. int npoint);
  421. void
  422. XRenderCompositeDoublePoly (Display *dpy,
  423. int op,
  424. Picture src,
  425. Picture dst,
  426. _Xconst XRenderPictFormat *maskFormat,
  427. int xSrc,
  428. int ySrc,
  429. int xDst,
  430. int yDst,
  431. _Xconst XPointDouble *fpoints,
  432. int npoints,
  433. int winding);
  434. Status
  435. XRenderParseColor(Display *dpy,
  436. char *spec,
  437. XRenderColor *def);
  438. Cursor
  439. XRenderCreateCursor (Display *dpy,
  440. Picture source,
  441. unsigned int x,
  442. unsigned int y);
  443. XFilters *
  444. XRenderQueryFilters (Display *dpy, Drawable drawable);
  445. void
  446. XRenderSetPictureFilter (Display *dpy,
  447. Picture picture,
  448. char *filter,
  449. XFixed *params,
  450. int nparams);
  451. Cursor
  452. XRenderCreateAnimCursor (Display *dpy,
  453. int ncursor,
  454. XAnimCursor *cursors);
  455. void
  456. XRenderAddTraps (Display *dpy,
  457. Picture picture,
  458. int xOff,
  459. int yOff,
  460. _Xconst XTrap *traps,
  461. int ntrap);
  462. Picture XRenderCreateSolidFill (Display *dpy,
  463. const XRenderColor *color);
  464. Picture XRenderCreateLinearGradient (Display *dpy,
  465. const XLinearGradient *gradient,
  466. const XFixed *stops,
  467. const XRenderColor *colors,
  468. int nstops);
  469. Picture XRenderCreateRadialGradient (Display *dpy,
  470. const XRadialGradient *gradient,
  471. const XFixed *stops,
  472. const XRenderColor *colors,
  473. int nstops);
  474. Picture XRenderCreateConicalGradient (Display *dpy,
  475. const XConicalGradient *gradient,
  476. const XFixed *stops,
  477. const XRenderColor *colors,
  478. int nstops);