Xrender.h 13 KB

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