The OpenD Programming Language

1 /**
2  * Cairo C API. Contains stuff from cairo.h and cairo-version.h
3  *
4  * This module only contains basic documentation. For more information
5  * see $(LINK http://cairographics.org/manual/)
6  *
7  * License:
8  * $(TABLE
9  *   $(TR $(TD cairoD wrapper/bindings)
10  *     $(TD $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)))
11  *   $(TR $(TD $(LINK2 http://cgit.freedesktop.org/cairo/tree/COPYING, _cairo))
12  *     $(TD $(LINK2 http://cgit.freedesktop.org/cairo/tree/COPYING-LGPL-2.1, LGPL 2.1) /
13  *     $(LINK2 http://cgit.freedesktop.org/cairo/plain/COPYING-MPL-1.1, MPL 1.1)))
14  * )
15  * Authors:
16  * $(TABLE
17  *   $(TR $(TD Johannes Pfau) $(TD cairoD))
18  *   $(TR $(TD $(LINK2 http://cairographics.org, _cairo team)) $(TD _cairo))
19  * )
20  */
21 /*
22  * Distributed under the Boost Software License, Version 1.0.
23  *    (See accompanying file LICENSE_1_0.txt or copy at
24  *          http://www.boost.org/LICENSE_1_0.txt)
25  */
26 module cairo.c.cairo;
27 
28 import std.conv;
29 public import cairo.c.config;
30 
31 /**
32  * Cairo binding version. Use the cairo_version() function to get
33  * version information about the cairo library.
34  */
35 enum CAIRO_VERSION_MAJOR = 1;
36 ///ditto
37 enum CAIRO_VERSION_MINOR = 10;
38 ///ditto
39 enum CAIRO_VERSION_MICRO = 2;
40 
41 ///
42 ulong CAIRO_VERSION_ENCODE(uint major, uint minor, uint micro)
43 {
44     return (major * 10000) + (minor * 100) + (micro);
45 }
46 
47 ///Encoded cairo binding version
48 enum ulong CAIRO_VERSION = CAIRO_VERSION_ENCODE(CAIRO_VERSION_MAJOR,
49     CAIRO_VERSION_MINOR, CAIRO_VERSION_MICRO);
50 
51 ///
52 string CAIRO_VERSION_STRINGIZE(uint major, uint minor, uint micro)
53 {
54     return to!string(major) ~ "." ~ to!string(minor) ~ "." ~ to!string(micro);
55 }
56 
57 ///Cairo binding version string
58 string CAIRO_VERSION_STRING = CAIRO_VERSION_STRINGIZE(CAIRO_VERSION_MAJOR,
59     CAIRO_VERSION_MINOR, CAIRO_VERSION_MICRO);
60 
61 
62 extern(C)
63 {
64     ///Encoded library version
65     int cairo_version();
66 
67     ///Library version string
68     immutable(char)* cairo_version_string();
69 
70     /**
71      * cairo_bool_t is used for boolean values. Returns of type
72      * cairo_bool_t will always be either 0 or 1, but testing against
73      * these values explicitly is not encouraged; just use the
74      * value as a boolean condition.
75      *
76      * Examples:
77      * ----------------------------------------
78      *  if (cairo_in_stroke (cr, x, y)) {
79      *      //do something
80      *  }
81      * ----------------------------------------
82      **/
83     alias int cairo_bool_t;
84 
85     /**
86      * A cairo_t contains the current state of the rendering device,
87      * including coordinates of yet to be drawn shapes.
88      *
89      * Cairo contexts, as cairo_t objects are named, are central to
90      * cairo and all drawing with cairo is always done to a cairo_t
91      * object.
92      *
93      * Memory management of cairo_t is done with
94      * cairo_reference() and cairo_destroy().
95      **/
96     struct cairo_t {};
97 
98     /**
99      * A cairo_surface_t represents an image, either as the destination
100      * of a drawing operation or as source when drawing onto another
101      * surface.  To draw to a cairo_surface_t, create a cairo context
102      * with the surface as the target, using cairo_create().
103      *
104      * There are different subtypes of cairo_surface_t for
105      * different drawing backends; for example, cairo_image_surface_create()
106      * creates a bitmap image in memory.
107      * The type of a surface can be queried with cairo_surface_get_type().
108      *
109      * The initial contents of a surface after creation depend upon the manner
110      * of its creation. If cairo creates the surface and backing storage for
111      * the user, it will be initially cleared; for example,
112      * cairo_image_surface_create() and cairo_surface_create_similar().
113      * Alternatively, if the user passes in a reference to some backing storage
114      * and asks cairo to wrap that in a cairo_surface_t, then the contents are
115      * not modified; for example, cairo_image_surface_create_for_data() and
116      * cairo_xlib_surface_create().
117      *
118      * Memory management of cairo_surface_t is done with
119      * cairo_surface_reference() and cairo_surface_destroy().
120      **/
121     struct cairo_surface_t {};
122 
123     /**
124      * A cairo_device_t represents the driver interface for drawing
125      * operations to a cairo_surface_t.  There are different subtypes of
126      * cairo_device_t for different drawing backends; for example,
127      * cairo_xcb_device_create() creates a device that wraps the connection
128      * to an X Windows System using the XCB library.
129      *
130      * The type of a device can be queried with cairo_device_get_type().
131      *
132      * Memory management of cairo_device_t is done with
133      * cairo_device_reference() and cairo_device_destroy().
134      *
135      * Since: 1.10
136      **/
137     struct cairo_device_t {};
138 
139     /**
140      * A $(D cairo_matrix_t) holds an affine transformation, such as a scale,
141      * rotation, shear, or a combination of those. The transformation of
142      * a point (x, y) is given by:
143      * --------------------------------------
144      *     x_new = xx * x + xy * y + x0;
145      *     y_new = yx * x + yy * y + y0;
146      * --------------------------------------
147      **/
148     struct cairo_matrix_t
149     {
150         double xx; ///xx component of the affine transformation
151         double yx; ///yx component of the affine transformation
152         double xy; ///xy component of the affine transformation
153         double yy; ///yy component of the affine transformation
154         double x0; ///X translation component of the affine transformation
155         double y0; ///Y translation component of the affine transformation
156     }
157 
158     /**
159      * A $(D cairo_pattern_t) represents a source when drawing onto a
160      * surface. There are different subtypes of $(D cairo_pattern_t),
161      * for different types of sources; for example,
162      * $(D cairo_pattern_create_rgb()) creates a pattern for a solid
163      * opaque color.
164      *
165      * Other than various cairo_pattern_create_$(B type)()
166      * functions, some of the pattern types can be implicitly created
167      * using various cairo_set_source_$(B type)() functions;
168      * for example cairo_set_source_rgb().
169      *
170      * The type of a pattern can be queried with cairo_pattern_get_type().
171      *
172      * Memory management of $(D cairo_pattern_t) is done with
173      * cairo_pattern_reference() and cairo_pattern_destroy().
174      **/
175     struct cairo_pattern_t {};
176 
177     /**
178      * $(D cairo_destroy_func_t) the type of function which is called when a
179      * data element is destroyed. It is passed the pointer to the data
180      * element and should free any memory and resources allocated for it.
181      *
182      * Params:
183      * data = The data element being destroyed.
184      **/
185     alias extern(C) void function(void* data) cairo_destroy_func_t;
186 
187     /**
188      * $(D cairo_user_data_key_t) is used for attaching user data to cairo
189      * data structures.  The actual contents of the struct is never used,
190      * and there is no need to initialize the object; only the unique
191      * address of a $(D cairo_data_key_t) object is used.  Typically, you
192      * would just use the address of a static $(D cairo_data_key_t) object.
193      **/
194     struct cairo_user_data_key_t
195     {
196         ///not used; ignore.
197         int unused;
198     }
199 
200     /**
201 
202      * $(D cairo_status_t) is used to indicate errors that can occur when
203      * using Cairo. In some cases it is returned directly by functions.
204      * but when using $(D cairo_t), the last error, if any, is stored in
205      * the context and can be retrieved with cairo_status().
206      *
207      * New entries may be added in future versions.  Use cairo_status_to_string()
208      * to get a human-readable representation of an error message.
209      **/
210     enum cairo_status_t
211     {
212         CAIRO_STATUS_SUCCESS = 0, ///no error has occurred
213 
214         CAIRO_STATUS_NO_MEMORY, ///out of memory
215         CAIRO_STATUS_INVALID_RESTORE, ///cairo_restore() called without matching cairo_save()
216         CAIRO_STATUS_INVALID_POP_GROUP, ///no saved group to pop, i.e. cairo_pop_group() without matching cairo_push_group()
217         CAIRO_STATUS_NO_CURRENT_POINT, ///no current point defined
218         CAIRO_STATUS_INVALID_MATRIX, ///invalid matrix (not invertible)
219         CAIRO_STATUS_INVALID_STATUS, ///invalid value for an input $(D cairo_status_t)
220         CAIRO_STATUS_NULL_POINTER, ///$(D null) pointer
221         CAIRO_STATUS_INVALID_STRING, ///input string not valid UTF-8
222         CAIRO_STATUS_INVALID_PATH_DATA, ///input path data not valid
223         CAIRO_STATUS_READ_ERROR, ///error while reading from input stream
224         CAIRO_STATUS_WRITE_ERROR, ///error while writing to output stream
225         CAIRO_STATUS_SURFACE_FINISHED, ///target surface has been finished
226         CAIRO_STATUS_SURFACE_TYPE_MISMATCH, ///the surface type is not appropriate for the operation
227         CAIRO_STATUS_PATTERN_TYPE_MISMATCH, ///the pattern type is not appropriate for the operation
228         CAIRO_STATUS_INVALID_CONTENT, ///invalid value for an input $(D cairo_content_t)
229         CAIRO_STATUS_INVALID_FORMAT, ///invalid value for an input $(D cairo_format_t)
230         CAIRO_STATUS_INVALID_VISUAL, ///invalid value for an input Visual*
231         CAIRO_STATUS_FILE_NOT_FOUND, ///file not found
232         CAIRO_STATUS_INVALID_DASH, ///invalid value for a dash setting
233         CAIRO_STATUS_INVALID_DSC_COMMENT, ///invalid value for a DSC comment (Since 1.2)
234         CAIRO_STATUS_INVALID_INDEX, ///invalid index passed to getter (Since 1.4)
235         CAIRO_STATUS_CLIP_NOT_REPRESENTABLE, ///clip region not representable in desired format (Since 1.4)
236         CAIRO_STATUS_TEMP_FILE_ERROR, ///error creating or writing to a temporary file (Since 1.6)
237         CAIRO_STATUS_INVALID_STRIDE, ///invalid value for stride (Since 1.6)
238         CAIRO_STATUS_FONT_TYPE_MISMATCH, ///the font type is not appropriate for the operation (Since 1.8)
239         CAIRO_STATUS_USER_FONT_IMMUTABLE, ///the user-font is immutable (Since 1.8)
240         CAIRO_STATUS_USER_FONT_ERROR, ///error occurred in a user-font callback function (Since 1.8)
241         CAIRO_STATUS_NEGATIVE_COUNT, ///negative number used where it is not allowed (Since 1.8)
242         CAIRO_STATUS_INVALID_CLUSTERS, ///input clusters do not represent the accompanying text and glyph array (Since 1.8)
243         CAIRO_STATUS_INVALID_SLANT, ///invalid value for an input $(D cairo_font_slant_t) (Since 1.8)
244         CAIRO_STATUS_INVALID_WEIGHT, ///invalid value for an input $(D cairo_font_weight_t) (Since 1.8)
245         CAIRO_STATUS_INVALID_SIZE, ///invalid value (typically too big) for the size of the input (surface, pattern, etc.) (Since 1.10)
246         CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, ///user-font method not implemented (Since 1.10)
247         CAIRO_STATUS_DEVICE_TYPE_MISMATCH, ///the device type is not appropriate for the operation (Since 1.10)
248         CAIRO_STATUS_DEVICE_ERROR, ///an operation to the device caused an unspecified error (Since 1.10)
249         /**
250          * this is a special value indicating the number of
251          * status values defined in this enumeration.  When using this value, note
252          * that the version of cairo at run-time may have additional status values
253          * defined than the value of this symbol at compile-time. (Since 1.10)
254          */
255         CAIRO_STATUS_LAST_STATUS
256     }
257 
258     /**
259      * $(D cairo_content_t) is used to describe the content that a surface will
260      * contain, whether color information, alpha information (translucence
261      * vs. opacity), or both.
262      *
263      * Note: The large values here are designed to keep $(D cairo_content_t)
264      * values distinct from $(D cairo_format_t) values so that the
265      * implementation can detect the error if users confuse the two types.
266      **/
267     enum cairo_content_t
268     {
269         CAIRO_CONTENT_COLOR = 0x1000, ///The surface will hold color content only.
270         CAIRO_CONTENT_ALPHA = 0x2000, ///The surface will hold alpha content only.
271         CAIRO_CONTENT_COLOR_ALPHA = 0x3000 ///The surface will hold color and alpha content.
272     }
273 
274     /**
275      * $(D cairo_write_func_t) is the type of function which is called when a
276      * backend needs to write data to an output stream.  It is passed the
277      * closure which was specified by the user at the time the write
278      * function was registered, the data to write and the length of the
279      * data in bytes.  The write function should return
280      * $(D CAIRO_STATUS_SUCCESS) if all the data was successfully written,
281      * $(D CAIRO_STATUS_WRITE_ERROR) otherwise.
282      *
283      * Params:
284      * closure = the output closure
285      * data = the buffer containing the data to write
286      * length = the amount of data to write
287      *
288      * Returns: the status code of the write operation
289      **/
290     alias extern(C) cairo_status_t function(void* closure, const ubyte* data, uint length) cairo_write_func_t;
291 
292     /**
293      * $(D cairo_read_func_t) is the type of function which is called when a
294      * backend needs to read data from an input stream.  It is passed the
295      * closure which was specified by the user at the time the read
296      * function was registered, the buffer to read the data into and the
297      * length of the data in bytes.  The read function should return
298      * $(D CAIRO_STATUS_SUCCESS) if all the data was successfully read,
299      * $(D CAIRO_STATUS_READ_ERROR) otherwise.
300      *
301      * Params:
302      * closure = the input closure
303      * data = the buffer into which to read the data
304      * length = the amount of data to read
305      *
306      * Returns: the status code of the read operation
307      **/
308     alias extern(C) cairo_status_t function(void* closure, ubyte* data, uint length) cairo_read_func_t;
309 
310      /** Functions for manipulating state objects */
311      cairo_t* cairo_create(cairo_surface_t* target);
312      ///ditto
313      cairo_t* cairo_reference(cairo_t* cr);
314      ///ditto
315      void cairo_destroy(cairo_t* cr);
316      ///ditto
317      uint cairo_get_reference_count(cairo_t* cr);
318      ///ditto
319      void* cairo_get_user_data(cairo_t* cr, const cairo_user_data_key_t* key);
320      ///ditto
321      cairo_status_t cairo_set_user_data (cairo_t* cr, const cairo_user_data_key_t* key,
322         void* user_data,
323         cairo_destroy_func_t destroy);
324      ///ditto
325      void cairo_save(cairo_t* cr);
326      ///ditto
327      void cairo_restore(cairo_t* cr);
328      ///ditto
329      void cairo_push_group(cairo_t* cr);
330      ///ditto
331      void cairo_push_group_with_content(cairo_t* cr, cairo_content_t content);
332      ///ditto
333      cairo_pattern_t* cairo_pop_group(cairo_t* cr);
334      ///ditto
335      void cairo_pop_group_to_source(cairo_t* cr);
336 
337     /* Modify state */
338 
339     /**
340      * $(D cairo_operator_t) is used to set the compositing operator for all cairo
341      * drawing operations.
342      *
343      * The default operator is $(D CAIRO_OPERATOR_OVER).
344      *
345      * The operators marked as $(I unbounded) modify their
346      * destination even outside of the mask layer (that is, their effect is not
347      * bound by the mask layer).  However, their effect can still be limited by
348      * way of clipping.
349      *
350      * To keep things simple, the operator descriptions here
351      * document the behavior for when both source and destination are either fully
352      * transparent or fully opaque.  The actual implementation works for
353      * translucent layers too.
354      * For a more detailed explanation of the effects of each operator, including
355      * the mathematical definitions, see
356      * $(LINK http://cairographics.org/operators/).
357      **/
358     enum cairo_operator_t
359     {
360         CAIRO_OPERATOR_CLEAR,///clear destination layer (bounded)
361 
362         CAIRO_OPERATOR_SOURCE,///replace destination layer (bounded)
363         CAIRO_OPERATOR_OVER,///draw source layer on top of destination layer (bounded)
364         CAIRO_OPERATOR_IN,///draw source where there was destination content (unbounded)
365         CAIRO_OPERATOR_OUT,///draw source where there was no destination content (unbounded)
366         CAIRO_OPERATOR_ATOP,///draw source on top of destination content and only there
367 
368         CAIRO_OPERATOR_DEST,///ignore the source
369         CAIRO_OPERATOR_DEST_OVER,///draw destination on top of source
370         CAIRO_OPERATOR_DEST_IN,///leave destination only where there was source content (unbounded)
371         CAIRO_OPERATOR_DEST_OUT,///leave destination only where there was no source content
372         CAIRO_OPERATOR_DEST_ATOP,///leave destination on top of source content and only there (unbounded)
373 
374         CAIRO_OPERATOR_XOR,///source and destination are shown where there is only one of them
375         CAIRO_OPERATOR_ADD,///source and destination layers are accumulated
376         CAIRO_OPERATOR_SATURATE,///like over, but assuming source and dest are disjoint geometries
377 
378         CAIRO_OPERATOR_MULTIPLY,///source and destination layers are multiplied. This causes the result to be at least as dark as the darker inputs.
379         CAIRO_OPERATOR_SCREEN,///source and destination are complemented and multiplied. This causes the result to be at least as light as the lighter inputs.
380         CAIRO_OPERATOR_OVERLAY,///multiplies or screens, depending on the lightness of the destination color.
381         CAIRO_OPERATOR_DARKEN,///replaces the destination with the source if it is darker, otherwise keeps the source.
382         CAIRO_OPERATOR_LIGHTEN,///replaces the destination with the source if it is lighter, otherwise keeps the source.
383         CAIRO_OPERATOR_COLOR_DODGE,///brightens the destination color to reflect the source color.
384         CAIRO_OPERATOR_COLOR_BURN,///darkens the destination color to reflect the source color.
385         CAIRO_OPERATOR_HARD_LIGHT,///Multiplies or screens, dependant on source color.
386         CAIRO_OPERATOR_SOFT_LIGHT,///Darkens or lightens, dependant on source color.
387         CAIRO_OPERATOR_DIFFERENCE,///Takes the difference of the source and destination color.
388         CAIRO_OPERATOR_EXCLUSION,///Produces an effect similar to difference, but with lower contrast.
389         CAIRO_OPERATOR_HSL_HUE,///Creates a color with the hue of the source and the saturation and luminosity of the target.
390         CAIRO_OPERATOR_HSL_SATURATION,///Creates a color with the saturation of the source and the hue and luminosity of the target. Painting with this mode onto a gray area prduces no change.
391         /**
392          * Creates a color with the hue and saturation
393          * of the source and the luminosity of the target. This preserves the gray
394          * levels of the target and is useful for coloring monochrome images or
395          * tinting color images.
396          */
397         CAIRO_OPERATOR_HSL_COLOR,
398         /**
399          * Creates a color with the luminosity of
400          * the source and the hue and saturation of the target. This produces an
401          * inverse effect to $(D CAIRO_OPERATOR_HSL_COLOR).
402          */
403         CAIRO_OPERATOR_HSL_LUMINOSITY
404     }
405      /** Modify state */
406      void cairo_set_operator(cairo_t* cr, cairo_operator_t op);
407      ///ditto
408      void cairo_set_source (cairo_t* cr, cairo_pattern_t* source);
409      ///ditto
410      void cairo_set_source_rgb(cairo_t* cr, double red, double green, double blue);
411      ///ditto
412      void
413     cairo_set_source_rgba (cairo_t* cr,
414                    double red, double green, double blue,
415                    double alpha);
416      ///ditto
417      void
418     cairo_set_source_surface (cairo_t* cr,
419                   cairo_surface_t* surface,
420                   double	   x,
421                   double	   y);
422      ///ditto
423      void
424     cairo_set_tolerance (cairo_t* cr, double tolerance);
425 
426     /**
427      * Specifies the type of antialiasing to do when rendering text or shapes.
428      **/
429     enum cairo_antialias_t
430     {
431         CAIRO_ANTIALIAS_DEFAULT, ///Use the default antialiasing for the subsystem and target device
432         CAIRO_ANTIALIAS_NONE, ///Use a bilevel alpha mask
433         /**
434          * Perform single-color antialiasing (using
435          * shades of gray for black text on a white background, for example).
436          */
437         CAIRO_ANTIALIAS_GRAY,
438         /**
439          * Perform antialiasing by taking
440          * advantage of the order of subpixel elements on devices
441          * such as LCD panels
442          */
443         CAIRO_ANTIALIAS_SUBPIXEL
444     }
445     ///
446      void
447     cairo_set_antialias (cairo_t* cr, cairo_antialias_t antialias);
448 
449     /**
450      * $(D cairo_fill_rule_t) is used to select how paths are filled. For both
451      * fill rules, whether or not a point is included in the fill is
452      * determined by taking a ray from that point to infinity and looking
453      * at intersections with the path. The ray can be in any direction,
454      * as long as it doesn't pass through the end point of a segment
455      * or have a tricky intersection such as intersecting tangent to the path.
456      * (Note that filling is not actually implemented in this way. This
457      * is just a description of the rule that is applied.)
458      *
459      * The default fill rule is $(D CAIRO_FILL_RULE_WINDING).
460      *
461      * New entries may be added in future versions.
462      **/
463     enum cairo_fill_rule_t
464     {
465         /**
466          * If the path crosses the ray from
467          * left-to-right, counts +1. If the path crosses the ray
468          * from right to left, counts -1. (Left and right are determined
469          * from the perspective of looking along the ray from the starting
470          * point.) If the total count is non-zero, the point will be filled.
471          */
472         CAIRO_FILL_RULE_WINDING,
473         /**
474          * Counts the total number of
475          * intersections, without regard to the orientation of the contour. If
476          * the total number of intersections is odd, the point will be
477          * filled.
478          */
479         CAIRO_FILL_RULE_EVEN_ODD
480     }
481     ///
482      void
483     cairo_set_fill_rule (cairo_t* cr, cairo_fill_rule_t fill_rule);
484     ///
485      void
486     cairo_set_line_width (cairo_t* cr, double width);
487 
488     /**
489      * Specifies how to render the endpoints of the path when stroking.
490      *
491      * The default line cap style is $(D CAIRO_LINE_CAP_BUTT).
492      **/
493     enum cairo_line_cap_t
494     {
495         CAIRO_LINE_CAP_BUTT, ///start(stop) the line exactly at the start(end) point
496         CAIRO_LINE_CAP_ROUND, ///use a round ending, the center of the circle is the end point
497         CAIRO_LINE_CAP_SQUARE ///use squared ending, the center of the square is the end point
498     }
499     ///
500      void
501     cairo_set_line_cap (cairo_t* cr, cairo_line_cap_t line_cap);
502 
503     /**
504      * Specifies how to render the junction of two lines when stroking.
505      *
506      * The default line join style is $(D CAIRO_LINE_JOIN_MITER).
507      **/
508     enum cairo_line_join_t
509     {
510         CAIRO_LINE_JOIN_MITER, ///use a sharp (angled) corner, see cairo_set_miter_limit()
511         /**
512          * use a rounded join, the center of the circle is the
513          * joint point
514          */
515         CAIRO_LINE_JOIN_ROUND,
516         /**
517          * use a cut-off join, the join is cut off at half
518          * the line width from the joint point
519          */
520         CAIRO_LINE_JOIN_BEVEL
521     }
522     ///
523      void
524     cairo_set_line_join (cairo_t* cr, cairo_line_join_t line_join);
525     ///
526      void
527     cairo_set_dash (cairo_t      *cr,
528             const double *dashes,
529             int	      num_dashes,
530             double	      offset);
531     ///
532      void
533     cairo_set_miter_limit (cairo_t* cr, double limit);
534     ///
535      void
536     cairo_translate (cairo_t* cr, double tx, double ty);
537     ///
538      void
539     cairo_scale (cairo_t* cr, double sx, double sy);
540     ///
541      void
542     cairo_rotate (cairo_t* cr, double angle);
543     ///
544      void
545     cairo_transform (cairo_t	      *cr,
546              const cairo_matrix_t *matrix);
547     ///
548      void
549     cairo_set_matrix (cairo_t	       *cr,
550               const cairo_matrix_t *matrix);
551     ///
552      void
553     cairo_identity_matrix (cairo_t* cr);
554     ///
555      void
556     cairo_user_to_device (cairo_t* cr, double *x, double *y);
557     ///
558      void
559     cairo_user_to_device_distance (cairo_t* cr, double *dx, double *dy);
560     ///
561      void
562     cairo_device_to_user (cairo_t* cr, double *x, double *y);
563     ///
564      void
565     cairo_device_to_user_distance (cairo_t* cr, double *dx, double *dy);
566 
567     /** Path creation functions */
568      void
569     cairo_new_path (cairo_t* cr);
570     ///ditto
571      void
572     cairo_move_to (cairo_t* cr, double x, double y);
573     ///ditto
574      void
575     cairo_new_sub_path (cairo_t* cr);
576     ///ditto
577      void
578     cairo_line_to (cairo_t* cr, double x, double y);
579     ///ditto
580      void
581     cairo_curve_to (cairo_t* cr,
582             double x1, double y1,
583             double x2, double y2,
584             double x3, double y3);
585     ///ditto
586      void
587     cairo_arc (cairo_t* cr,
588            double xc, double yc,
589            double radius,
590            double angle1, double angle2);
591     ///ditto
592      void
593     cairo_arc_negative (cairo_t* cr,
594                 double xc, double yc,
595                 double radius,
596                 double angle1, double angle2);
597 
598     /* XXX: NYI
599      void
600     cairo_arc_to (cairo_t* cr,
601               double x1, double y1,
602               double x2, double y2,
603               double radius);
604     */
605     ///ditto
606      void
607     cairo_rel_move_to (cairo_t* cr, double dx, double dy);
608     ///ditto
609      void
610     cairo_rel_line_to (cairo_t* cr, double dx, double dy);
611     ///ditto
612      void
613     cairo_rel_curve_to (cairo_t* cr,
614                 double dx1, double dy1,
615                 double dx2, double dy2,
616                 double dx3, double dy3);
617     ///ditto
618      void
619     cairo_rectangle (cairo_t* cr,
620              double x, double y,
621              double width, double height);
622 
623     /* XXX: NYI
624      void
625     cairo_stroke_to_path (cairo_t* cr);
626     */
627     ///ditto
628      void
629     cairo_close_path (cairo_t* cr);
630     ///ditto
631      void
632     cairo_path_extents (cairo_t* cr,
633                 double *x1, double *y1,
634                 double *x2, double *y2);
635 
636     /** Painting functions */
637      void
638     cairo_paint (cairo_t* cr);
639     ///ditto
640      void
641     cairo_paint_with_alpha (cairo_t* cr,
642                 double   alpha);
643     ///ditto
644      void
645     cairo_mask (cairo_t         *cr,
646             cairo_pattern_t *pattern);
647     ///ditto
648      void
649     cairo_mask_surface (cairo_t         *cr,
650                 cairo_surface_t *surface,
651                 double           surface_x,
652                 double           surface_y);
653     ///ditto
654      void
655     cairo_stroke (cairo_t* cr);
656     ///ditto
657      void
658     cairo_stroke_preserve (cairo_t* cr);
659     ///ditto
660      void
661     cairo_fill (cairo_t* cr);
662     ///ditto
663      void
664     cairo_fill_preserve (cairo_t* cr);
665     ///ditto
666      void
667     cairo_copy_page (cairo_t* cr);
668     ///ditto
669      void
670     cairo_show_page (cairo_t* cr);
671 
672     /** Insideness testing */
673      cairo_bool_t
674     cairo_in_stroke (cairo_t* cr, double x, double y);
675     ///ditto
676      cairo_bool_t
677     cairo_in_fill (cairo_t* cr, double x, double y);
678     ///ditto
679      cairo_bool_t
680     cairo_in_clip (cairo_t* cr, double x, double y);
681 
682     /** Rectangular extents */
683      void
684     cairo_stroke_extents (cairo_t* cr,
685                   double *x1, double *y1,
686                   double *x2, double *y2);
687     ///ditto
688      void
689     cairo_fill_extents (cairo_t* cr,
690                 double *x1, double *y1,
691                 double *x2, double *y2);
692 
693     /** Clipping */
694      void
695     cairo_reset_clip (cairo_t* cr);
696     ///ditto
697      void
698     cairo_clip (cairo_t* cr);
699     ///ditto
700      void
701     cairo_clip_preserve (cairo_t* cr);
702     ///ditto
703      void
704     cairo_clip_extents (cairo_t* cr,
705                 double *x1, double *y1,
706                 double *x2, double *y2);
707 
708     /**
709      * A data structure for holding a rectangle.
710      *
711      * Since: 1.4
712      **/
713     struct cairo_rectangle_t
714     {
715         double x; ///X coordinate of the left side of the rectangle
716         double y; ///Y coordinate of the the top side of the rectangle
717         double width; ///width of the rectangle
718         double height; ///height of the rectangle
719     }
720 
721     /**
722      * A data structure for holding a dynamically allocated
723      * array of rectangles.
724      *
725      * Since: 1.4
726      **/
727     struct cairo_rectangle_list_t
728     {
729         cairo_status_t     status; ///Error status of the rectangle list
730         cairo_rectangle_t *rectangles; ///Array containing the rectangles
731         int                num_rectangles; ///Number of rectangles in this list
732     }
733     ///
734      cairo_rectangle_list_t *
735     cairo_copy_clip_rectangle_list (cairo_t* cr);
736     ///
737      void
738     cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list);
739 
740     /* Font/Text functions */
741 
742     /**
743      * A $(D cairo_scaled_font_t) is a font scaled to a particular size and device
744      * resolution. A $(D cairo_scaled_font_t) is most useful for low-level font
745      * usage where a library or application wants to cache a reference
746      * to a scaled font to speed up the computation of metrics.
747      *
748      * There are various types of scaled fonts, depending on the
749      * $(I font backend) they use. The type of a
750      * scaled font can be queried using cairo_scaled_font_get_type().
751      *
752      * Memory management of $(D cairo_scaled_font_t) is done with
753      * cairo_scaled_font_reference() and cairo_scaled_font_destroy().
754      **/
755     struct cairo_scaled_font_t {};
756 
757     /**
758      * A $(D cairo_font_face_t) specifies all aspects of a font other
759      * than the size or font matrix (a font matrix is used to distort
760      * a font by sheering it or scaling it unequally in the two
761      * directions) . A font face can be set on a $(D cairo_t) by using
762      * cairo_set_font_face(); the size and font matrix are set with
763      * cairo_set_font_size() and cairo_set_font_matrix().
764      *
765      * There are various types of font faces, depending on the
766      * $(I font backend) they use. The type of a
767      * font face can be queried using cairo_font_face_get_type().
768      *
769      * Memory management of $(D cairo_font_face_t) is done with
770      * cairo_font_face_reference() and cairo_font_face_destroy().
771      **/
772     struct cairo_font_face_t {};
773 
774     /**
775      * The $(D cairo_glyph_t) structure holds information about a single glyph
776      * when drawing or measuring text. A font is (in simple terms) a
777      * collection of shapes used to draw text. A glyph is one of these
778      * shapes. There can be multiple glyphs for a single character
779      * (alternates to be used in different contexts, for example), or a
780      * glyph can be a $(I ligature) of multiple
781      * characters. Cairo doesn't expose any way of converting input text
782      * into glyphs, so in order to use the Cairo interfaces that take
783      * arrays of glyphs, you must directly access the appropriate
784      * underlying font system.
785      *
786      * Note that the offsets given by $(D x) and $(D y) are not cumulative. When
787      * drawing or measuring text, each glyph is individually positioned
788      * with respect to the overall origin
789      **/
790     struct cairo_glyph_t
791     {
792         /**
793          * glyph index in the font. The exact interpretation of the
794          * glyph index depends on the font technology being used.
795          */
796         ulong        index;
797         /**
798          * the offset in the X direction between the origin used for
799          * drawing or measuring the string and the origin of this glyph.
800          */
801         double               x;
802         /**
803          * the offset in the Y direction between the origin used for
804          * drawing or measuring the string and the origin of this glyph.
805          */
806         double               y;
807     }
808     ///
809      cairo_glyph_t *
810     cairo_glyph_allocate (int num_glyphs);
811     ///
812      void
813     cairo_glyph_free (cairo_glyph_t *glyphs);
814 
815     /**
816      * The $(D cairo_text_cluster_t) structure holds information about a single
817      * $(I text cluster).  A text cluster is a minimal
818      * mapping of some glyphs corresponding to some UTF-8 text.
819      *
820      * For a cluster to be valid, both $(D num_bytes) and $(D num_glyphs) should
821      * be non-negative, and at least one should be non-zero.
822      * Note that clusters with zero glyphs are not as well supported as
823      * normal clusters.  For example, PDF rendering applications typically
824      * ignore those clusters when PDF text is being selected.
825      *
826      * See cairo_show_text_glyphs() for how clusters are used in advanced
827      * text operations.
828      *
829      * Since: 1.8
830      **/
831     struct cairo_text_cluster_t
832     {
833         int        num_bytes; ///the number of bytes of UTF-8 text covered by cluster
834         int        num_glyphs; ///the number of glyphs covered by cluster
835     }
836     ///
837      cairo_text_cluster_t *
838     cairo_text_cluster_allocate (int num_clusters);
839     ///
840      void
841     cairo_text_cluster_free (cairo_text_cluster_t *clusters);
842 
843     /**
844      * Specifies properties of a text cluster mapping.
845      *
846      * Since: 1.8
847      **/
848     enum cairo_text_cluster_flags_t
849     {
850         /**
851          * The clusters in the cluster array
852          * map to glyphs in the glyph array from end to start.
853          */
854         CAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001
855     }
856 
857     /**
858      * The $(D cairo_text_extents_t) structure stores the extents of a single
859      * glyph or a string of glyphs in user-space coordinates. Because text
860      * extents are in user-space coordinates, they are mostly, but not
861      * entirely, independent of the current transformation matrix. If you call
862      * $(D cairo_scale(cr, 2.0, 2.0)), text will
863      * be drawn twice as big, but the reported text extents will not be
864      * doubled. They will change slightly due to hinting (so you can't
865      * assume that metrics are independent of the transformation matrix),
866      * but otherwise will remain unchanged.
867      **/
868     struct cairo_text_extents_t
869     {
870         /**
871          * the horizontal distance from the origin to the
872          * leftmost part of the glyphs as drawn. Positive if the
873          * glyphs lie entirely to the right of the origin.
874          */
875         double x_bearing;
876         /**
877          * the vertical distance from the origin to the
878          * topmost part of the glyphs as drawn. Positive only if the
879          * glyphs lie completely below the origin; will usually be
880          * negative.
881          */
882         double y_bearing;
883         /**
884          * width of the glyphs as drawn
885          */
886         double width;
887         /**
888          * height of the glyphs as drawn
889          */
890         double height;
891         /**
892          * distance to advance in the X direction
893          * after drawing these glyphs
894          */
895         double x_advance;
896         /**
897          * distance to advance in the Y direction
898          * after drawing these glyphs. Will typically be zero except
899          * for vertical text layout as found in East-Asian languages.
900          */
901         double y_advance;
902     }
903 
904     /**
905      * The $(D cairo_font_extents_t) structure stores metric information for
906      * a font. Values are given in the current user-space coordinate
907      * system.
908      *
909      * Because font metrics are in user-space coordinates, they are
910      * mostly, but not entirely, independent of the current transformation
911      * matrix. If you call $(D cairo_scale(cr, 2.0, 2.0)),
912      * text will be drawn twice as big, but the reported text extents will
913      * not be doubled. They will change slightly due to hinting (so you
914      * can't assume that metrics are independent of the transformation
915      * matrix), but otherwise will remain unchanged.
916      **/
917     struct cairo_font_extents_t
918     {
919         /**
920          * the distance that the font extends above the baseline.
921          * Note that this is not always exactly equal to the maximum
922          * of the extents of all the glyphs in the font, but rather
923          * is picked to express the font designer's intent as to
924          * how the font should align with elements above it.
925          */
926         double ascent;
927         /**
928          * the distance that the font extends below the baseline.
929          *  This value is positive for typical fonts that include
930          *  portions below the baseline. Note that this is not always
931          *  exactly equal to the maximum of the extents of all the
932          *  glyphs in the font, but rather is picked to express the
933          *  font designer's intent as to how the the font should
934          *  align with elements below it.
935          */
936         double descent;
937         /**
938          * the recommended vertical distance between baselines when
939          * setting consecutive lines of text with the font. This
940          * is greater than @ascent+@descent by a
941          * quantity known as the $(I line spacing)
942          * or $(I external leading). When space
943          * is at a premium, most fonts can be set with only
944          * a distance of @ascent+@descent between lines.
945          */
946         double height;
947         /**
948          * the maximum distance in the X direction that
949          *         the the origin is advanced for any glyph in the font.
950          */
951         double max_x_advance;
952         /**
953          * the maximum distance in the Y direction that
954          *         the the origin is advanced for any glyph in the font.
955          *         this will be zero for normal fonts used for horizontal
956          *         writing. (The scripts of East Asia are sometimes written
957          *         vertically.)
958          */
959         double max_y_advance;
960     }
961 
962     /**
963      * Specifies variants of a font face based on their slant.
964      **/
965     enum cairo_font_slant_t
966     {
967         CAIRO_FONT_SLANT_NORMAL, ///Upright font style
968         CAIRO_FONT_SLANT_ITALIC, ///Italic font style
969         CAIRO_FONT_SLANT_OBLIQUE ///Oblique font style
970     }
971 
972     /**
973      * Specifies variants of a font face based on their weight.
974      **/
975     enum cairo_font_weight_t
976     {
977         CAIRO_FONT_WEIGHT_NORMAL, ///Normal font weight
978         CAIRO_FONT_WEIGHT_BOLD ///Bold font weight
979     }
980 
981     /**
982      * The subpixel order specifies the order of color elements within
983      * each pixel on the display device when rendering with an
984      * antialiasing mode of $(D CAIRO_ANTIALIAS_SUBPIXEL).
985      **/
986     enum cairo_subpixel_order_t
987     {
988         /**
989          * Use the default subpixel order for
990          * for the target device
991          */
992         CAIRO_SUBPIXEL_ORDER_DEFAULT,
993         /**
994          * Subpixel elements are arranged horizontally
995          * with red at the left
996          */
997         CAIRO_SUBPIXEL_ORDER_RGB,
998         /**
999          * Subpixel elements are arranged horizontally
1000          * with blue at the left
1001          */
1002         CAIRO_SUBPIXEL_ORDER_BGR,
1003         /**
1004          * Subpixel elements are arranged vertically
1005          * with red at the top
1006          */
1007         CAIRO_SUBPIXEL_ORDER_VRGB,
1008         /**
1009          * Subpixel elements are arranged vertically
1010          * with blue at the top
1011          */
1012         CAIRO_SUBPIXEL_ORDER_VBGR
1013     }
1014 
1015     /**
1016      * Specifies the type of hinting to do on font outlines. Hinting
1017      * is the process of fitting outlines to the pixel grid in order
1018      * to improve the appearance of the result. Since hinting outlines
1019      * involves distorting them, it also reduces the faithfulness
1020      * to the original outline shapes. Not all of the outline hinting
1021      * styles are supported by all font backends.
1022      *
1023      * New entries may be added in future versions.
1024      **/
1025     enum cairo_hint_style_t
1026     {
1027         CAIRO_HINT_STYLE_DEFAULT, ///Use the default hint style for font backend and target device
1028         CAIRO_HINT_STYLE_NONE, ///Do not hint outlines
1029         /**
1030          * Hint outlines slightly to improve
1031          * contrast while retaining good fidelity to the original
1032          * shapes.
1033          */
1034         CAIRO_HINT_STYLE_SLIGHT,
1035         /**
1036          * Hint outlines with medium strength
1037          * giving a compromise between fidelity to the original shapes
1038          * and contrast
1039          */
1040         CAIRO_HINT_STYLE_MEDIUM,
1041         CAIRO_HINT_STYLE_FULL ///Hint outlines to maximize contrast
1042     }
1043 
1044     /**
1045      * Specifies whether to hint font metrics; hinting font metrics
1046      * means quantizing them so that they are integer values in
1047      * device space. Doing this improves the consistency of
1048      * letter and line spacing, however it also means that text
1049      * will be laid out differently at different zoom factors.
1050      **/
1051     enum cairo_hint_metrics_t
1052     {
1053         /**
1054          * Hint metrics in the default
1055          * manner for the font backend and target device
1056          */
1057         CAIRO_HINT_METRICS_DEFAULT,
1058         CAIRO_HINT_METRICS_OFF, ///Do not hint font metrics
1059         CAIRO_HINT_METRICS_ON ///Hint font metrics
1060     }
1061 
1062     /**
1063      * An opaque structure holding all options that are used when
1064      * rendering fonts.
1065      *
1066      * Individual features of a $(D cairo_font_options_t) can be set or
1067      * accessed using functions named
1068      * cairo_font_options_set_$(B feature_name) and
1069      * cairo_font_options_get_$(B feature_name), like
1070      * cairo_font_options_set_antialias() and
1071      * cairo_font_options_get_antialias().
1072      *
1073      * New features may be added to a $(D cairo_font_options_t) in the
1074      * future.  For this reason, cairo_font_options_copy(),
1075      * cairo_font_options_equal(), cairo_font_options_merge(), and
1076      * cairo_font_options_hash() should be used to copy, check
1077      * for equality, merge, or compute a hash value of
1078      * $(D cairo_font_options_t) objects.
1079      **/
1080     struct cairo_font_options_t {};
1081     ///
1082      cairo_font_options_t *
1083     cairo_font_options_create ();
1084     ///
1085      cairo_font_options_t *
1086     cairo_font_options_copy (const cairo_font_options_t *original);
1087     ///
1088      void
1089     cairo_font_options_destroy (cairo_font_options_t *options);
1090     ///
1091      cairo_status_t
1092     cairo_font_options_status (cairo_font_options_t *options);
1093     ///
1094      void
1095     cairo_font_options_merge (cairo_font_options_t       *options,
1096                   const cairo_font_options_t *other);
1097     ///
1098      cairo_bool_t
1099     cairo_font_options_equal (const cairo_font_options_t *options,
1100                   const cairo_font_options_t *other);
1101     ///
1102      ulong
1103     cairo_font_options_hash (const cairo_font_options_t *options);
1104     ///
1105      void
1106     cairo_font_options_set_antialias (cairo_font_options_t *options,
1107                       cairo_antialias_t     antialias);
1108      ///
1109      cairo_antialias_t
1110     cairo_font_options_get_antialias (const cairo_font_options_t *options);
1111 
1112     ///
1113      void
1114     cairo_font_options_set_subpixel_order (cairo_font_options_t   *options,
1115                            cairo_subpixel_order_t  subpixel_order);
1116     ///
1117      cairo_subpixel_order_t
1118     cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
1119     ///
1120      void
1121     cairo_font_options_set_hint_style (cairo_font_options_t *options,
1122                        cairo_hint_style_t     hint_style);
1123     ///
1124      cairo_hint_style_t
1125     cairo_font_options_get_hint_style (const cairo_font_options_t *options);
1126     ///
1127      void
1128     cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
1129                          cairo_hint_metrics_t  hint_metrics);
1130     ///
1131      cairo_hint_metrics_t
1132     cairo_font_options_get_hint_metrics (const cairo_font_options_t *options);
1133 
1134     /* This interface is for dealing with text as text, not caring about the
1135        font object inside the the cairo_t. */
1136     ///
1137      void
1138     cairo_select_font_face (cairo_t              *cr,
1139                 const char           *family,
1140                 cairo_font_slant_t   slant,
1141                 cairo_font_weight_t  weight);
1142     ///
1143      void
1144     cairo_set_font_size (cairo_t* cr, double size);
1145     ///
1146      void
1147     cairo_set_font_matrix (cairo_t		    *cr,
1148                    const cairo_matrix_t *matrix);
1149     ///
1150      void
1151     cairo_get_font_matrix (cairo_t* cr,
1152                    cairo_matrix_t *matrix);
1153     ///
1154      void
1155     cairo_set_font_options (cairo_t                    *cr,
1156                 const cairo_font_options_t *options);
1157     ///
1158      void
1159     cairo_get_font_options (cairo_t              *cr,
1160                 cairo_font_options_t *options);
1161     ///
1162      void
1163     cairo_set_font_face (cairo_t* cr, cairo_font_face_t *font_face);
1164     ///
1165      cairo_font_face_t *
1166     cairo_get_font_face (cairo_t* cr);
1167     ///
1168      void
1169     cairo_set_scaled_font (cairo_t                   *cr,
1170                    const cairo_scaled_font_t *scaled_font);
1171     ///
1172      cairo_scaled_font_t *
1173     cairo_get_scaled_font (cairo_t* cr);
1174     ///
1175      void
1176     cairo_show_text (cairo_t* cr, const char *utf8);
1177     ///
1178      void
1179     cairo_show_glyphs (cairo_t* cr, const cairo_glyph_t *glyphs, int num_glyphs);
1180     ///
1181      void
1182     cairo_show_text_glyphs (cairo_t			   *cr,
1183                 const char		   *utf8,
1184                 int			    utf8_len,
1185                 const cairo_glyph_t	   *glyphs,
1186                 int			    num_glyphs,
1187                 const cairo_text_cluster_t *clusters,
1188                 int			    num_clusters,
1189                 cairo_text_cluster_flags_t  cluster_flags);
1190     ///
1191      void
1192     cairo_text_path  (cairo_t* cr, const char *utf8);
1193     ///
1194      void
1195     cairo_glyph_path (cairo_t* cr, const cairo_glyph_t *glyphs, int num_glyphs);
1196     ///
1197      void
1198     cairo_text_extents (cairo_t              *cr,
1199                 const char    	 *utf8,
1200                 cairo_text_extents_t *extents);
1201     ///
1202      void
1203     cairo_glyph_extents (cairo_t               *cr,
1204                  const cairo_glyph_t   *glyphs,
1205                  int                   num_glyphs,
1206                  cairo_text_extents_t  *extents);
1207     ///
1208      void
1209     cairo_font_extents (cairo_t              *cr,
1210                 cairo_font_extents_t *extents);
1211 
1212     /* Generic identifier for a font style */
1213     ///
1214      cairo_font_face_t *
1215     cairo_font_face_reference (cairo_font_face_t *font_face);
1216     ///
1217      void
1218     cairo_font_face_destroy (cairo_font_face_t *font_face);
1219     ///
1220      uint
1221     cairo_font_face_get_reference_count (cairo_font_face_t *font_face);
1222     ///
1223      cairo_status_t
1224     cairo_font_face_status (cairo_font_face_t *font_face);
1225 
1226 
1227     /**
1228      * $(D cairo_font_type_t) is used to describe the type of a given font
1229      * face or scaled font. The font types are also known as "font
1230      * backends" within cairo.
1231      *
1232      * The type of a font face is determined by the function used to
1233      * create it, which will generally be of the form
1234      * cairo_$(B type)_font_face_create(). The font face type can be queried
1235      * with cairo_font_face_get_type()
1236      *
1237      * The various $(D cairo_font_face_t) functions can be used with a font face
1238      * of any type.
1239      *
1240      * The type of a scaled font is determined by the type of the font
1241      * face passed to cairo_scaled_font_create(). The scaled font type can
1242      * be queried with cairo_scaled_font_get_type()
1243      *
1244      * The various $(D cairo_scaled_font_t functions) can be used with scaled
1245      * fonts of any type, but some font backends also provide
1246      * type-specific functions that must only be called with a scaled font
1247      * of the appropriate type. These functions have names that begin with
1248      * cairo_$(B type)_scaled_font() such as cairo_ft_scaled_font_lock_face().
1249      *
1250      * The behavior of calling a type-specific function with a scaled font
1251      * of the wrong type is undefined.
1252      *
1253      * New entries may be added in future versions.
1254      *
1255      * Since: 1.2
1256      **/
1257     enum cairo_font_type_t
1258     {
1259         CAIRO_FONT_TYPE_TOY, ///The font was created using cairo's toy font api
1260         CAIRO_FONT_TYPE_FT, ///The font is of type FreeType
1261         CAIRO_FONT_TYPE_WIN32, ///The font is of type Win32
1262         CAIRO_FONT_TYPE_QUARTZ, ///The font is of type Quartz (Since: 1.6)
1263         CAIRO_FONT_TYPE_USER ///The font was create using cairo's user font api (Since: 1.8)
1264     }
1265     ///
1266      cairo_font_type_t
1267     cairo_font_face_get_type (cairo_font_face_t *font_face);
1268     ///
1269      void *
1270     cairo_font_face_get_user_data (cairo_font_face_t	   *font_face,
1271                        const cairo_user_data_key_t *key);
1272     ///
1273      cairo_status_t
1274     cairo_font_face_set_user_data (cairo_font_face_t	   *font_face,
1275                        const cairo_user_data_key_t *key,
1276                        void			   *user_data,
1277                        cairo_destroy_func_t	    destroy);
1278 
1279     /** Portable interface to general font features. */
1280 
1281      cairo_scaled_font_t *
1282     cairo_scaled_font_create (cairo_font_face_t          *font_face,
1283                   const cairo_matrix_t       *font_matrix,
1284                   const cairo_matrix_t       *ctm,
1285                   const cairo_font_options_t *options);
1286     ///ditto
1287      cairo_scaled_font_t *
1288     cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
1289     ///ditto
1290      void
1291     cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
1292     ///ditto
1293      uint
1294     cairo_scaled_font_get_reference_count (cairo_scaled_font_t *scaled_font);
1295     ///ditto
1296      cairo_status_t
1297     cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
1298     ///ditto
1299      cairo_font_type_t
1300     cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
1301     ///ditto
1302      void *
1303     cairo_scaled_font_get_user_data (cairo_scaled_font_t         *scaled_font,
1304                      const cairo_user_data_key_t *key);
1305     ///ditto
1306      cairo_status_t
1307     cairo_scaled_font_set_user_data (cairo_scaled_font_t         *scaled_font,
1308                      const cairo_user_data_key_t *key,
1309                      void                        *user_data,
1310                      cairo_destroy_func_t	      destroy);
1311     ///ditto
1312      void
1313     cairo_scaled_font_extents (cairo_scaled_font_t  *scaled_font,
1314                    cairo_font_extents_t *extents);
1315     ///ditto
1316      void
1317     cairo_scaled_font_text_extents (cairo_scaled_font_t  *scaled_font,
1318                     const char  	     *utf8,
1319                     cairo_text_extents_t *extents);
1320     ///ditto
1321      void
1322     cairo_scaled_font_glyph_extents (cairo_scaled_font_t   *scaled_font,
1323                      const cairo_glyph_t   *glyphs,
1324                      int                   num_glyphs,
1325                      cairo_text_extents_t  *extents);
1326     ///ditto
1327      cairo_status_t
1328     cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t        *scaled_font,
1329                       double		      x,
1330                       double		      y,
1331                       const char	             *utf8,
1332                       int		              utf8_len,
1333                       cairo_glyph_t	            **glyphs,
1334                       int		             *num_glyphs,
1335                       cairo_text_cluster_t      **clusters,
1336                       int		             *num_clusters,
1337                       cairo_text_cluster_flags_t *cluster_flags);
1338     ///ditto
1339      cairo_font_face_t *
1340     cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
1341     ///ditto
1342      void
1343     cairo_scaled_font_get_font_matrix (cairo_scaled_font_t	*scaled_font,
1344                        cairo_matrix_t	*font_matrix);
1345     ///ditto
1346      void
1347     cairo_scaled_font_get_ctm (cairo_scaled_font_t	*scaled_font,
1348                    cairo_matrix_t	*ctm);
1349     ///ditto
1350      void
1351     cairo_scaled_font_get_scale_matrix (cairo_scaled_font_t	*scaled_font,
1352                         cairo_matrix_t	*scale_matrix);
1353     ///ditto
1354      void
1355     cairo_scaled_font_get_font_options (cairo_scaled_font_t		*scaled_font,
1356                         cairo_font_options_t	*options);
1357 
1358 
1359     /** Toy fonts */
1360 
1361      cairo_font_face_t *
1362     cairo_toy_font_face_create (const char           *family,
1363                     cairo_font_slant_t    slant,
1364                     cairo_font_weight_t   weight);
1365     ///ditto
1366      const(char)*
1367     cairo_toy_font_face_get_family (cairo_font_face_t *font_face);
1368     ///ditto
1369      cairo_font_slant_t
1370     cairo_toy_font_face_get_slant (cairo_font_face_t *font_face);
1371     ///ditto
1372      cairo_font_weight_t
1373     cairo_toy_font_face_get_weight (cairo_font_face_t *font_face);
1374 
1375 
1376     /** User fonts */
1377 
1378      cairo_font_face_t *
1379     cairo_user_font_face_create ();
1380 
1381     /* User-font method signatures */
1382 
1383     /**
1384      * $(D cairo_user_scaled_font_init_func_t) is the type of function which is
1385      * called when a scaled-font needs to be created for a user font-face.
1386      *
1387      * The cairo context $(D cr) is not used by the caller, but is prepared in font
1388      * space, similar to what the cairo contexts passed to the render_glyph
1389      * method will look like.  The callback can use this context for extents
1390      * computation for example.  After the callback is called, $(D cr) is checked
1391      * for any error status.
1392      *
1393      * The $(D extents) argument is where the user font sets the font extents for
1394      * $(D scaled_font).  It is in font space, which means that for most cases its
1395      * ascent and descent members should add to 1.0.  $(D extents) is preset to
1396      * hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for
1397      * descent and max_y_advance members.
1398      *
1399      * The callback is optional.  If not set, default font extents as described
1400      * in the previous paragraph will be used.
1401      *
1402      * Note that $(D scaled_font) is not fully initialized at this
1403      * point and trying to use it for text operations in the callback will result
1404      * in deadlock.
1405      *
1406      * Params:
1407      * scaled_font = the scaled-font being created
1408      * cr = a cairo context, in font space
1409      * extents = font extents to fill in, in font space
1410      *
1411      * Returns: $(D CAIRO_STATUS_SUCCESS) upon success, or an error status on error.
1412      *
1413      * Since: 1.8
1414      **/
1415     alias extern(C) cairo_status_t function(cairo_scaled_font_t  *scaled_font,
1416                                       cairo_t              *cr,
1417                                       cairo_font_extents_t *extents) cairo_user_scaled_font_init_func_t;
1418 
1419     /**
1420      *
1421      * $(D cairo_user_scaled_font_render_glyph_func_t) is the type of function which
1422      * is called when a user scaled-font needs to render a glyph.
1423      *
1424      * The callback is mandatory, and expected to draw the glyph with code $(D glyph) to
1425      * the cairo context $(D cr).  $(D cr) is prepared such that the glyph drawing is done in
1426      * font space.  That is, the matrix set on $(D cr) is the scale matrix of $(D scaled_font),
1427      * The $(D extents) argument is where the user font sets the font extents for
1428      * $(D scaled_font).  However, if user prefers to draw in user space, they can
1429      * achieve that by changing the matrix on $(D cr).  All cairo rendering operations
1430      * to $(D cr) are permitted, however, the result is undefined if any source other
1431      * than the default source on $(D cr) is used.  That means, glyph bitmaps should
1432      * be rendered using cairo_mask() instead of cairo_paint().
1433      *
1434      * Other non-default settings on $(D cr) include a font size of 1.0 (given that
1435      * it is set up to be in font space), and font options corresponding to
1436      * $(D scaled_font).
1437      *
1438      * The $(D extents) argument is preset to have $(D x_bearing),
1439      * $(D width), and $(D y_advance) of zero,
1440      * $(D y_bearing) set to $(D -font_extents.ascent),
1441      * $(D height) to $(D font_extents.ascent+font_extents.descent),
1442      * and $(D x_advance) to $(D font_extents.max_x_advance).
1443      * The only field user needs to set in majority of cases is
1444      * $(D x_advance).
1445      * If the $(D width) field is zero upon the callback returning
1446      * (which is its preset value), the glyph extents are automatically computed
1447      * based on the drawings done to $(D cr).  This is in most cases exactly what the
1448      * desired behavior is.  However, if for any reason the callback sets the
1449      * extents, it must be ink extents, and include the extents of all drawing
1450      * done to $(D cr) in the callback.
1451      *
1452      * Params:
1453      * scaled_font = user scaled-font
1454      * glyph = glyph code to render
1455      * cr = cairo context to draw to, in font space
1456      * extents = glyph extents to fill in, in font space
1457      *
1458      * Returns: $(D CAIRO_STATUS_SUCCESS) upon success, or
1459      * $(D CAIRO_STATUS_USER_FONT_ERROR) or any other error status on error.
1460      *
1461      * Since: 1.8
1462      **/
1463     alias extern(C) cairo_status_t function(cairo_scaled_font_t  *scaled_font,
1464                                           ulong         glyph,
1465                                           cairo_t              *cr,
1466                                           cairo_text_extents_t *extents) cairo_user_scaled_font_render_glyph_func_t;
1467 
1468     /**
1469      * $(D cairo_user_scaled_font_text_to_glyphs_func_t) is the type of function which
1470      * is called to convert input text to an array of glyphs.  This is used by the
1471      * cairo_show_text() operation.
1472      *
1473      * Using this callback the user-font has full control on glyphs and their
1474      * positions.  That means, it allows for features like ligatures and kerning,
1475      * as well as complex $(I shaping) required for scripts like
1476      * Arabic and Indic.
1477      *
1478      * The $(D num_glyphs) argument is preset to the number of glyph entries available
1479      * in the $(D glyphs) buffer. If the $(D glyphs) buffer is $(D NULL), the value of
1480      * $(D num_glyphs) will be zero.  If the provided glyph array is too short for
1481      * the conversion (or for convenience), a new glyph array may be allocated
1482      * using cairo_glyph_allocate() and placed in $(D glyphs).  Upon return,
1483      * $(D num_glyphs) should contain the number of generated glyphs.  If the value
1484      * $(D glyphs) points at has changed after the call, the caller will free the
1485      * allocated glyph array using cairo_glyph_free().
1486      * The callback should populate the glyph indices and positions (in font space)
1487      * assuming that the text is to be shown at the origin.
1488      *
1489      * If $(D clusters) is not $(D NULL), $(D num_clusters) and $(D cluster_flags) are also
1490      * non-$(D NULL), and cluster mapping should be computed. The semantics of how
1491      * cluster array allocation works is similar to the glyph array.  That is,
1492      * if $(D clusters) initially points to a non-$(D NULL) value, that array may be used
1493      * as a cluster buffer, and $(D num_clusters) points to the number of cluster
1494      * entries available there.  If the provided cluster array is too short for
1495      * the conversion (or for convenience), a new cluster array may be allocated
1496      * using cairo_text_cluster_allocate() and placed in $(D clusters).  Upon return,
1497      * $(D num_clusters) should contain the number of generated clusters.
1498      * If the value $(D clusters) points at has changed after the call, the caller
1499      * will free the allocated cluster array using cairo_text_cluster_free().
1500      *
1501      * The callback is optional.  If $(D num_glyphs) is negative upon
1502      * the callback returning or if the return value
1503      * is $(D CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED), the unicode_to_glyph callback
1504      * is tried.  See $(D cairo_user_scaled_font_unicode_to_glyph_func_t).
1505      *
1506      * Note: While cairo does not impose any limitation on glyph indices,
1507      * some applications may assume that a glyph index fits in a 16-bit
1508      * unsigned integer.  As such, it is advised that user-fonts keep their
1509      * glyphs in the 0 to 65535 range.  Furthermore, some applications may
1510      * assume that glyph 0 is a special glyph-not-found glyph.  User-fonts
1511      * are advised to use glyph 0 for such purposes and do not use that
1512      * glyph value for other purposes.
1513      *
1514      * Params:
1515      * scaled_font = the scaled-font being created
1516      * utf8 = a string of text encoded in UTF-8
1517      * utf8_len = length of @utf8 in bytes
1518      * glyphs = pointer to array of glyphs to fill, in font space
1519      * num_glyphs = pointer to number of glyphs
1520      * clusters = pointer to array of cluster mapping information to fill, or %NULL
1521      * num_clusters = pointer to number of clusters
1522      * cluster_flags = pointer to location to store cluster flags corresponding to the
1523      *                 output @clusters
1524      *
1525      * Returns: $(D CAIRO_STATUS_SUCCESS) upon success,
1526      * $(D CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) if fallback options should be tried,
1527      * or $(D CAIRO_STATUS_USER_FONT_ERROR) or any other error status on error.
1528      *
1529      * Since: 1.8
1530      **/
1531     alias extern(C) cairo_status_t function(cairo_scaled_font_t        *scaled_font,
1532                                         const char	           *utf8,
1533                                         int		            utf8_len,
1534                                         cairo_glyph_t	          **glyphs,
1535                                         int		           *num_glyphs,
1536                                         cairo_text_cluster_t      **clusters,
1537                                         int		           *num_clusters,
1538                                         cairo_text_cluster_flags_t *cluster_flags) cairo_user_scaled_font_text_to_glyphs_func_t;
1539 
1540     /**
1541      * $(D cairo_user_scaled_font_unicode_to_glyph_func_t) is the type of function which
1542      * is called to convert an input Unicode character to a single glyph.
1543      * This is used by the cairo_show_text() operation.
1544      *
1545      * This callback is used to provide the same functionality as the
1546      * text_to_glyphs callback does (see $(D cairo_user_scaled_font_text_to_glyphs_func_t))
1547      * but has much less control on the output,
1548      * in exchange for increased ease of use.  The inherent assumption to using
1549      * this callback is that each character maps to one glyph, and that the
1550      * mapping is context independent.  It also assumes that glyphs are positioned
1551      * according to their advance width.  These mean no ligatures, kerning, or
1552      * complex scripts can be implemented using this callback.
1553      *
1554      * The callback is optional, and only used if text_to_glyphs callback is not
1555      * set or fails to return glyphs.  If this callback is not set or if it returns
1556      * $(D CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED), an identity mapping from Unicode
1557      * code-points to glyph indices is assumed.
1558      *
1559      * Note: While cairo does not impose any limitation on glyph indices,
1560      * some applications may assume that a glyph index fits in a 16-bit
1561      * unsigned integer.  As such, it is advised that user-fonts keep their
1562      * glyphs in the 0 to 65535 range.  Furthermore, some applications may
1563      * assume that glyph 0 is a special glyph-not-found glyph.  User-fonts
1564      * are advised to use glyph 0 for such purposes and do not use that
1565      * glyph value for other purposes.
1566      *
1567      * Params:
1568      * scaled_font = the scaled-font being created
1569      * unicode = input unicode character code-point
1570      * glyph_index = output glyph index
1571      *
1572      * Returns: $(D CAIRO_STATUS_SUCCESS) upon success,
1573      * $(D CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) if fallback options should be tried,
1574      * or $(D CAIRO_STATUS_USER_FONT_ERROR) or any other error status on error.
1575      *
1576      * Since: 1.8
1577      **/
1578     alias extern(C) cairo_status_t function(cairo_scaled_font_t *scaled_font,
1579                                           ulong        unicode,
1580                                           ulong       *glyph_index) cairo_user_scaled_font_unicode_to_glyph_func_t;
1581 
1582     /** User-font method setters */
1583 
1584      void
1585     cairo_user_font_face_set_init_func (cairo_font_face_t                  *font_face,
1586                         cairo_user_scaled_font_init_func_t  init_func);
1587     ///ditto
1588      void
1589     cairo_user_font_face_set_render_glyph_func (cairo_font_face_t                          *font_face,
1590                             cairo_user_scaled_font_render_glyph_func_t  render_glyph_func);
1591     ///ditto
1592      void
1593     cairo_user_font_face_set_text_to_glyphs_func (cairo_font_face_t                            *font_face,
1594                               cairo_user_scaled_font_text_to_glyphs_func_t  text_to_glyphs_func);
1595     ///ditto
1596      void
1597     cairo_user_font_face_set_unicode_to_glyph_func (cairo_font_face_t                              *font_face,
1598                                 cairo_user_scaled_font_unicode_to_glyph_func_t  unicode_to_glyph_func);
1599 
1600     /** User-font method getters */
1601 
1602      cairo_user_scaled_font_init_func_t
1603     cairo_user_font_face_get_init_func (cairo_font_face_t *font_face);
1604     ///ditto
1605      cairo_user_scaled_font_render_glyph_func_t
1606     cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face);
1607     ///ditto
1608      cairo_user_scaled_font_text_to_glyphs_func_t
1609     cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face);
1610     ///ditto
1611      cairo_user_scaled_font_unicode_to_glyph_func_t
1612     cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t *font_face);
1613 
1614 
1615     /** Query functions */
1616 
1617      cairo_operator_t
1618     cairo_get_operator (cairo_t* cr);
1619     ///ditto
1620      cairo_pattern_t *
1621     cairo_get_source (cairo_t* cr);
1622     ///ditto
1623      double
1624     cairo_get_tolerance (cairo_t* cr);
1625     ///ditto
1626      cairo_antialias_t
1627     cairo_get_antialias (cairo_t* cr);
1628     ///ditto
1629      cairo_bool_t
1630     cairo_has_current_point (cairo_t* cr);
1631     ///ditto
1632      void
1633     cairo_get_current_point (cairo_t* cr, double *x, double *y);
1634     ///ditto
1635      cairo_fill_rule_t
1636     cairo_get_fill_rule (cairo_t* cr);
1637     ///ditto
1638      double
1639     cairo_get_line_width (cairo_t* cr);
1640     ///ditto
1641      cairo_line_cap_t
1642     cairo_get_line_cap (cairo_t* cr);
1643     ///ditto
1644      cairo_line_join_t
1645     cairo_get_line_join (cairo_t* cr);
1646     ///ditto
1647      double
1648     cairo_get_miter_limit (cairo_t* cr);
1649     ///ditto
1650      int
1651     cairo_get_dash_count (cairo_t* cr);
1652     ///ditto
1653      void
1654     cairo_get_dash (cairo_t* cr, double *dashes, double *offset);
1655     ///ditto
1656      void
1657     cairo_get_matrix (cairo_t* cr, cairo_matrix_t *matrix);
1658     ///ditto
1659      cairo_surface_t *
1660     cairo_get_target (cairo_t* cr);
1661     ///ditto
1662      cairo_surface_t *
1663     cairo_get_group_target (cairo_t* cr);
1664 
1665     /**
1666      * $(D cairo_path_data_t) is used to describe the type of one portion
1667      * of a path when represented as a $(D cairo_path_t).
1668      * See $(D cairo_path_data_t) for details.
1669      **/
1670     enum cairo_path_data_type_t
1671     {
1672         CAIRO_PATH_MOVE_TO, ///A move-to operation
1673         CAIRO_PATH_LINE_TO, ///A line-to operation
1674         CAIRO_PATH_CURVE_TO, ///A curve-to operation
1675         CAIRO_PATH_CLOSE_PATH ///A close-path operation
1676     }
1677 
1678     /**
1679      * $(D cairo_path_data_t) is used to represent the path data inside a
1680      * $(D cairo_path_t).
1681      *
1682      * The data structure is designed to try to balance the demands of
1683      * efficiency and ease-of-use. A path is represented as an array of
1684      * $(D cairo_path_data_t), which is a union of headers and points.
1685      *
1686      * Each portion of the path is represented by one or more elements in
1687      * the array, (one header followed by 0 or more points). The length
1688      * value of the header is the number of array elements for the current
1689      * portion including the header, (ie. length == 1 + # of points), and
1690      * where the number of points for each element type is as follows:
1691      *
1692      * --------------------
1693      *     $(D CAIRO_PATH_MOVE_TO):     1 point
1694      *     $(D CAIRO_PATH_LINE_TO):     1 point
1695      *     $(D CAIRO_PATH_CURVE_TO):    3 points
1696      *     $(D CAIRO_PATH_CLOSE_PATH):  0 points
1697      * --------------------
1698      *
1699      * The semantics and ordering of the coordinate values are consistent
1700      * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
1701      * cairo_close_path().
1702      *
1703      * Examples:
1704      * Here is sample code for iterating through a $(D cairo_path_t):
1705      *
1706      * --------------------
1707      *      int i;
1708      *      cairo_path_t *path;
1709      *      cairo_path_data_t *data;
1710      *
1711      *      path = cairo_copy_path (cr);
1712      *
1713      *      for (i=0; i < path->num_data; i += path->data[i].header.length) {
1714      *          data = &amp;path->data[i];
1715      *          switch (data->header.type) {
1716      *          case CAIRO_PATH_MOVE_TO:
1717      *              do_move_to_things (data[1].point.x, data[1].point.y);
1718      *              break;
1719      *          case CAIRO_PATH_LINE_TO:
1720      *              do_line_to_things (data[1].point.x, data[1].point.y);
1721      *              break;
1722      *          case CAIRO_PATH_CURVE_TO:
1723      *              do_curve_to_things (data[1].point.x, data[1].point.y,
1724      *                                  data[2].point.x, data[2].point.y,
1725      *                                  data[3].point.x, data[3].point.y);
1726      *              break;
1727      *          case CAIRO_PATH_CLOSE_PATH:
1728      *              do_close_path_things ();
1729      *              break;
1730      *          }
1731      *      }
1732      *      cairo_path_destroy (path);
1733      * --------------------
1734      *
1735      * As of cairo 1.4, cairo does not mind if there are more elements in
1736      * a portion of the path than needed.  Such elements can be used by
1737      * users of the cairo API to hold extra values in the path data
1738      * structure.  For this reason, it is recommended that applications
1739      * always use $(D data->header.length) to
1740      * iterate over the path data, instead of hardcoding the number of
1741      * elements for each element type.
1742      **/
1743     struct cairo_path_data_t
1744     {
1745         union
1746         {
1747             PathDataHeader header; ///
1748             PathDataPoint point; ///
1749         }
1750     }
1751     ///
1752     struct PathDataHeader
1753     {
1754         cairo_path_data_type_t type;///
1755         int length;///
1756     }
1757     ///
1758     struct PathDataPoint
1759     {
1760         double x, y; ///
1761     }
1762 
1763     /**
1764      * A data structure for holding a path. This data structure serves as
1765      * the return value for cairo_copy_path() and
1766      * cairo_copy_path_flat() as well the input value for
1767      * cairo_append_path().
1768      *
1769      * See $(D cairo_path_data_t) for hints on how to iterate over the
1770      * actual data within the path.
1771      *
1772      * The num_data member gives the number of elements in the data
1773      * array. This number is larger than the number of independent path
1774      * portions (defined in $(D cairo_path_data_type_t)), since the data
1775      * includes both headers and coordinates for each portion.
1776      **/
1777     struct cairo_path_t
1778     {
1779         cairo_status_t status; ///the current error status
1780         cairo_path_data_t *data; ///the elements in the path
1781         int num_data; ///the number of elements in the data array
1782     }
1783     ///
1784      cairo_path_t *
1785     cairo_copy_path (cairo_t* cr);
1786     ///
1787      cairo_path_t *
1788     cairo_copy_path_flat (cairo_t* cr);
1789     ///
1790      void
1791     cairo_append_path (cairo_t		*cr,
1792                const cairo_path_t	*path);
1793     ///
1794      void
1795     cairo_path_destroy (cairo_path_t *path);
1796 
1797     /** Error status queries */
1798 
1799      cairo_status_t
1800     cairo_status (cairo_t* cr);
1801     ///ditto
1802      immutable(char)*
1803     cairo_status_to_string (cairo_status_t status);
1804 
1805     /** Backend device manipulation */
1806 
1807      cairo_device_t *
1808     cairo_device_reference (cairo_device_t *device);
1809 
1810     /**
1811      * $(D cairo_device_type_t) is used to describe the type of a given
1812      * device. The devices types are also known as "backends" within cairo.
1813      *
1814      * The device type can be queried with cairo_device_get_type()
1815      *
1816      * The various $(D cairo_device_t) functions can be used with surfaces of
1817      * any type, but some backends also provide type-specific functions
1818      * that must only be called with a device of the appropriate
1819      * type. These functions have names that begin with
1820      * cairo_$(B type)_device<...> such as cairo_xcb_device_debug_set_render_version().
1821      *
1822      * The behavior of calling a type-specific function with a surface of
1823      * the wrong type is undefined.
1824      *
1825      * New entries may be added in future versions.
1826      *
1827      * Since: 1.10
1828      **/
1829     enum cairo_device_type_t
1830     {
1831         CAIRO_DEVICE_TYPE_DRM, ///The surface is of type Direct Render Manager
1832         CAIRO_DEVICE_TYPE_GL, ///The surface is of type OpenGL
1833         CAIRO_DEVICE_TYPE_SCRIPT, ///The surface is of type script
1834         CAIRO_DEVICE_TYPE_XCB, ///The surface is of type xcb
1835         CAIRO_DEVICE_TYPE_XLIB, ///The surface is of type xlib
1836         CAIRO_DEVICE_TYPE_XML, ///The surface is of type XML
1837     }
1838     ///
1839      cairo_device_type_t
1840     cairo_device_get_type (cairo_device_t *device);
1841     ///
1842      cairo_status_t
1843     cairo_device_status (cairo_device_t *device);
1844     ///
1845      cairo_status_t
1846     cairo_device_acquire (cairo_device_t *device);
1847     ///
1848      void
1849     cairo_device_release (cairo_device_t *device);
1850     ///
1851      void
1852     cairo_device_flush (cairo_device_t *device);
1853     ///
1854      void
1855     cairo_device_finish (cairo_device_t *device);
1856     ///
1857      void
1858     cairo_device_destroy (cairo_device_t *device);
1859     ///
1860      uint
1861     cairo_device_get_reference_count (cairo_device_t *device);
1862     ///
1863      void *
1864     cairo_device_get_user_data (cairo_device_t		 *device,
1865                     const cairo_user_data_key_t *key);
1866     ///
1867      cairo_status_t
1868     cairo_device_set_user_data (cairo_device_t		 *device,
1869                     const cairo_user_data_key_t *key,
1870                     void			 *user_data,
1871                     cairo_destroy_func_t	  destroy);
1872 
1873 
1874     /** Surface manipulation */
1875 
1876      cairo_surface_t *
1877     cairo_surface_create_similar (cairo_surface_t  *other,
1878                       cairo_content_t	content,
1879                       int		width,
1880                       int		height);
1881     ///ditto
1882      cairo_surface_t *
1883     cairo_surface_create_for_rectangle (cairo_surface_t	*target,
1884                                         double		 x,
1885                                         double		 y,
1886                                         double		 width,
1887                                         double		 height);
1888     ///ditto
1889      cairo_surface_t *
1890     cairo_surface_reference (cairo_surface_t *surface);
1891     ///ditto
1892      void
1893     cairo_surface_finish (cairo_surface_t *surface);
1894     ///ditto
1895      void
1896     cairo_surface_destroy (cairo_surface_t *surface);
1897     ///ditto
1898      cairo_device_t *
1899     cairo_surface_get_device (cairo_surface_t *surface);
1900     ///ditto
1901      uint
1902     cairo_surface_get_reference_count (cairo_surface_t *surface);
1903     ///ditto
1904      cairo_status_t
1905     cairo_surface_status (cairo_surface_t *surface);
1906 
1907     /**
1908      * $(D cairo_surface_type_t) is used to describe the type of a given
1909      * surface. The surface types are also known as "backends" or "surface
1910      * backends" within cairo.
1911      *
1912      * The type of a surface is determined by the function used to create
1913      * it, which will generally be of the form cairo_$(B type)_surface_create(),
1914      * (though see cairo_surface_create_similar() as well).
1915      *
1916      * The surface type can be queried with cairo_surface_get_type()
1917      *
1918      * The various $(D cairo_surface_t) functions can be used with surfaces of
1919      * any type, but some backends also provide type-specific functions
1920      * that must only be called with a surface of the appropriate
1921      * type. These functions have names that begin with
1922      * cairo_$(B type)_surface<...> such as cairo_image_surface_get_width().
1923      *
1924      * The behavior of calling a type-specific function with a surface of
1925      * the wrong type is undefined.
1926      *
1927      * New entries may be added in future versions.
1928      *
1929      * Since: 1.2
1930      **/
1931     enum cairo_surface_type_t
1932     {
1933         CAIRO_SURFACE_TYPE_IMAGE, ///The surface is of type image
1934         CAIRO_SURFACE_TYPE_PDF, ///The surface is of type pdf
1935         CAIRO_SURFACE_TYPE_PS, ///The surface is of type ps
1936         CAIRO_SURFACE_TYPE_XLIB, ///The surface is of type xlib
1937         CAIRO_SURFACE_TYPE_XCB, ///The surface is of type xcb
1938         CAIRO_SURFACE_TYPE_GLITZ, ///The surface is of type glitz
1939         CAIRO_SURFACE_TYPE_QUARTZ, ///The surface is of type quartz
1940         CAIRO_SURFACE_TYPE_WIN32, ///The surface is of type win32
1941         CAIRO_SURFACE_TYPE_BEOS, ///The surface is of type beos
1942         CAIRO_SURFACE_TYPE_DIRECTFB, ///The surface is of type directfb
1943         CAIRO_SURFACE_TYPE_SVG, ///The surface is of type svg
1944         CAIRO_SURFACE_TYPE_OS2, ///The surface is of type os2
1945         CAIRO_SURFACE_TYPE_WIN32_PRINTING, ///The surface is a win32 printing surface
1946         CAIRO_SURFACE_TYPE_QUARTZ_IMAGE, ///The surface is of type quartz_image
1947         CAIRO_SURFACE_TYPE_SCRIPT, ///The surface is of type script, since 1.10
1948         CAIRO_SURFACE_TYPE_QT, ///The surface is of type Qt, since 1.10
1949         CAIRO_SURFACE_TYPE_RECORDING, ///The surface is of type recording, since 1.10
1950         CAIRO_SURFACE_TYPE_VG, ///The surface is a OpenVG surface, since 1.10
1951         CAIRO_SURFACE_TYPE_GL, ///The surface is of type OpenGL, since 1.10
1952         CAIRO_SURFACE_TYPE_DRM, ///The surface is of type Direct Render Manager, since 1.10
1953         CAIRO_SURFACE_TYPE_TEE, ///The surface is of type 'tee' (a multiplexing surface), since 1.10
1954         CAIRO_SURFACE_TYPE_XML, ///The surface is of type XML (for debugging), since 1.10
1955         CAIRO_SURFACE_TYPE_SKIA, ///The surface is of type Skia, since 1.10
1956         /**
1957          * The surface is a subsurface created with
1958          * cairo_surface_create_for_rectangle(), since 1.10
1959          */
1960         CAIRO_SURFACE_TYPE_SUBSURFACE
1961     }
1962     ///
1963      cairo_surface_type_t
1964     cairo_surface_get_type (cairo_surface_t *surface);
1965     ///
1966      cairo_content_t
1967     cairo_surface_get_content (cairo_surface_t *surface);
1968 
1969     static if(CAIRO_HAS_PNG_FUNCTIONS)
1970     {
1971     ///requires -version=CAIRO_HAS_PNG_FUNCTIONS
1972      cairo_status_t
1973     cairo_surface_write_to_png (cairo_surface_t	*surface,
1974                     const char		*filename);
1975     ///ditto
1976      cairo_status_t
1977     cairo_surface_write_to_png_stream (cairo_surface_t	*surface,
1978                        cairo_write_func_t	write_func,
1979                        void			*closure);
1980 
1981     }
1982     ///
1983      void *
1984     cairo_surface_get_user_data (cairo_surface_t		 *surface,
1985                      const cairo_user_data_key_t *key);
1986     ///
1987      cairo_status_t
1988     cairo_surface_set_user_data (cairo_surface_t		 *surface,
1989                      const cairo_user_data_key_t *key,
1990                      void			 *user_data,
1991                      cairo_destroy_func_t	 destroy);
1992     ///
1993     enum string CAIRO_MIME_TYPE_JPEG = "image/jpeg";
1994     ///
1995     enum string CAIRO_MIME_TYPE_PNG = "image/png";
1996     ///
1997     enum string CAIRO_MIME_TYPE_JP2 = "image/jp2";
1998     ///
1999     enum string CAIRO_MIME_TYPE_URI = "text/x-uri";
2000     ///
2001      void
2002     cairo_surface_get_mime_data (cairo_surface_t		*surface,
2003                                  const char			*mime_type,
2004                                  const ubyte       **data,
2005                                  ulong		*length);
2006     ///
2007      cairo_status_t
2008     cairo_surface_set_mime_data (cairo_surface_t		*surface,
2009                                  const char			*mime_type,
2010                                  const ubyte	*data,
2011                                  ulong		 length,
2012                      cairo_destroy_func_t	 destroy,
2013                      void			*closure);
2014     ///
2015      void
2016     cairo_surface_get_font_options (cairo_surface_t      *surface,
2017                     cairo_font_options_t *options);
2018     ///
2019      void
2020     cairo_surface_flush (cairo_surface_t *surface);
2021     ///
2022      void
2023     cairo_surface_mark_dirty (cairo_surface_t *surface);
2024     ///
2025      void
2026     cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
2027                         int              x,
2028                         int              y,
2029                         int              width,
2030                         int              height);
2031     ///
2032      void
2033     cairo_surface_set_device_offset (cairo_surface_t *surface,
2034                      double           x_offset,
2035                      double           y_offset);
2036     ///
2037      void
2038     cairo_surface_get_device_offset (cairo_surface_t *surface,
2039                      double          *x_offset,
2040                      double          *y_offset);
2041     ///
2042      void
2043     cairo_surface_set_fallback_resolution (cairo_surface_t	*surface,
2044                            double		 x_pixels_per_inch,
2045                            double		 y_pixels_per_inch);
2046     ///
2047      void
2048     cairo_surface_get_fallback_resolution (cairo_surface_t	*surface,
2049                            double		*x_pixels_per_inch,
2050                            double		*y_pixels_per_inch);
2051     ///
2052      void
2053     cairo_surface_copy_page (cairo_surface_t *surface);
2054     ///
2055      void
2056     cairo_surface_show_page (cairo_surface_t *surface);
2057     ///
2058      cairo_bool_t
2059     cairo_surface_has_show_text_glyphs (cairo_surface_t *surface);
2060 
2061     /* Image-surface functions */
2062 
2063     /**
2064      * $(D cairo_format_t) is used to identify the memory format of
2065      * image data.
2066      *
2067      * New entries may be added in future versions.
2068      **/
2069     enum cairo_format_t
2070     {
2071         CAIRO_FORMAT_INVALID   = -1, ///no such format exists or is supported.
2072         /**
2073          * each pixel is a 32-bit quantity, with
2074          * alpha in the upper 8 bits, then red, then green, then blue.
2075          * The 32-bit quantities are stored native-endian. Pre-multiplied
2076          * alpha is used. (That is, 50% transparent red is 0x80800000,
2077          * not 0x80ff0000.)
2078          */
2079         CAIRO_FORMAT_ARGB32    = 0,
2080         /**
2081          * each pixel is a 32-bit quantity, with
2082          * the upper 8 bits unused. Red, Green, and Blue are stored
2083          * in the remaining 24 bits in that order.
2084          */
2085         CAIRO_FORMAT_RGB24     = 1,
2086         /**
2087          * each pixel is a 8-bit quantity holding
2088          * an alpha value.
2089          */
2090         CAIRO_FORMAT_A8        = 2,
2091         /**
2092          * each pixel is a 1-bit quantity holding
2093          * an alpha value. Pixels are packed together into 32-bit
2094          * quantities. The ordering of the bits matches the
2095          * endianess of the platform. On a big-endian machine, the
2096          * first pixel is in the uppermost bit, on a little-endian
2097          * machine the first pixel is in the least-significant bit.
2098          */
2099         CAIRO_FORMAT_A1        = 3,
2100         /**
2101          * each pixel is a 16-bit quantity
2102          * with red in the upper 5 bits, then green in the middle
2103          * 6 bits, and blue in the lower 5 bits.
2104          */
2105         CAIRO_FORMAT_RGB16_565 = 4
2106     }
2107     ///
2108      cairo_surface_t *
2109     cairo_image_surface_create (cairo_format_t	format,
2110                     int			width,
2111                     int			height);
2112     ///
2113      int
2114     cairo_format_stride_for_width (cairo_format_t	format,
2115                        int		width);
2116     ///
2117      cairo_surface_t *
2118     cairo_image_surface_create_for_data (ubyte	       *data,
2119                          cairo_format_t		format,
2120                          int			width,
2121                          int			height,
2122                          int			stride);
2123     ///
2124      ubyte *
2125     cairo_image_surface_get_data (cairo_surface_t *surface);
2126     ///
2127      cairo_format_t
2128     cairo_image_surface_get_format (cairo_surface_t *surface);
2129     ///
2130      int
2131     cairo_image_surface_get_width (cairo_surface_t *surface);
2132     ///
2133      int
2134     cairo_image_surface_get_height (cairo_surface_t *surface);
2135     ///
2136      int
2137     cairo_image_surface_get_stride (cairo_surface_t *surface);
2138 
2139     static if(CAIRO_HAS_PNG_FUNCTIONS)
2140     {
2141     ///requires -version=CAIRO_HAS_PNG_FUNCTIONS
2142      cairo_surface_t *
2143     cairo_image_surface_create_from_png (const char	*filename);
2144     ///ditto
2145      cairo_surface_t *
2146     cairo_image_surface_create_from_png_stream (cairo_read_func_t	read_func,
2147                             void		*closure);
2148 
2149     }
2150 
2151     /** Recording-surface functions */
2152 
2153      cairo_surface_t *
2154     cairo_recording_surface_create (cairo_content_t		 content,
2155                                     const cairo_rectangle_t *extents);
2156     ///ditto
2157      void
2158     cairo_recording_surface_ink_extents (cairo_surface_t *surface,
2159                                          double *x0,
2160                                          double *y0,
2161                                          double *width,
2162                                          double *height);
2163 
2164     /** Pattern creation functions */
2165 
2166      cairo_pattern_t *
2167     cairo_pattern_create_rgb (double red, double green, double blue);
2168     ///ditto
2169      cairo_pattern_t *
2170     cairo_pattern_create_rgba (double red, double green, double blue,
2171                    double alpha);
2172     ///ditto
2173      cairo_pattern_t *
2174     cairo_pattern_create_for_surface (cairo_surface_t *surface);
2175     ///ditto
2176      cairo_pattern_t *
2177     cairo_pattern_create_linear (double x0, double y0,
2178                      double x1, double y1);
2179     ///ditto
2180      cairo_pattern_t *
2181     cairo_pattern_create_radial (double cx0, double cy0, double radius0,
2182                      double cx1, double cy1, double radius1);
2183     ///ditto
2184      cairo_pattern_t *
2185     cairo_pattern_reference (cairo_pattern_t *pattern);
2186     ///ditto
2187      void
2188     cairo_pattern_destroy (cairo_pattern_t *pattern);
2189     ///ditto
2190      uint
2191     cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
2192     ///ditto
2193      cairo_status_t
2194     cairo_pattern_status (cairo_pattern_t *pattern);
2195     ///ditto
2196      void *
2197     cairo_pattern_get_user_data (cairo_pattern_t		 *pattern,
2198                      const cairo_user_data_key_t *key);
2199     ///ditto
2200      cairo_status_t
2201     cairo_pattern_set_user_data (cairo_pattern_t		 *pattern,
2202                      const cairo_user_data_key_t *key,
2203                      void			 *user_data,
2204                      cairo_destroy_func_t	  destroy);
2205 
2206     /**
2207      * $(D cairo_pattern_type_t) is used to describe the type of a given pattern.
2208      *
2209      * The type of a pattern is determined by the function used to create
2210      * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
2211      * functions create SOLID patterns. The remaining
2212      * cairo_pattern_create<...> functions map to pattern types in obvious
2213      * ways.
2214      *
2215      * The pattern type can be queried with cairo_pattern_get_type()
2216      *
2217      * Most $(D cairo_pattern_t) functions can be called with a pattern of any
2218      * type, (though trying to change the extend or filter for a solid
2219      * pattern will have no effect). A notable exception is
2220      * cairo_pattern_add_color_stop_rgb() and
2221      * cairo_pattern_add_color_stop_rgba() which must only be called with
2222      * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
2223      * will be shutdown and put into an error state.
2224      *
2225      * New entries may be added in future versions.
2226      *
2227      * Since: 1.2
2228      **/
2229     enum cairo_pattern_type_t
2230     {
2231         /**
2232          * The pattern is a solid (uniform)
2233          * color. It may be opaque or translucent.
2234          */
2235         CAIRO_PATTERN_TYPE_SOLID,
2236         CAIRO_PATTERN_TYPE_SURFACE, ///The pattern is a based on a surface (an image).
2237         CAIRO_PATTERN_TYPE_LINEAR, ///The pattern is a linear gradient.
2238         CAIRO_PATTERN_TYPE_RADIAL ///The pattern is a radial gradient.
2239     }
2240     ///
2241      cairo_pattern_type_t
2242     cairo_pattern_get_type (cairo_pattern_t *pattern);
2243     ///
2244      void
2245     cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
2246                       double offset,
2247                       double red, double green, double blue);
2248     ///
2249      void
2250     cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
2251                        double offset,
2252                        double red, double green, double blue,
2253                        double alpha);
2254     ///
2255      void
2256     cairo_pattern_set_matrix (cairo_pattern_t      *pattern,
2257                   const cairo_matrix_t *matrix);
2258     ///
2259      void
2260     cairo_pattern_get_matrix (cairo_pattern_t *pattern,
2261                   cairo_matrix_t  *matrix);
2262 
2263     /**
2264      * $(D cairo_extend_t) is used to describe how pattern color/alpha will be
2265      * determined for areas "outside" the pattern's natural area, (for
2266      * example, outside the surface bounds or outside the gradient
2267      * geometry).
2268      *
2269      * The default extend mode is $(D CAIRO_EXTEND_NONE) for surface patterns
2270      * and $(D CAIRO_EXTEND_PAD) for gradient patterns.
2271      *
2272      * New entries may be added in future versions.
2273      **/
2274     enum cairo_extend_t
2275     {
2276         /**
2277          * pixels outside of the source pattern
2278          * are fully transparent
2279          */
2280         CAIRO_EXTEND_NONE,
2281         CAIRO_EXTEND_REPEAT, ///the pattern is tiled by repeating
2282         /**
2283          * the pattern is tiled by reflecting
2284          * at the edges (Implemented for surface patterns since 1.6)
2285          */
2286         CAIRO_EXTEND_REFLECT,
2287         /**
2288          * pixels outside of the pattern copy
2289          * the closest pixel from the source (Since 1.2; but only
2290          * implemented for surface patterns since 1.6)
2291          */
2292         CAIRO_EXTEND_PAD
2293     }
2294     ///
2295      void
2296     cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
2297     ///
2298      cairo_extend_t
2299     cairo_pattern_get_extend (cairo_pattern_t *pattern);
2300 
2301     /**
2302      * $(D cairo_filter_t) is used to indicate what filtering should be
2303      * applied when reading pixel values from patterns. See
2304      * cairo_pattern_set_source() for indicating the desired filter to be
2305      * used with a particular pattern.
2306      */
2307     enum cairo_filter_t
2308     {
2309         /**
2310          * A high-performance filter, with quality similar
2311          * to %CAIRO_FILTER_NEAREST
2312          */
2313         CAIRO_FILTER_FAST,
2314         /**
2315          * A reasonable-performance filter, with quality
2316          * similar to %CAIRO_FILTER_BILINEAR
2317          */
2318         CAIRO_FILTER_GOOD,
2319         /**
2320          * The highest-quality available, performance may
2321          * not be suitable for interactive use.
2322          */
2323         CAIRO_FILTER_BEST,
2324         /**
2325          * Nearest-neighbor filtering
2326          */
2327         CAIRO_FILTER_NEAREST,
2328         /**
2329          * Linear interpolation in two dimensions
2330          */
2331         CAIRO_FILTER_BILINEAR,
2332         /**
2333          * This filter value is currently
2334          * unimplemented, and should not be used in current code.
2335          */
2336         CAIRO_FILTER_GAUSSIAN
2337     }
2338     ///
2339      void
2340     cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
2341     ///
2342      cairo_filter_t
2343     cairo_pattern_get_filter (cairo_pattern_t *pattern);
2344     ///
2345      cairo_status_t
2346     cairo_pattern_get_rgba (cairo_pattern_t *pattern,
2347                 double *red, double *green,
2348                 double *blue, double *alpha);
2349     ///
2350      cairo_status_t
2351     cairo_pattern_get_surface (cairo_pattern_t *pattern,
2352                    cairo_surface_t **surface);
2353 
2354     ///
2355      cairo_status_t
2356     cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,
2357                        int index, double *offset,
2358                        double *red, double *green,
2359                        double *blue, double *alpha);
2360     ///
2361      cairo_status_t
2362     cairo_pattern_get_color_stop_count (cairo_pattern_t *pattern,
2363                         int *count);
2364     ///
2365      cairo_status_t
2366     cairo_pattern_get_linear_points (cairo_pattern_t *pattern,
2367                      double *x0, double *y0,
2368                      double *x1, double *y1);
2369     ///
2370      cairo_status_t
2371     cairo_pattern_get_radial_circles (cairo_pattern_t *pattern,
2372                       double *x0, double *y0, double *r0,
2373                       double *x1, double *y1, double *r1);
2374 
2375     /** Matrix functions */
2376 
2377      void
2378     cairo_matrix_init (cairo_matrix_t *matrix,
2379                double  xx, double  yx,
2380                double  xy, double  yy,
2381                double  x0, double  y0);
2382     ///ditto
2383      void
2384     cairo_matrix_init_identity (cairo_matrix_t *matrix);
2385     ///ditto
2386      void
2387     cairo_matrix_init_translate (cairo_matrix_t *matrix,
2388                      double tx, double ty);
2389     ///ditto
2390      void
2391     cairo_matrix_init_scale (cairo_matrix_t *matrix,
2392                  double sx, double sy);
2393     ///ditto
2394      void
2395     cairo_matrix_init_rotate (cairo_matrix_t *matrix,
2396                   double radians);
2397     ///ditto
2398      void
2399     cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
2400     ///ditto
2401      void
2402     cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
2403     ///ditto
2404      void
2405     cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
2406     ///ditto
2407      cairo_status_t
2408     cairo_matrix_invert (cairo_matrix_t *matrix);
2409     ///ditto
2410      void
2411     cairo_matrix_multiply (cairo_matrix_t	    *result,
2412                    const cairo_matrix_t *a,
2413                    const cairo_matrix_t *b);
2414     ///ditto
2415      void
2416     cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
2417                      double *dx, double *dy);
2418     ///ditto
2419      void
2420     cairo_matrix_transform_point (const cairo_matrix_t *matrix,
2421                       double *x, double *y);
2422 
2423     /* Region functions */
2424 
2425     /**
2426      * A $(D cairo_region_t) represents a set of integer-aligned rectangles.
2427      *
2428      * It allows set-theoretical operations like cairo_region_union() and
2429      * cairo_region_intersect() to be performed on them.
2430      *
2431      * Memory management of $(D cairo_region_t) is done with
2432      * cairo_region_reference() and cairo_region_destroy().
2433      *
2434      * Since: 1.10
2435      **/
2436     struct cairo_region_t {};
2437 
2438     /**
2439      * A data structure for holding a rectangle with integer coordinates.
2440      *
2441      * Since: 1.10
2442      **/
2443 
2444     struct cairo_rectangle_int_t
2445     {
2446         int x; ///X coordinate of the left side of the rectangle
2447         int y; ///Y coordinate of the the top side of the rectangle
2448         int width; ///width of the rectangle
2449         int height; ///height of the rectangle
2450     }
2451     ///
2452     enum cairo_region_overlap_t
2453     {
2454         CAIRO_REGION_OVERLAP_IN,		/** completely inside region */
2455         CAIRO_REGION_OVERLAP_OUT,		/** completely outside region */
2456         CAIRO_REGION_OVERLAP_PART		/** partly inside region */
2457     }
2458     ///
2459      cairo_region_t *
2460     cairo_region_create ();
2461     ///
2462      cairo_region_t *
2463     cairo_region_create_rectangle (const cairo_rectangle_int_t *rectangle);
2464     ///
2465      cairo_region_t *
2466     cairo_region_create_rectangles (const cairo_rectangle_int_t *rects,
2467                     int count);
2468     ///
2469      cairo_region_t *
2470     cairo_region_copy (const cairo_region_t *original);
2471     ///
2472      cairo_region_t *
2473     cairo_region_reference (cairo_region_t *region);
2474     ///
2475      void
2476     cairo_region_destroy (cairo_region_t *region);
2477     ///
2478      cairo_bool_t
2479     cairo_region_equal (const cairo_region_t *a, const cairo_region_t *b);
2480     ///
2481      cairo_status_t
2482     cairo_region_status (const cairo_region_t *region);
2483     ///
2484      void
2485     cairo_region_get_extents (const cairo_region_t        *region,
2486                   cairo_rectangle_int_t *extents);
2487     ///
2488      int
2489     cairo_region_num_rectangles (const cairo_region_t *region);
2490     ///
2491      void
2492     cairo_region_get_rectangle (const cairo_region_t  *region,
2493                     int                    nth,
2494                     cairo_rectangle_int_t *rectangle);
2495     ///
2496      cairo_bool_t
2497     cairo_region_is_empty (const cairo_region_t *region);
2498     ///
2499      cairo_region_overlap_t
2500     cairo_region_contains_rectangle (const cairo_region_t *region,
2501                      const cairo_rectangle_int_t *rectangle);
2502     ///
2503      cairo_bool_t
2504     cairo_region_contains_point (const cairo_region_t *region, int x, int y);
2505     ///
2506      void
2507     cairo_region_translate (cairo_region_t *region, int dx, int dy);
2508     ///
2509      cairo_status_t
2510     cairo_region_subtract (cairo_region_t *dst, const cairo_region_t *other);
2511     ///
2512      cairo_status_t
2513     cairo_region_subtract_rectangle (cairo_region_t *dst,
2514                      const cairo_rectangle_int_t *rectangle);
2515     ///
2516      cairo_status_t
2517     cairo_region_intersect (cairo_region_t *dst, const cairo_region_t *other);
2518     ///
2519      cairo_status_t
2520     cairo_region_intersect_rectangle (cairo_region_t *dst,
2521                       const cairo_rectangle_int_t *rectangle);
2522     ///
2523      cairo_status_t
2524     cairo_region_union (cairo_region_t *dst, const cairo_region_t *other);
2525     ///
2526      cairo_status_t
2527     cairo_region_union_rectangle (cairo_region_t *dst,
2528                       const cairo_rectangle_int_t *rectangle);
2529     ///
2530      cairo_status_t
2531     cairo_region_xor (cairo_region_t *dst, const cairo_region_t *other);
2532     ///
2533      cairo_status_t
2534     cairo_region_xor_rectangle (cairo_region_t *dst,
2535                     const cairo_rectangle_int_t *rectangle);
2536 
2537     /** Functions to be used while debugging (not intended for use in production code) */
2538      void
2539     cairo_debug_reset_static_data ();
2540 }