PageRenderTime 47ms CodeModel.GetById 14ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

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