some updates
[iv.d.git] / cairo.d
blob54b6ae19efac270d78ae19fc3f863201cfb5caa2
1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2002 University of Southern California
4 * Copyright © 2005 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it either under the terms of the GNU Lesser General Public
8 * License version 2.1 as published by the Free Software Foundation
9 * (the "LGPL") or, at your option, under the terms of the Mozilla
10 * Public License Version 1.1 (the "MPL"). If you do not alter this
11 * notice, a recipient may use your version of this file under either
12 * the MPL or the LGPL.
14 * You should have received a copy of the LGPL along with this library
15 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17 * You should have received a copy of the MPL along with this library
18 * in the file COPYING-MPL-1.1
20 * The contents of this file are subject to the Mozilla Public License
21 * Version 1.1 (the "License"); you may not use this file except in
22 * compliance with the License. You may obtain a copy of the License at
23 * http://www.mozilla.org/MPL/
25 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27 * the specific language governing rights and limitations.
29 * The Original Code is the cairo graphics library.
31 * The Initial Developer of the Original Code is University of Southern
32 * California.
34 * Contributor(s):
35 * Carl D. Worth <cworth@cworth.org>
37 module iv.cairo /*is aliced*/;
38 import iv.alice;
39 import core.stdc.config : c_long, c_ulong;
41 extern(C) nothrow:
43 pragma(lib, "cairo");
45 enum CAIRO_VERSION_MAJOR = 1;
46 enum CAIRO_VERSION_MINOR = 14;
47 enum CAIRO_VERSION_MICRO = 6;
49 /* Generated by configure. Do not edit. */
50 enum CAIRO_HAS_EGL_FUNCTIONS = false; // was true
51 enum CAIRO_HAS_FC_FONT = true;
52 enum CAIRO_HAS_FT_FONT = true;
53 enum CAIRO_HAS_GLX_FUNCTIONS = false; // was true
54 enum CAIRO_HAS_GL_SURFACE = true;
55 enum CAIRO_HAS_GOBJECT_FUNCTIONS = false; // was true
56 enum CAIRO_HAS_IMAGE_SURFACE = true;
57 enum CAIRO_HAS_MIME_SURFACE = true;
58 enum CAIRO_HAS_OBSERVER_SURFACE = true;
59 enum CAIRO_HAS_PDF_SURFACE = true;
60 enum CAIRO_HAS_PNG_FUNCTIONS = true;
61 enum CAIRO_HAS_PS_SURFACE = true;
62 enum CAIRO_HAS_RECORDING_SURFACE = true;
63 enum CAIRO_HAS_SCRIPT_SURFACE = true;
64 enum CAIRO_HAS_SVG_SURFACE = true;
65 enum CAIRO_HAS_TEE_SURFACE = true;
66 enum CAIRO_HAS_USER_FONT = true;
67 enum CAIRO_HAS_XCB_SHM_FUNCTIONS = false; // was true
68 enum CAIRO_HAS_XCB_SURFACE = false; // was true
69 enum CAIRO_HAS_XLIB_SURFACE = true;
70 enum CAIRO_HAS_XLIB_XRENDER_SURFACE = false; // was true
71 enum CAIRO_HAS_XML_SURFACE = true;
73 enum CAIRO_HAS_BEOS_SURFACE = false;
74 enum CAIRO_HAS_COGL_SURFACE = false;
75 enum CAIRO_HAS_DIRECTFB_SURFACE = false;
76 enum CAIRO_HAS_DRM_SURFACE = false;
77 enum CAIRO_HAS_GALLIUM_SURFACE = false;
78 enum CAIRO_HAS_GLESV2_SURFACE = false;
79 enum CAIRO_HAS_OS2_SURFACE = false;
80 enum CAIRO_HAS_QT_SURFACE = false;
81 enum CAIRO_HAS_QUARTZ_FONT = false;
82 enum CAIRO_HAS_QUARTZ_IMAGE_SURFACE = false;
83 enum CAIRO_HAS_QUARTZ_SURFACE = false;
84 enum CAIRO_HAS_SKIA_SURFACE = false;
85 enum CAIRO_HAS_VG_SURFACE = false;
86 enum CAIRO_HAS_WGL_FUNCTIONS = false;
87 enum CAIRO_HAS_WIN32_FONT = false;
88 enum CAIRO_HAS_WIN32_SURFACE = false;
89 enum CAIRO_HAS_XLIB_XCB_FUNCTIONS = false;
91 static if (CAIRO_HAS_PNG_FUNCTIONS) pragma(lib, "png16");
92 static if (CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLX_FUNCTIONS) pragma(lib, "GL");
93 static if (CAIRO_HAS_FC_FONT) pragma(lib, "fontconfig");
94 static if (CAIRO_HAS_FT_FONT) pragma(lib, "freetype");
96 static if (CAIRO_HAS_XLIB_XRENDER_SURFACE) { pragma(lib, "X11"); pragma(lib, "Xext"); pragma(lib, "Xrender"); }
97 else static if (CAIRO_HAS_XLIB_SURFACE) { pragma(lib, "X11"); pragma(lib, "Xext"); }
101 #define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
102 ((major) * 10000) \
103 + ((minor) * 100) \
104 + ((micro) * 1))
106 #define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
107 CAIRO_VERSION_MAJOR, \
108 CAIRO_VERSION_MINOR, \
109 CAIRO_VERSION_MICRO)
112 #define CAIRO_VERSION_STRINGIZE_(major, minor, micro) \
113 #major"."#minor"."#micro
114 #define CAIRO_VERSION_STRINGIZE(major, minor, micro) \
115 CAIRO_VERSION_STRINGIZE_(major, minor, micro)
117 #define CAIRO_VERSION_STRING CAIRO_VERSION_STRINGIZE( \
118 CAIRO_VERSION_MAJOR, \
119 CAIRO_VERSION_MINOR, \
120 CAIRO_VERSION_MICRO)
123 /*cairo_public*/ int cairo_version ();
125 /*cairo_public*/ const(char)* cairo_version_string ();
128 * cairo_bool_t:
130 * #cairo_bool_t is used for boolean values. Returns of type
131 * #cairo_bool_t will always be either 0 or 1, but testing against
132 * these values explicitly is not encouraged; just use the
133 * value as a boolean condition.
135 * <informalexample><programlisting>
136 * if (cairo_in_stroke (cr, x, y)) {
137 * /<!-- -->* do something *<!-- -->/
139 * </programlisting></informalexample>
141 * Since: 1.0
143 alias cairo_bool_t = int;
146 * cairo_t:
148 * A #cairo_t contains the current state of the rendering device,
149 * including coordinates of yet to be drawn shapes.
151 * Cairo contexts, as #cairo_t objects are named, are central to
152 * cairo and all drawing with cairo is always done to a #cairo_t
153 * object.
155 * Memory management of #cairo_t is done with
156 * cairo_reference() and cairo_destroy().
158 * Since: 1.0
160 struct cairo_t;
163 * cairo_surface_t:
165 * A #cairo_surface_t represents an image, either as the destination
166 * of a drawing operation or as source when drawing onto another
167 * surface. To draw to a #cairo_surface_t, create a cairo context
168 * with the surface as the target, using cairo_create().
170 * There are different subtypes of #cairo_surface_t for
171 * different drawing backends; for example, cairo_image_surface_create()
172 * creates a bitmap image in memory.
173 * The type of a surface can be queried with cairo_surface_get_type().
175 * The initial contents of a surface after creation depend upon the manner
176 * of its creation. If cairo creates the surface and backing storage for
177 * the user, it will be initially cleared; for example,
178 * cairo_image_surface_create() and cairo_surface_create_similar().
179 * Alternatively, if the user passes in a reference to some backing storage
180 * and asks cairo to wrap that in a #cairo_surface_t, then the contents are
181 * not modified; for example, cairo_image_surface_create_for_data() and
182 * cairo_xlib_surface_create().
184 * Memory management of #cairo_surface_t is done with
185 * cairo_surface_reference() and cairo_surface_destroy().
187 * Since: 1.0
189 struct cairo_surface_t;
192 * cairo_device_t:
194 * A #cairo_device_t represents the driver interface for drawing
195 * operations to a #cairo_surface_t. There are different subtypes of
196 * #cairo_device_t for different drawing backends; for example,
197 * cairo_egl_device_create() creates a device that wraps an EGL display and
198 * context.
200 * The type of a device can be queried with cairo_device_get_type().
202 * Memory management of #cairo_device_t is done with
203 * cairo_device_reference() and cairo_device_destroy().
205 * Since: 1.10
207 struct cairo_device_t;
210 * cairo_matrix_t:
211 * @xx: xx component of the affine transformation
212 * @yx: yx component of the affine transformation
213 * @xy: xy component of the affine transformation
214 * @yy: yy component of the affine transformation
215 * @x0: X translation component of the affine transformation
216 * @y0: Y translation component of the affine transformation
218 * A #cairo_matrix_t holds an affine transformation, such as a scale,
219 * rotation, shear, or a combination of those. The transformation of
220 * a point (x, y) is given by:
221 * <programlisting>
222 * x_new = xx * x + xy * y + x0;
223 * y_new = yx * x + yy * y + y0;
224 * </programlisting>
226 * Since: 1.0
228 struct cairo_matrix_t {
229 double xx; double yx;
230 double xy; double yy;
231 double x0; double y0;
235 * cairo_pattern_t:
237 * A #cairo_pattern_t represents a source when drawing onto a
238 * surface. There are different subtypes of #cairo_pattern_t,
239 * for different types of sources; for example,
240 * cairo_pattern_create_rgb() creates a pattern for a solid
241 * opaque color.
243 * Other than various
244 * <function>cairo_pattern_create_<emphasis>type</emphasis>()</function>
245 * functions, some of the pattern types can be implicitly created using various
246 * <function>cairo_set_source_<emphasis>type</emphasis>()</function> functions;
247 * for example cairo_set_source_rgb().
249 * The type of a pattern can be queried with cairo_pattern_get_type().
251 * Memory management of #cairo_pattern_t is done with
252 * cairo_pattern_reference() and cairo_pattern_destroy().
254 * Since: 1.0
256 struct cairo_pattern_t;
259 * cairo_destroy_func_t:
260 * @data: The data element being destroyed.
262 * #cairo_destroy_func_t the type of function which is called when a
263 * data element is destroyed. It is passed the pointer to the data
264 * element and should free any memory and resources allocated for it.
266 * Since: 1.0
268 alias cairo_destroy_func_t = void function (void* data);
271 * cairo_user_data_key_t:
272 * @unused: not used; ignore.
274 * #cairo_user_data_key_t is used for attaching user data to cairo
275 * data structures. The actual contents of the struct is never used,
276 * and there is no need to initialize the object; only the unique
277 * address of a #cairo_data_key_t object is used. Typically, you
278 * would just use the address of a static #cairo_data_key_t object.
280 * Since: 1.0
282 struct cairo_user_data_key_t {
283 int unused;
287 * cairo_status_t:
288 * @CAIRO_STATUS_SUCCESS: no error has occurred (Since 1.0)
289 * @CAIRO_STATUS_NO_MEMORY: out of memory (Since 1.0)
290 * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save() (Since 1.0)
291 * @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop, i.e. cairo_pop_group() without matching cairo_push_group() (Since 1.0)
292 * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined (Since 1.0)
293 * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible) (Since 1.0)
294 * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input #cairo_status_t (Since 1.0)
295 * @CAIRO_STATUS_NULL_POINTER: %NULL pointer (Since 1.0)
296 * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8 (Since 1.0)
297 * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid (Since 1.0)
298 * @CAIRO_STATUS_READ_ERROR: error while reading from input stream (Since 1.0)
299 * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream (Since 1.0)
300 * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished (Since 1.0)
301 * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation (Since 1.0)
302 * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation (Since 1.0)
303 * @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input #cairo_content_t (Since 1.0)
304 * @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input #cairo_format_t (Since 1.0)
305 * @CAIRO_STATUS_INVALID_VISUAL: invalid value for an input Visual* (Since 1.0)
306 * @CAIRO_STATUS_FILE_NOT_FOUND: file not found (Since 1.0)
307 * @CAIRO_STATUS_INVALID_DASH: invalid value for a dash setting (Since 1.0)
308 * @CAIRO_STATUS_INVALID_DSC_COMMENT: invalid value for a DSC comment (Since 1.2)
309 * @CAIRO_STATUS_INVALID_INDEX: invalid index passed to getter (Since 1.4)
310 * @CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: clip region not representable in desired format (Since 1.4)
311 * @CAIRO_STATUS_TEMP_FILE_ERROR: error creating or writing to a temporary file (Since 1.6)
312 * @CAIRO_STATUS_INVALID_STRIDE: invalid value for stride (Since 1.6)
313 * @CAIRO_STATUS_FONT_TYPE_MISMATCH: the font type is not appropriate for the operation (Since 1.8)
314 * @CAIRO_STATUS_USER_FONT_IMMUTABLE: the user-font is immutable (Since 1.8)
315 * @CAIRO_STATUS_USER_FONT_ERROR: error occurred in a user-font callback function (Since 1.8)
316 * @CAIRO_STATUS_NEGATIVE_COUNT: negative number used where it is not allowed (Since 1.8)
317 * @CAIRO_STATUS_INVALID_CLUSTERS: input clusters do not represent the accompanying text and glyph array (Since 1.8)
318 * @CAIRO_STATUS_INVALID_SLANT: invalid value for an input #cairo_font_slant_t (Since 1.8)
319 * @CAIRO_STATUS_INVALID_WEIGHT: invalid value for an input #cairo_font_weight_t (Since 1.8)
320 * @CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for the size of the input (surface, pattern, etc.) (Since 1.10)
321 * @CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: user-font method not implemented (Since 1.10)
322 * @CAIRO_STATUS_DEVICE_TYPE_MISMATCH: the device type is not appropriate for the operation (Since 1.10)
323 * @CAIRO_STATUS_DEVICE_ERROR: an operation to the device caused an unspecified error (Since 1.10)
324 * @CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: a mesh pattern
325 * construction operation was used outside of a
326 * cairo_mesh_pattern_begin_patch()/cairo_mesh_pattern_end_patch()
327 * pair (Since 1.12)
328 * @CAIRO_STATUS_DEVICE_FINISHED: target device has been finished (Since 1.12)
329 * @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
330 * but no image provided %CAIRO_MIME_TYPE_JBIG2_GLOBAL (Since 1.14)
331 * @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
332 * status values defined in this enumeration. When using this value, note
333 * that the version of cairo at run-time may have additional status values
334 * defined than the value of this symbol at compile-time. (Since 1.10)
336 * #cairo_status_t is used to indicate errors that can occur when
337 * using Cairo. In some cases it is returned directly by functions.
338 * but when using #cairo_t, the last error, if any, is stored in
339 * the context and can be retrieved with cairo_status().
341 * New entries may be added in future versions. Use cairo_status_to_string()
342 * to get a human-readable representation of an error message.
344 * Since: 1.0
346 alias cairo_status_t = int;
347 enum : cairo_status_t {
348 CAIRO_STATUS_SUCCESS = 0,
350 CAIRO_STATUS_NO_MEMORY,
351 CAIRO_STATUS_INVALID_RESTORE,
352 CAIRO_STATUS_INVALID_POP_GROUP,
353 CAIRO_STATUS_NO_CURRENT_POINT,
354 CAIRO_STATUS_INVALID_MATRIX,
355 CAIRO_STATUS_INVALID_STATUS,
356 CAIRO_STATUS_NULL_POINTER,
357 CAIRO_STATUS_INVALID_STRING,
358 CAIRO_STATUS_INVALID_PATH_DATA,
359 CAIRO_STATUS_READ_ERROR,
360 CAIRO_STATUS_WRITE_ERROR,
361 CAIRO_STATUS_SURFACE_FINISHED,
362 CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
363 CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
364 CAIRO_STATUS_INVALID_CONTENT,
365 CAIRO_STATUS_INVALID_FORMAT,
366 CAIRO_STATUS_INVALID_VISUAL,
367 CAIRO_STATUS_FILE_NOT_FOUND,
368 CAIRO_STATUS_INVALID_DASH,
369 CAIRO_STATUS_INVALID_DSC_COMMENT,
370 CAIRO_STATUS_INVALID_INDEX,
371 CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
372 CAIRO_STATUS_TEMP_FILE_ERROR,
373 CAIRO_STATUS_INVALID_STRIDE,
374 CAIRO_STATUS_FONT_TYPE_MISMATCH,
375 CAIRO_STATUS_USER_FONT_IMMUTABLE,
376 CAIRO_STATUS_USER_FONT_ERROR,
377 CAIRO_STATUS_NEGATIVE_COUNT,
378 CAIRO_STATUS_INVALID_CLUSTERS,
379 CAIRO_STATUS_INVALID_SLANT,
380 CAIRO_STATUS_INVALID_WEIGHT,
381 CAIRO_STATUS_INVALID_SIZE,
382 CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
383 CAIRO_STATUS_DEVICE_TYPE_MISMATCH,
384 CAIRO_STATUS_DEVICE_ERROR,
385 CAIRO_STATUS_INVALID_MESH_CONSTRUCTION,
386 CAIRO_STATUS_DEVICE_FINISHED,
387 CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
389 CAIRO_STATUS_LAST_STATUS
393 * cairo_content_t:
394 * @CAIRO_CONTENT_COLOR: The surface will hold color content only. (Since 1.0)
395 * @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only. (Since 1.0)
396 * @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content. (Since 1.0)
398 * #cairo_content_t is used to describe the content that a surface will
399 * contain, whether color information, alpha information (translucence
400 * vs. opacity), or both.
402 * Note: The large values here are designed to keep #cairo_content_t
403 * values distinct from #cairo_format_t values so that the
404 * implementation can detect the error if users confuse the two types.
406 * Since: 1.0
408 alias cairo_content_t = int;
409 enum : cairo_content_t {
410 CAIRO_CONTENT_COLOR = 0x1000,
411 CAIRO_CONTENT_ALPHA = 0x2000,
412 CAIRO_CONTENT_COLOR_ALPHA = 0x3000
416 * cairo_format_t:
417 * @CAIRO_FORMAT_INVALID: no such format exists or is supported.
418 * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
419 * alpha in the upper 8 bits, then red, then green, then blue.
420 * The 32-bit quantities are stored native-endian. Pre-multiplied
421 * alpha is used. (That is, 50% transparent red is 0x80800000,
422 * not 0x80ff0000.) (Since 1.0)
423 * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
424 * the upper 8 bits unused. Red, Green, and Blue are stored
425 * in the remaining 24 bits in that order. (Since 1.0)
426 * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
427 * an alpha value. (Since 1.0)
428 * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
429 * an alpha value. Pixels are packed together into 32-bit
430 * quantities. The ordering of the bits matches the
431 * endianess of the platform. On a big-endian machine, the
432 * first pixel is in the uppermost bit, on a little-endian
433 * machine the first pixel is in the least-significant bit. (Since 1.0)
434 * @CAIRO_FORMAT_RGB16_565: each pixel is a 16-bit quantity
435 * with red in the upper 5 bits, then green in the middle
436 * 6 bits, and blue in the lower 5 bits. (Since 1.2)
437 * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12)
439 * #cairo_format_t is used to identify the memory format of
440 * image data.
442 * New entries may be added in future versions.
444 * Since: 1.0
446 alias cairo_format_t = int;
447 enum : cairo_format_t {
448 CAIRO_FORMAT_INVALID = -1,
449 CAIRO_FORMAT_ARGB32 = 0,
450 CAIRO_FORMAT_RGB24 = 1,
451 CAIRO_FORMAT_A8 = 2,
452 CAIRO_FORMAT_A1 = 3,
453 CAIRO_FORMAT_RGB16_565 = 4,
454 CAIRO_FORMAT_RGB30 = 5
459 * cairo_write_func_t:
460 * @closure: the output closure
461 * @data: the buffer containing the data to write
462 * @length: the amount of data to write
464 * #cairo_write_func_t is the type of function which is called when a
465 * backend needs to write data to an output stream. It is passed the
466 * closure which was specified by the user at the time the write
467 * function was registered, the data to write and the length of the
468 * data in bytes. The write function should return
469 * %CAIRO_STATUS_SUCCESS if all the data was successfully written,
470 * %CAIRO_STATUS_WRITE_ERROR otherwise.
472 * Returns: the status code of the write operation
474 * Since: 1.0
476 alias cairo_write_func_t = cairo_status_t function (void* closure, const(ubyte)* data, uint length);
479 * cairo_read_func_t:
480 * @closure: the input closure
481 * @data: the buffer into which to read the data
482 * @length: the amount of data to read
484 * #cairo_read_func_t is the type of function which is called when a
485 * backend needs to read data from an input stream. It is passed the
486 * closure which was specified by the user at the time the read
487 * function was registered, the buffer to read the data into and the
488 * length of the data in bytes. The read function should return
489 * %CAIRO_STATUS_SUCCESS if all the data was successfully read,
490 * %CAIRO_STATUS_READ_ERROR otherwise.
492 * Returns: the status code of the read operation
494 * Since: 1.0
496 alias cairo_read_func_t = cairo_status_t function (void* closure, ubyte* data, uint length);
499 * cairo_rectangle_int_t:
500 * @x: X coordinate of the left side of the rectangle
501 * @y: Y coordinate of the the top side of the rectangle
502 * @width: width of the rectangle
503 * @height: height of the rectangle
505 * A data structure for holding a rectangle with integer coordinates.
507 * Since: 1.10
510 struct cairo_rectangle_int_t {
511 int x, y;
512 int width, height;
516 /* Functions for manipulating state objects */
517 /*cairo_public*/ cairo_t* cairo_create (cairo_surface_t* target);
518 /*cairo_public*/ cairo_t* cairo_reference (cairo_t* cr);
519 /*cairo_public*/ void cairo_destroy (cairo_t* cr);
520 /*cairo_public*/ uint cairo_get_reference_count (cairo_t* cr);
521 /*cairo_public*/ void* cairo_get_user_data (cairo_t* cr, const(cairo_user_data_key_t)* key);
522 /*cairo_public*/ cairo_status_t cairo_set_user_data (cairo_t* cr, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
523 /*cairo_public*/ void cairo_save (cairo_t* cr);
524 /*cairo_public*/ void cairo_restore (cairo_t* cr);
525 /*cairo_public*/ void cairo_push_group (cairo_t* cr);
526 /*cairo_public*/ void cairo_push_group_with_content (cairo_t* cr, cairo_content_t content);
527 /*cairo_public*/ cairo_pattern_t* cairo_pop_group (cairo_t* cr);
528 /*cairo_public*/ void cairo_pop_group_to_source (cairo_t* cr);
530 /* Modify state */
533 * cairo_operator_t:
534 * @CAIRO_OPERATOR_CLEAR: clear destination layer (bounded) (Since 1.0)
535 * @CAIRO_OPERATOR_SOURCE: replace destination layer (bounded) (Since 1.0)
536 * @CAIRO_OPERATOR_OVER: draw source layer on top of destination layer
537 * (bounded) (Since 1.0)
538 * @CAIRO_OPERATOR_IN: draw source where there was destination content
539 * (unbounded) (Since 1.0)
540 * @CAIRO_OPERATOR_OUT: draw source where there was no destination
541 * content (unbounded) (Since 1.0)
542 * @CAIRO_OPERATOR_ATOP: draw source on top of destination content and
543 * only there (Since 1.0)
544 * @CAIRO_OPERATOR_DEST: ignore the source (Since 1.0)
545 * @CAIRO_OPERATOR_DEST_OVER: draw destination on top of source (Since 1.0)
546 * @CAIRO_OPERATOR_DEST_IN: leave destination only where there was
547 * source content (unbounded) (Since 1.0)
548 * @CAIRO_OPERATOR_DEST_OUT: leave destination only where there was no
549 * source content (Since 1.0)
550 * @CAIRO_OPERATOR_DEST_ATOP: leave destination on top of source content
551 * and only there (unbounded) (Since 1.0)
552 * @CAIRO_OPERATOR_XOR: source and destination are shown where there is only
553 * one of them (Since 1.0)
554 * @CAIRO_OPERATOR_ADD: source and destination layers are accumulated (Since 1.0)
555 * @CAIRO_OPERATOR_SATURATE: like over, but assuming source and dest are
556 * disjoint geometries (Since 1.0)
557 * @CAIRO_OPERATOR_MULTIPLY: source and destination layers are multiplied.
558 * This causes the result to be at least as dark as the darker inputs. (Since 1.10)
559 * @CAIRO_OPERATOR_SCREEN: source and destination are complemented and
560 * multiplied. This causes the result to be at least as light as the lighter
561 * inputs. (Since 1.10)
562 * @CAIRO_OPERATOR_OVERLAY: multiplies or screens, depending on the
563 * lightness of the destination color. (Since 1.10)
564 * @CAIRO_OPERATOR_DARKEN: replaces the destination with the source if it
565 * is darker, otherwise keeps the source. (Since 1.10)
566 * @CAIRO_OPERATOR_LIGHTEN: replaces the destination with the source if it
567 * is lighter, otherwise keeps the source. (Since 1.10)
568 * @CAIRO_OPERATOR_COLOR_DODGE: brightens the destination color to reflect
569 * the source color. (Since 1.10)
570 * @CAIRO_OPERATOR_COLOR_BURN: darkens the destination color to reflect
571 * the source color. (Since 1.10)
572 * @CAIRO_OPERATOR_HARD_LIGHT: Multiplies or screens, dependent on source
573 * color. (Since 1.10)
574 * @CAIRO_OPERATOR_SOFT_LIGHT: Darkens or lightens, dependent on source
575 * color. (Since 1.10)
576 * @CAIRO_OPERATOR_DIFFERENCE: Takes the difference of the source and
577 * destination color. (Since 1.10)
578 * @CAIRO_OPERATOR_EXCLUSION: Produces an effect similar to difference, but
579 * with lower contrast. (Since 1.10)
580 * @CAIRO_OPERATOR_HSL_HUE: Creates a color with the hue of the source
581 * and the saturation and luminosity of the target. (Since 1.10)
582 * @CAIRO_OPERATOR_HSL_SATURATION: Creates a color with the saturation
583 * of the source and the hue and luminosity of the target. Painting with
584 * this mode onto a gray area produces no change. (Since 1.10)
585 * @CAIRO_OPERATOR_HSL_COLOR: Creates a color with the hue and saturation
586 * of the source and the luminosity of the target. This preserves the gray
587 * levels of the target and is useful for coloring monochrome images or
588 * tinting color images. (Since 1.10)
589 * @CAIRO_OPERATOR_HSL_LUMINOSITY: Creates a color with the luminosity of
590 * the source and the hue and saturation of the target. This produces an
591 * inverse effect to @CAIRO_OPERATOR_HSL_COLOR. (Since 1.10)
593 * #cairo_operator_t is used to set the compositing operator for all cairo
594 * drawing operations.
596 * The default operator is %CAIRO_OPERATOR_OVER.
598 * The operators marked as <firstterm>unbounded</firstterm> modify their
599 * destination even outside of the mask layer (that is, their effect is not
600 * bound by the mask layer). However, their effect can still be limited by
601 * way of clipping.
603 * To keep things simple, the operator descriptions here
604 * document the behavior for when both source and destination are either fully
605 * transparent or fully opaque. The actual implementation works for
606 * translucent layers too.
607 * For a more detailed explanation of the effects of each operator, including
608 * the mathematical definitions, see
609 * <ulink url="http://cairographics.org/operators/">http://cairographics.org/operators/</ulink>.
611 * Since: 1.0
613 alias cairo_operator_t = int;
614 enum : cairo_operator_t {
615 CAIRO_OPERATOR_CLEAR,
617 CAIRO_OPERATOR_SOURCE,
618 CAIRO_OPERATOR_OVER,
619 CAIRO_OPERATOR_IN,
620 CAIRO_OPERATOR_OUT,
621 CAIRO_OPERATOR_ATOP,
623 CAIRO_OPERATOR_DEST,
624 CAIRO_OPERATOR_DEST_OVER,
625 CAIRO_OPERATOR_DEST_IN,
626 CAIRO_OPERATOR_DEST_OUT,
627 CAIRO_OPERATOR_DEST_ATOP,
629 CAIRO_OPERATOR_XOR,
630 CAIRO_OPERATOR_ADD,
631 CAIRO_OPERATOR_SATURATE,
633 CAIRO_OPERATOR_MULTIPLY,
634 CAIRO_OPERATOR_SCREEN,
635 CAIRO_OPERATOR_OVERLAY,
636 CAIRO_OPERATOR_DARKEN,
637 CAIRO_OPERATOR_LIGHTEN,
638 CAIRO_OPERATOR_COLOR_DODGE,
639 CAIRO_OPERATOR_COLOR_BURN,
640 CAIRO_OPERATOR_HARD_LIGHT,
641 CAIRO_OPERATOR_SOFT_LIGHT,
642 CAIRO_OPERATOR_DIFFERENCE,
643 CAIRO_OPERATOR_EXCLUSION,
644 CAIRO_OPERATOR_HSL_HUE,
645 CAIRO_OPERATOR_HSL_SATURATION,
646 CAIRO_OPERATOR_HSL_COLOR,
647 CAIRO_OPERATOR_HSL_LUMINOSITY
650 /*cairo_public*/ void cairo_set_operator (cairo_t* cr, cairo_operator_t op);
651 /*cairo_public*/ void cairo_set_source (cairo_t* cr, cairo_pattern_t* source);
652 /*cairo_public*/ void cairo_set_source_rgb (cairo_t* cr, double red, double green, double blue);
653 /*cairo_public*/ void cairo_set_source_rgba (cairo_t* cr, double red, double green, double blue, double alpha);
654 /*cairo_public*/ void cairo_set_source_surface (cairo_t* cr, cairo_surface_t* surface, double x, double y);
655 /*cairo_public*/ void cairo_set_tolerance (cairo_t* cr, double tolerance);
658 * cairo_antialias_t:
659 * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for
660 * the subsystem and target device, since 1.0
661 * @CAIRO_ANTIALIAS_NONE: Use a bilevel alpha mask, since 1.0
662 * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using
663 * shades of gray for black text on a white background, for example), since 1.0
664 * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking
665 * advantage of the order of subpixel elements on devices
666 * such as LCD panels, since 1.0
667 * @CAIRO_ANTIALIAS_FAST: Hint that the backend should perform some
668 * antialiasing but prefer speed over quality, since 1.12
669 * @CAIRO_ANTIALIAS_GOOD: The backend should balance quality against
670 * performance, since 1.12
671 * @CAIRO_ANTIALIAS_BEST: Hint that the backend should render at the highest
672 * quality, sacrificing speed if necessary, since 1.12
674 * Specifies the type of antialiasing to do when rendering text or shapes.
676 * As it is not necessarily clear from the above what advantages a particular
677 * antialias method provides, since 1.12, there is also a set of hints:
678 * @CAIRO_ANTIALIAS_FAST: Allow the backend to degrade raster quality for speed
679 * @CAIRO_ANTIALIAS_GOOD: A balance between speed and quality
680 * @CAIRO_ANTIALIAS_BEST: A high-fidelity, but potentially slow, raster mode
682 * These make no guarantee on how the backend will perform its rasterisation
683 * (if it even rasterises!), nor that they have any differing effect other
684 * than to enable some form of antialiasing. In the case of glyph rendering,
685 * @CAIRO_ANTIALIAS_FAST and @CAIRO_ANTIALIAS_GOOD will be mapped to
686 * @CAIRO_ANTIALIAS_GRAY, with @CAIRO_ANTALIAS_BEST being equivalent to
687 * @CAIRO_ANTIALIAS_SUBPIXEL.
689 * The interpretation of @CAIRO_ANTIALIAS_DEFAULT is left entirely up to
690 * the backend, typically this will be similar to @CAIRO_ANTIALIAS_GOOD.
692 * Since: 1.0
694 alias cairo_antialias_t = int;
695 enum : cairo_antialias_t {
696 CAIRO_ANTIALIAS_DEFAULT,
698 /* method */
699 CAIRO_ANTIALIAS_NONE,
700 CAIRO_ANTIALIAS_GRAY,
701 CAIRO_ANTIALIAS_SUBPIXEL,
703 /* hints */
704 CAIRO_ANTIALIAS_FAST,
705 CAIRO_ANTIALIAS_GOOD,
706 CAIRO_ANTIALIAS_BEST
709 /*cairo_public*/ void cairo_set_antialias (cairo_t* cr, cairo_antialias_t antialias);
712 * cairo_fill_rule_t:
713 * @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
714 * left-to-right, counts +1. If the path crosses the ray
715 * from right to left, counts -1. (Left and right are determined
716 * from the perspective of looking along the ray from the starting
717 * point.) If the total count is non-zero, the point will be filled. (Since 1.0)
718 * @CAIRO_FILL_RULE_EVEN_ODD: Counts the total number of
719 * intersections, without regard to the orientation of the contour. If
720 * the total number of intersections is odd, the point will be
721 * filled. (Since 1.0)
723 * #cairo_fill_rule_t is used to select how paths are filled. For both
724 * fill rules, whether or not a point is included in the fill is
725 * determined by taking a ray from that point to infinity and looking
726 * at intersections with the path. The ray can be in any direction,
727 * as long as it doesn't pass through the end point of a segment
728 * or have a tricky intersection such as intersecting tangent to the path.
729 * (Note that filling is not actually implemented in this way. This
730 * is just a description of the rule that is applied.)
732 * The default fill rule is %CAIRO_FILL_RULE_WINDING.
734 * New entries may be added in future versions.
736 * Since: 1.0
738 alias cairo_fill_rule_t = int;
739 enum : cairo_fill_rule_t {
740 CAIRO_FILL_RULE_WINDING,
741 CAIRO_FILL_RULE_EVEN_ODD
744 /*cairo_public*/ void cairo_set_fill_rule (cairo_t* cr, cairo_fill_rule_t fill_rule);
745 /*cairo_public*/ void cairo_set_line_width (cairo_t* cr, double width);
748 * cairo_line_cap_t:
749 * @CAIRO_LINE_CAP_BUTT: start(stop) the line exactly at the start(end) point (Since 1.0)
750 * @CAIRO_LINE_CAP_ROUND: use a round ending, the center of the circle is the end point (Since 1.0)
751 * @CAIRO_LINE_CAP_SQUARE: use squared ending, the center of the square is the end point (Since 1.0)
753 * Specifies how to render the endpoints of the path when stroking.
755 * The default line cap style is %CAIRO_LINE_CAP_BUTT.
757 * Since: 1.0
759 alias cairo_line_cap_t = int;
760 enum : cairo_line_cap_t {
761 CAIRO_LINE_CAP_BUTT,
762 CAIRO_LINE_CAP_ROUND,
763 CAIRO_LINE_CAP_SQUARE
766 /*cairo_public*/ void cairo_set_line_cap (cairo_t* cr, cairo_line_cap_t line_cap);
769 * cairo_line_join_t:
770 * @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
771 * cairo_set_miter_limit() (Since 1.0)
772 * @CAIRO_LINE_JOIN_ROUND: use a rounded join, the center of the circle is the
773 * joint point (Since 1.0)
774 * @CAIRO_LINE_JOIN_BEVEL: use a cut-off join, the join is cut off at half
775 * the line width from the joint point (Since 1.0)
777 * Specifies how to render the junction of two lines when stroking.
779 * The default line join style is %CAIRO_LINE_JOIN_MITER.
781 * Since: 1.0
783 alias cairo_line_join_t = int;
784 enum : cairo_line_join_t {
785 CAIRO_LINE_JOIN_MITER,
786 CAIRO_LINE_JOIN_ROUND,
787 CAIRO_LINE_JOIN_BEVEL
790 /*cairo_public*/ void cairo_set_line_join (cairo_t* cr, cairo_line_join_t line_join);
791 /*cairo_public*/ void cairo_set_dash (cairo_t* cr, const(double)* dashes, int num_dashes, double offset);
792 /*cairo_public*/ void cairo_set_miter_limit (cairo_t* cr, double limit);
793 /*cairo_public*/ void cairo_translate (cairo_t* cr, double tx, double ty);
794 /*cairo_public*/ void cairo_scale (cairo_t* cr, double sx, double sy);
795 /*cairo_public*/ void cairo_rotate (cairo_t* cr, double angle);
796 /*cairo_public*/ void cairo_transform (cairo_t* cr, const(cairo_matrix_t)* matrix);
797 /*cairo_public*/ void cairo_set_matrix (cairo_t* cr, const(cairo_matrix_t)* matrix);
798 /*cairo_public*/ void cairo_identity_matrix (cairo_t* cr);
799 /*cairo_public*/ void cairo_user_to_device (cairo_t* cr, double* x, double* y);
800 /*cairo_public*/ void cairo_user_to_device_distance (cairo_t* cr, double* dx, double* dy);
801 /*cairo_public*/ void cairo_device_to_user (cairo_t* cr, double* x, double* y);
802 /*cairo_public*/ void cairo_device_to_user_distance (cairo_t* cr, double* dx, double* dy);
804 /* Path creation functions */
805 /*cairo_public*/ void cairo_new_path (cairo_t* cr);
806 /*cairo_public*/ void cairo_move_to (cairo_t* cr, double x, double y);
807 /*cairo_public*/ void cairo_new_sub_path (cairo_t* cr);
808 /*cairo_public*/ void cairo_line_to (cairo_t* cr, double x, double y);
809 /*cairo_public*/ void cairo_curve_to (cairo_t* cr, double x1, double y1, double x2, double y2, double x3, double y3);
810 /*cairo_public*/ void cairo_arc (cairo_t* cr, double xc, double yc, double radius, double angle1, double angle2);
811 /*cairo_public*/ void cairo_arc_negative (cairo_t* cr, double xc, double yc, double radius, double angle1, double angle2);
813 /+ XXX: NYI
814 /*cairo_public*/ void cairo_arc_to (cairo_t* cr, double x1, double y1, double x2, double y2, double radius);
817 /*cairo_public*/ void cairo_rel_move_to (cairo_t* cr, double dx, double dy);
818 /*cairo_public*/ void cairo_rel_line_to (cairo_t* cr, double dx, double dy);
819 /*cairo_public*/ void cairo_rel_curve_to (cairo_t* cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
820 /*cairo_public*/ void cairo_rectangle (cairo_t* cr, double x, double y, double width, double height);
822 /+ XXX: NYI
823 /*cairo_public*/ void cairo_stroke_to_path (cairo_t* cr);
826 /*cairo_public*/ void cairo_close_path (cairo_t* cr);
827 /*cairo_public*/ void cairo_path_extents (cairo_t* cr, double* x1, double* y1, double* x2, double* y2);
829 /* Painting functions */
830 /*cairo_public*/ void cairo_paint (cairo_t* cr);
831 /*cairo_public*/ void cairo_paint_with_alpha (cairo_t* cr, double alpha);
832 /*cairo_public*/ void cairo_mask (cairo_t* cr, cairo_pattern_t* pattern);
833 /*cairo_public*/ void cairo_mask_surface (cairo_t* cr, cairo_surface_t* surface, double surface_x, double surface_y);
834 /*cairo_public*/ void cairo_stroke (cairo_t* cr);
835 /*cairo_public*/ void cairo_stroke_preserve (cairo_t* cr);
836 /*cairo_public*/ void cairo_fill (cairo_t* cr);
837 /*cairo_public*/ void cairo_fill_preserve (cairo_t* cr);
838 /*cairo_public*/ void cairo_copy_page (cairo_t* cr);
839 /*cairo_public*/ void cairo_show_page (cairo_t* cr);
841 /* Insideness testing */
842 /*cairo_public*/ cairo_bool_t cairo_in_stroke (cairo_t* cr, double x, double y);
843 /*cairo_public*/ cairo_bool_t cairo_in_fill (cairo_t* cr, double x, double y);
844 /*cairo_public*/ cairo_bool_t cairo_in_clip (cairo_t* cr, double x, double y);
846 /* Rectangular extents */
847 /*cairo_public*/ void cairo_stroke_extents (cairo_t* cr, double* x1, double* y1, double* x2, double* y2);
848 /*cairo_public*/ void cairo_fill_extents (cairo_t* cr, double* x1, double* y1, double* x2, double* y2);
850 /* Clipping */
851 /*cairo_public*/ void cairo_reset_clip (cairo_t* cr);
852 /*cairo_public*/ void cairo_clip (cairo_t* cr);
853 /*cairo_public*/ void cairo_clip_preserve (cairo_t* cr);
854 /*cairo_public*/ void cairo_clip_extents (cairo_t* cr, double* x1, double* y1, double* x2, double* y2);
857 * cairo_rectangle_t:
858 * @x: X coordinate of the left side of the rectangle
859 * @y: Y coordinate of the the top side of the rectangle
860 * @width: width of the rectangle
861 * @height: height of the rectangle
863 * A data structure for holding a rectangle.
865 * Since: 1.4
867 struct cairo_rectangle_t {
868 double x, y, width, height;
872 * cairo_rectangle_list_t:
873 * @status: Error status of the rectangle list
874 * @rectangles: Array containing the rectangles
875 * @num_rectangles: Number of rectangles in this list
877 * A data structure for holding a dynamically allocated
878 * array of rectangles.
880 * Since: 1.4
882 struct cairo_rectangle_list_t {
883 cairo_status_t status;
884 cairo_rectangle_t* rectangles;
885 int num_rectangles;
888 /*cairo_public*/ cairo_rectangle_list_t* cairo_copy_clip_rectangle_list (cairo_t* cr);
889 /*cairo_public*/ void cairo_rectangle_list_destroy (cairo_rectangle_list_t* rectangle_list);
891 /* Font/Text functions */
894 * cairo_scaled_font_t:
896 * A #cairo_scaled_font_t is a font scaled to a particular size and device
897 * resolution. A #cairo_scaled_font_t is most useful for low-level font
898 * usage where a library or application wants to cache a reference
899 * to a scaled font to speed up the computation of metrics.
901 * There are various types of scaled fonts, depending on the
902 * <firstterm>font backend</firstterm> they use. The type of a
903 * scaled font can be queried using cairo_scaled_font_get_type().
905 * Memory management of #cairo_scaled_font_t is done with
906 * cairo_scaled_font_reference() and cairo_scaled_font_destroy().
908 * Since: 1.0
910 struct cairo_scaled_font_t;
913 * cairo_font_face_t:
915 * A #cairo_font_face_t specifies all aspects of a font other
916 * than the size or font matrix (a font matrix is used to distort
917 * a font by sheering it or scaling it unequally in the two
918 * directions) . A font face can be set on a #cairo_t by using
919 * cairo_set_font_face(); the size and font matrix are set with
920 * cairo_set_font_size() and cairo_set_font_matrix().
922 * There are various types of font faces, depending on the
923 * <firstterm>font backend</firstterm> they use. The type of a
924 * font face can be queried using cairo_font_face_get_type().
926 * Memory management of #cairo_font_face_t is done with
927 * cairo_font_face_reference() and cairo_font_face_destroy().
929 * Since: 1.0
931 struct cairo_font_face_t;
934 * cairo_glyph_t:
935 * @index: glyph index in the font. The exact interpretation of the
936 * glyph index depends on the font technology being used.
937 * @x: the offset in the X direction between the origin used for
938 * drawing or measuring the string and the origin of this glyph.
939 * @y: the offset in the Y direction between the origin used for
940 * drawing or measuring the string and the origin of this glyph.
942 * The #cairo_glyph_t structure holds information about a single glyph
943 * when drawing or measuring text. A font is (in simple terms) a
944 * collection of shapes used to draw text. A glyph is one of these
945 * shapes. There can be multiple glyphs for a single character
946 * (alternates to be used in different contexts, for example), or a
947 * glyph can be a <firstterm>ligature</firstterm> of multiple
948 * characters. Cairo doesn't expose any way of converting input text
949 * into glyphs, so in order to use the Cairo interfaces that take
950 * arrays of glyphs, you must directly access the appropriate
951 * underlying font system.
953 * Note that the offsets given by @x and @y are not cumulative. When
954 * drawing or measuring text, each glyph is individually positioned
955 * with respect to the overall origin
957 * Since: 1.0
959 struct cairo_glyph_t {
960 c_ulong index;
961 double x;
962 double y;
965 /*cairo_public*/ cairo_glyph_t* cairo_glyph_allocate (int num_glyphs);
966 /*cairo_public*/ void cairo_glyph_free (cairo_glyph_t* glyphs);
969 * cairo_text_cluster_t:
970 * @num_bytes: the number of bytes of UTF-8 text covered by cluster
971 * @num_glyphs: the number of glyphs covered by cluster
973 * The #cairo_text_cluster_t structure holds information about a single
974 * <firstterm>text cluster</firstterm>. A text cluster is a minimal
975 * mapping of some glyphs corresponding to some UTF-8 text.
977 * For a cluster to be valid, both @num_bytes and @num_glyphs should
978 * be non-negative, and at least one should be non-zero.
979 * Note that clusters with zero glyphs are not as well supported as
980 * normal clusters. For example, PDF rendering applications typically
981 * ignore those clusters when PDF text is being selected.
983 * See cairo_show_text_glyphs() for how clusters are used in advanced
984 * text operations.
986 * Since: 1.8
988 struct cairo_text_cluster_t {
989 int num_bytes;
990 int num_glyphs;
993 /*cairo_public*/ cairo_text_cluster_t* cairo_text_cluster_allocate (int num_clusters);
994 /*cairo_public*/ void cairo_text_cluster_free (cairo_text_cluster_t* clusters);
997 * cairo_text_cluster_flags_t:
998 * @CAIRO_TEXT_CLUSTER_FLAG_BACKWARD: The clusters in the cluster array
999 * map to glyphs in the glyph array from end to start. (Since 1.8)
1001 * Specifies properties of a text cluster mapping.
1003 * Since: 1.8
1005 alias cairo_text_cluster_flags_t = int;
1006 enum : cairo_text_cluster_flags_t {
1007 CAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001
1011 * cairo_text_extents_t:
1012 * @x_bearing: the horizontal distance from the origin to the
1013 * leftmost part of the glyphs as drawn. Positive if the
1014 * glyphs lie entirely to the right of the origin.
1015 * @y_bearing: the vertical distance from the origin to the
1016 * topmost part of the glyphs as drawn. Positive only if the
1017 * glyphs lie completely below the origin; will usually be
1018 * negative.
1019 * @width: width of the glyphs as drawn
1020 * @height: height of the glyphs as drawn
1021 * @x_advance:distance to advance in the X direction
1022 * after drawing these glyphs
1023 * @y_advance: distance to advance in the Y direction
1024 * after drawing these glyphs. Will typically be zero except
1025 * for vertical text layout as found in East-Asian languages.
1027 * The #cairo_text_extents_t structure stores the extents of a single
1028 * glyph or a string of glyphs in user-space coordinates. Because text
1029 * extents are in user-space coordinates, they are mostly, but not
1030 * entirely, independent of the current transformation matrix. If you call
1031 * <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
1032 * be drawn twice as big, but the reported text extents will not be
1033 * doubled. They will change slightly due to hinting (so you can't
1034 * assume that metrics are independent of the transformation matrix),
1035 * but otherwise will remain unchanged.
1037 * Since: 1.0
1039 struct cairo_text_extents_t {
1040 double x_bearing;
1041 double y_bearing;
1042 double width;
1043 double height;
1044 double x_advance;
1045 double y_advance;
1049 * cairo_font_extents_t:
1050 * @ascent: the distance that the font extends above the baseline.
1051 * Note that this is not always exactly equal to the maximum
1052 * of the extents of all the glyphs in the font, but rather
1053 * is picked to express the font designer's intent as to
1054 * how the font should align with elements above it.
1055 * @descent: the distance that the font extends below the baseline.
1056 * This value is positive for typical fonts that include
1057 * portions below the baseline. Note that this is not always
1058 * exactly equal to the maximum of the extents of all the
1059 * glyphs in the font, but rather is picked to express the
1060 * font designer's intent as to how the font should
1061 * align with elements below it.
1062 * @height: the recommended vertical distance between baselines when
1063 * setting consecutive lines of text with the font. This
1064 * is greater than @ascent+@descent by a
1065 * quantity known as the <firstterm>line spacing</firstterm>
1066 * or <firstterm>external leading</firstterm>. When space
1067 * is at a premium, most fonts can be set with only
1068 * a distance of @ascent+@descent between lines.
1069 * @max_x_advance: the maximum distance in the X direction that
1070 * the origin is advanced for any glyph in the font.
1071 * @max_y_advance: the maximum distance in the Y direction that
1072 * the origin is advanced for any glyph in the font.
1073 * This will be zero for normal fonts used for horizontal
1074 * writing. (The scripts of East Asia are sometimes written
1075 * vertically.)
1077 * The #cairo_font_extents_t structure stores metric information for
1078 * a font. Values are given in the current user-space coordinate
1079 * system.
1081 * Because font metrics are in user-space coordinates, they are
1082 * mostly, but not entirely, independent of the current transformation
1083 * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
1084 * text will be drawn twice as big, but the reported text extents will
1085 * not be doubled. They will change slightly due to hinting (so you
1086 * can't assume that metrics are independent of the transformation
1087 * matrix), but otherwise will remain unchanged.
1089 * Since: 1.0
1091 struct cairo_font_extents_t {
1092 double ascent;
1093 double descent;
1094 double height;
1095 double max_x_advance;
1096 double max_y_advance;
1100 * cairo_font_slant_t:
1101 * @CAIRO_FONT_SLANT_NORMAL: Upright font style, since 1.0
1102 * @CAIRO_FONT_SLANT_ITALIC: Italic font style, since 1.0
1103 * @CAIRO_FONT_SLANT_OBLIQUE: Oblique font style, since 1.0
1105 * Specifies variants of a font face based on their slant.
1107 * Since: 1.0
1109 alias cairo_font_slant_t = int;
1110 enum : cairo_font_slant_t {
1111 CAIRO_FONT_SLANT_NORMAL,
1112 CAIRO_FONT_SLANT_ITALIC,
1113 CAIRO_FONT_SLANT_OBLIQUE
1117 * cairo_font_weight_t:
1118 * @CAIRO_FONT_WEIGHT_NORMAL: Normal font weight, since 1.0
1119 * @CAIRO_FONT_WEIGHT_BOLD: Bold font weight, since 1.0
1121 * Specifies variants of a font face based on their weight.
1123 * Since: 1.0
1125 alias cairo_font_weight_t = int;
1126 enum : cairo_font_weight_t {
1127 CAIRO_FONT_WEIGHT_NORMAL,
1128 CAIRO_FONT_WEIGHT_BOLD
1132 * cairo_subpixel_order_t:
1133 * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for
1134 * for the target device, since 1.0
1135 * @CAIRO_SUBPIXEL_ORDER_RGB: Subpixel elements are arranged horizontally
1136 * with red at the left, since 1.0
1137 * @CAIRO_SUBPIXEL_ORDER_BGR: Subpixel elements are arranged horizontally
1138 * with blue at the left, since 1.0
1139 * @CAIRO_SUBPIXEL_ORDER_VRGB: Subpixel elements are arranged vertically
1140 * with red at the top, since 1.0
1141 * @CAIRO_SUBPIXEL_ORDER_VBGR: Subpixel elements are arranged vertically
1142 * with blue at the top, since 1.0
1144 * The subpixel order specifies the order of color elements within
1145 * each pixel on the display device when rendering with an
1146 * antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
1148 * Since: 1.0
1150 alias cairo_subpixel_order_t = int;
1151 enum : cairo_subpixel_order_t {
1152 CAIRO_SUBPIXEL_ORDER_DEFAULT,
1153 CAIRO_SUBPIXEL_ORDER_RGB,
1154 CAIRO_SUBPIXEL_ORDER_BGR,
1155 CAIRO_SUBPIXEL_ORDER_VRGB,
1156 CAIRO_SUBPIXEL_ORDER_VBGR
1160 * cairo_hint_style_t:
1161 * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
1162 * font backend and target device, since 1.0
1163 * @CAIRO_HINT_STYLE_NONE: Do not hint outlines, since 1.0
1164 * @CAIRO_HINT_STYLE_SLIGHT: Hint outlines slightly to improve
1165 * contrast while retaining good fidelity to the original
1166 * shapes, since 1.0
1167 * @CAIRO_HINT_STYLE_MEDIUM: Hint outlines with medium strength
1168 * giving a compromise between fidelity to the original shapes
1169 * and contrast, since 1.0
1170 * @CAIRO_HINT_STYLE_FULL: Hint outlines to maximize contrast, since 1.0
1172 * Specifies the type of hinting to do on font outlines. Hinting
1173 * is the process of fitting outlines to the pixel grid in order
1174 * to improve the appearance of the result. Since hinting outlines
1175 * involves distorting them, it also reduces the faithfulness
1176 * to the original outline shapes. Not all of the outline hinting
1177 * styles are supported by all font backends.
1179 * New entries may be added in future versions.
1181 * Since: 1.0
1183 alias cairo_hint_style_t = int;
1184 enum : cairo_hint_style_t {
1185 CAIRO_HINT_STYLE_DEFAULT,
1186 CAIRO_HINT_STYLE_NONE,
1187 CAIRO_HINT_STYLE_SLIGHT,
1188 CAIRO_HINT_STYLE_MEDIUM,
1189 CAIRO_HINT_STYLE_FULL
1193 * cairo_hint_metrics_t:
1194 * @CAIRO_HINT_METRICS_DEFAULT: Hint metrics in the default
1195 * manner for the font backend and target device, since 1.0
1196 * @CAIRO_HINT_METRICS_OFF: Do not hint font metrics, since 1.0
1197 * @CAIRO_HINT_METRICS_ON: Hint font metrics, since 1.0
1199 * Specifies whether to hint font metrics; hinting font metrics
1200 * means quantizing them so that they are integer values in
1201 * device space. Doing this improves the consistency of
1202 * letter and line spacing, however it also means that text
1203 * will be laid out differently at different zoom factors.
1205 * Since: 1.0
1207 alias cairo_hint_metrics_t = int;
1208 enum : cairo_hint_metrics_t {
1209 CAIRO_HINT_METRICS_DEFAULT,
1210 CAIRO_HINT_METRICS_OFF,
1211 CAIRO_HINT_METRICS_ON
1215 * cairo_font_options_t:
1217 * An opaque structure holding all options that are used when
1218 * rendering fonts.
1220 * Individual features of a #cairo_font_options_t can be set or
1221 * accessed using functions named
1222 * <function>cairo_font_options_set_<emphasis>feature_name</emphasis>()</function> and
1223 * <function>cairo_font_options_get_<emphasis>feature_name</emphasis>()</function>, like
1224 * cairo_font_options_set_antialias() and
1225 * cairo_font_options_get_antialias().
1227 * New features may be added to a #cairo_font_options_t in the
1228 * future. For this reason, cairo_font_options_copy(),
1229 * cairo_font_options_equal(), cairo_font_options_merge(), and
1230 * cairo_font_options_hash() should be used to copy, check
1231 * for equality, merge, or compute a hash value of
1232 * #cairo_font_options_t objects.
1234 * Since: 1.0
1236 struct cairo_font_options_t;
1238 /*cairo_public*/ cairo_font_options_t* cairo_font_options_create ();
1239 /*cairo_public*/ cairo_font_options_t* cairo_font_options_copy (const(cairo_font_options_t)* original);
1240 /*cairo_public*/ void cairo_font_options_destroy (cairo_font_options_t* options);
1241 /*cairo_public*/ cairo_status_t cairo_font_options_status (cairo_font_options_t* options);
1242 /*cairo_public*/ void cairo_font_options_merge (cairo_font_options_t* options, const(cairo_font_options_t)* other);
1243 /*cairo_public*/ cairo_bool_t cairo_font_options_equal (const(cairo_font_options_t)* options, const(cairo_font_options_t)* other);
1244 /*cairo_public*/ c_ulong cairo_font_options_hash (const(cairo_font_options_t)* options);
1245 /*cairo_public*/ void cairo_font_options_set_antialias (cairo_font_options_t* options, cairo_antialias_t antialias);
1246 /*cairo_public*/ cairo_antialias_t cairo_font_options_get_antialias (const(cairo_font_options_t)* options);
1247 /*cairo_public*/ void cairo_font_options_set_subpixel_order (cairo_font_options_t* options, cairo_subpixel_order_t subpixel_order);
1248 /*cairo_public*/ cairo_subpixel_order_t cairo_font_options_get_subpixel_order (const(cairo_font_options_t)* options);
1249 /*cairo_public*/ void cairo_font_options_set_hint_style (cairo_font_options_t* options, cairo_hint_style_t hint_style);
1250 /*cairo_public*/ cairo_hint_style_t cairo_font_options_get_hint_style (const(cairo_font_options_t)* options);
1251 /*cairo_public*/ void cairo_font_options_set_hint_metrics (cairo_font_options_t* options, cairo_hint_metrics_t hint_metrics);
1252 /*cairo_public*/ cairo_hint_metrics_t cairo_font_options_get_hint_metrics (const(cairo_font_options_t)* options);
1254 /* This interface is for dealing with text as text, not caring about the
1255 font object inside the the cairo_t. */
1257 /*cairo_public*/ void cairo_select_font_face (cairo_t* cr, const(char)* family, cairo_font_slant_t slant, cairo_font_weight_t weight);
1258 /*cairo_public*/ void cairo_set_font_size (cairo_t* cr, double size);
1259 /*cairo_public*/ void cairo_set_font_matrix (cairo_t* cr, const(cairo_matrix_t)* matrix);
1260 /*cairo_public*/ void cairo_get_font_matrix (cairo_t* cr, cairo_matrix_t* matrix);
1261 /*cairo_public*/ void cairo_set_font_options (cairo_t* cr, const(cairo_font_options_t)* options);
1262 /*cairo_public*/ void cairo_get_font_options (cairo_t* cr, cairo_font_options_t* options);
1263 /*cairo_public*/ void cairo_set_font_face (cairo_t* cr, cairo_font_face_t* font_face);
1264 /*cairo_public*/ cairo_font_face_t* cairo_get_font_face (cairo_t* cr);
1265 /*cairo_public*/ void cairo_set_scaled_font (cairo_t* cr, const(cairo_scaled_font_t)* scaled_font);
1266 /*cairo_public*/ cairo_scaled_font_t* cairo_get_scaled_font (cairo_t* cr);
1267 /*cairo_public*/ void cairo_show_text (cairo_t* cr, const(char)* utf8);
1268 /*cairo_public*/ void cairo_show_glyphs (cairo_t* cr, const(cairo_glyph_t)* glyphs, int num_glyphs);
1269 /*cairo_public*/ void cairo_show_text_glyphs (cairo_t* cr, const(char)* utf8, int utf8_len, const(cairo_glyph_t)* glyphs, int num_glyphs,
1270 const(cairo_text_cluster_t)* clusters, int num_clusters, cairo_text_cluster_flags_t cluster_flags);
1271 /*cairo_public*/ void cairo_text_path (cairo_t* cr, const(char)* utf8);
1272 /*cairo_public*/ void cairo_glyph_path (cairo_t* cr, const(cairo_glyph_t)* glyphs, int num_glyphs);
1273 /*cairo_public*/ void cairo_text_extents (cairo_t* cr, const(char)* utf8, cairo_text_extents_t* extents);
1274 /*cairo_public*/ void cairo_glyph_extents (cairo_t* cr, const(cairo_glyph_t)* glyphs, int num_glyphs, cairo_text_extents_t* extents);
1275 /*cairo_public*/ void cairo_font_extents (cairo_t* cr, cairo_font_extents_t* extents);
1277 /* Generic identifier for a font style */
1278 /*cairo_public*/ cairo_font_face_t* cairo_font_face_reference (cairo_font_face_t* font_face);
1279 /*cairo_public*/ void cairo_font_face_destroy (cairo_font_face_t* font_face);
1280 /*cairo_public*/ uint cairo_font_face_get_reference_count (cairo_font_face_t* font_face);
1281 /*cairo_public*/ cairo_status_t cairo_font_face_status (cairo_font_face_t* font_face);
1285 * cairo_font_type_t:
1286 * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api (Since: 1.2)
1287 * @CAIRO_FONT_TYPE_FT: The font is of type FreeType (Since: 1.2)
1288 * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32 (Since: 1.2)
1289 * @CAIRO_FONT_TYPE_QUARTZ: The font is of type Quartz (Since: 1.6, in 1.2 and
1290 * 1.4 it was named CAIRO_FONT_TYPE_ATSUI)
1291 * @CAIRO_FONT_TYPE_USER: The font was create using cairo's user font api (Since: 1.8)
1293 * #cairo_font_type_t is used to describe the type of a given font
1294 * face or scaled font. The font types are also known as "font
1295 * backends" within cairo.
1297 * The type of a font face is determined by the function used to
1298 * create it, which will generally be of the form
1299 * <function>cairo_<emphasis>type</emphasis>_font_face_create(<!-- -->)</function>.
1300 * The font face type can be queried with cairo_font_face_get_type()
1302 * The various #cairo_font_face_t functions can be used with a font face
1303 * of any type.
1305 * The type of a scaled font is determined by the type of the font
1306 * face passed to cairo_scaled_font_create(). The scaled font type can
1307 * be queried with cairo_scaled_font_get_type()
1309 * The various #cairo_scaled_font_t functions can be used with scaled
1310 * fonts of any type, but some font backends also provide
1311 * type-specific functions that must only be called with a scaled font
1312 * of the appropriate type. These functions have names that begin with
1313 * <function>cairo_<emphasis>type</emphasis>_scaled_font(<!-- -->)</function>
1314 * such as cairo_ft_scaled_font_lock_face().
1316 * The behavior of calling a type-specific function with a scaled font
1317 * of the wrong type is undefined.
1319 * New entries may be added in future versions.
1321 * Since: 1.2
1323 alias cairo_font_type_t = int;
1324 enum : cairo_font_type_t {
1325 CAIRO_FONT_TYPE_TOY,
1326 CAIRO_FONT_TYPE_FT,
1327 CAIRO_FONT_TYPE_WIN32,
1328 CAIRO_FONT_TYPE_QUARTZ,
1329 CAIRO_FONT_TYPE_USER
1332 /*cairo_public*/ cairo_font_type_t cairo_font_face_get_type (cairo_font_face_t* font_face);
1333 /*cairo_public*/ void* cairo_font_face_get_user_data (cairo_font_face_t* font_face, const(cairo_user_data_key_t)* key);
1334 /*cairo_public*/ cairo_status_t cairo_font_face_set_user_data (cairo_font_face_t* font_face, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
1336 /* Portable interface to general font features. */
1337 /*cairo_public*/ cairo_scaled_font_t* cairo_scaled_font_create (cairo_font_face_t* font_face, const(cairo_matrix_t)* font_matrix, const(cairo_matrix_t)* ctm, const(cairo_font_options_t)* options);
1338 /*cairo_public*/ cairo_scaled_font_t* cairo_scaled_font_reference (cairo_scaled_font_t* scaled_font);
1339 /*cairo_public*/ void cairo_scaled_font_destroy (cairo_scaled_font_t* scaled_font);
1340 /*cairo_public*/ uint cairo_scaled_font_get_reference_count (cairo_scaled_font_t* scaled_font);
1341 /*cairo_public*/ cairo_status_t cairo_scaled_font_status (cairo_scaled_font_t* scaled_font);
1342 /*cairo_public*/ cairo_font_type_t cairo_scaled_font_get_type (cairo_scaled_font_t* scaled_font);
1343 /*cairo_public*/ void* cairo_scaled_font_get_user_data (cairo_scaled_font_t* scaled_font, const(cairo_user_data_key_t)* key);
1344 /*cairo_public*/ cairo_status_t cairo_scaled_font_set_user_data (cairo_scaled_font_t* scaled_font, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
1345 /*cairo_public*/ void cairo_scaled_font_extents (cairo_scaled_font_t* scaled_font, cairo_font_extents_t* extents);
1346 /*cairo_public*/ void cairo_scaled_font_text_extents (cairo_scaled_font_t* scaled_font, const(char)* utf8, cairo_text_extents_t* extents);
1347 /*cairo_public*/ void cairo_scaled_font_glyph_extents (cairo_scaled_font_t* scaled_font, const(cairo_glyph_t)* glyphs, int num_glyphs, cairo_text_extents_t* extents);
1348 /*cairo_public*/ cairo_status_t cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t* scaled_font, double x, double y, const(char)* utf8, int utf8_len,
1349 cairo_glyph_t** glyphs, int* num_glyphs, cairo_text_cluster_t** clusters, int* num_clusters,
1350 cairo_text_cluster_flags_t* cluster_flags);
1351 /*cairo_public*/ cairo_font_face_t* cairo_scaled_font_get_font_face (cairo_scaled_font_t* scaled_font);
1352 /*cairo_public*/ void cairo_scaled_font_get_font_matrix (cairo_scaled_font_t* scaled_font, cairo_matrix_t* font_matrix);
1353 /*cairo_public*/ void cairo_scaled_font_get_ctm (cairo_scaled_font_t* scaled_font, cairo_matrix_t* ctm);
1354 /*cairo_public*/ void cairo_scaled_font_get_scale_matrix (cairo_scaled_font_t* scaled_font, cairo_matrix_t* scale_matrix);
1355 /*cairo_public*/ void cairo_scaled_font_get_font_options (cairo_scaled_font_t* scaled_font, cairo_font_options_t* options);
1357 /* Toy fonts */
1358 /*cairo_public*/ cairo_font_face_t* cairo_toy_font_face_create (const(char)* family, cairo_font_slant_t slant, cairo_font_weight_t weight);
1359 /*cairo_public*/ const(char)* cairo_toy_font_face_get_family (cairo_font_face_t* font_face);
1360 /*cairo_public*/ cairo_font_slant_t cairo_toy_font_face_get_slant (cairo_font_face_t* font_face);
1361 /*cairo_public*/ cairo_font_weight_t cairo_toy_font_face_get_weight (cairo_font_face_t* font_face);
1363 /* User fonts */
1364 /*cairo_public*/ cairo_font_face_t* cairo_user_font_face_create ();
1366 /* User-font method signatures */
1369 * cairo_user_scaled_font_init_func_t:
1370 * @scaled_font: the scaled-font being created
1371 * @cr: a cairo context, in font space
1372 * @extents: font extents to fill in, in font space
1374 * #cairo_user_scaled_font_init_func_t is the type of function which is
1375 * called when a scaled-font needs to be created for a user font-face.
1377 * The cairo context @cr is not used by the caller, but is prepared in font
1378 * space, similar to what the cairo contexts passed to the render_glyph
1379 * method will look like. The callback can use this context for extents
1380 * computation for example. After the callback is called, @cr is checked
1381 * for any error status.
1383 * The @extents argument is where the user font sets the font extents for
1384 * @scaled_font. It is in font space, which means that for most cases its
1385 * ascent and descent members should add to 1.0. @extents is preset to
1386 * hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for
1387 * descent and max_y_advance members.
1389 * The callback is optional. If not set, default font extents as described
1390 * in the previous paragraph will be used.
1392 * Note that @scaled_font is not fully initialized at this
1393 * point and trying to use it for text operations in the callback will result
1394 * in deadlock.
1396 * Returns: %CAIRO_STATUS_SUCCESS upon success, or an error status on error.
1398 * Since: 1.8
1400 alias cairo_user_scaled_font_init_func_t = cairo_status_t function (cairo_scaled_font_t* scaled_font, cairo_t* cr, cairo_font_extents_t* extents);
1403 * cairo_user_scaled_font_render_glyph_func_t:
1404 * @scaled_font: user scaled-font
1405 * @glyph: glyph code to render
1406 * @cr: cairo context to draw to, in font space
1407 * @extents: glyph extents to fill in, in font space
1409 * #cairo_user_scaled_font_render_glyph_func_t is the type of function which
1410 * is called when a user scaled-font needs to render a glyph.
1412 * The callback is mandatory, and expected to draw the glyph with code @glyph to
1413 * the cairo context @cr. @cr is prepared such that the glyph drawing is done in
1414 * font space. That is, the matrix set on @cr is the scale matrix of @scaled_font,
1415 * The @extents argument is where the user font sets the font extents for
1416 * @scaled_font. However, if user prefers to draw in user space, they can
1417 * achieve that by changing the matrix on @cr. All cairo rendering operations
1418 * to @cr are permitted, however, the result is undefined if any source other
1419 * than the default source on @cr is used. That means, glyph bitmaps should
1420 * be rendered using cairo_mask() instead of cairo_paint().
1422 * Other non-default settings on @cr include a font size of 1.0 (given that
1423 * it is set up to be in font space), and font options corresponding to
1424 * @scaled_font.
1426 * The @extents argument is preset to have <literal>x_bearing</literal>,
1427 * <literal>width</literal>, and <literal>y_advance</literal> of zero,
1428 * <literal>y_bearing</literal> set to <literal>-font_extents.ascent</literal>,
1429 * <literal>height</literal> to <literal>font_extents.ascent+font_extents.descent</literal>,
1430 * and <literal>x_advance</literal> to <literal>font_extents.max_x_advance</literal>.
1431 * The only field user needs to set in majority of cases is
1432 * <literal>x_advance</literal>.
1433 * If the <literal>width</literal> field is zero upon the callback returning
1434 * (which is its preset value), the glyph extents are automatically computed
1435 * based on the drawings done to @cr. This is in most cases exactly what the
1436 * desired behavior is. However, if for any reason the callback sets the
1437 * extents, it must be ink extents, and include the extents of all drawing
1438 * done to @cr in the callback.
1440 * Returns: %CAIRO_STATUS_SUCCESS upon success, or
1441 * %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
1443 * Since: 1.8
1445 alias cairo_user_scaled_font_render_glyph_func_t = cairo_status_t function (cairo_scaled_font_t* scaled_font, c_ulong glyph, cairo_t* cr, cairo_text_extents_t* extents);
1448 * cairo_user_scaled_font_text_to_glyphs_func_t:
1449 * @scaled_font: the scaled-font being created
1450 * @utf8: a string of text encoded in UTF-8
1451 * @utf8_len: length of @utf8 in bytes
1452 * @glyphs: pointer to array of glyphs to fill, in font space
1453 * @num_glyphs: pointer to number of glyphs
1454 * @clusters: pointer to array of cluster mapping information to fill, or %NULL
1455 * @num_clusters: pointer to number of clusters
1456 * @cluster_flags: pointer to location to store cluster flags corresponding to the
1457 * output @clusters
1459 * #cairo_user_scaled_font_text_to_glyphs_func_t is the type of function which
1460 * is called to convert input text to an array of glyphs. This is used by the
1461 * cairo_show_text() operation.
1463 * Using this callback the user-font has full control on glyphs and their
1464 * positions. That means, it allows for features like ligatures and kerning,
1465 * as well as complex <firstterm>shaping</firstterm> required for scripts like
1466 * Arabic and Indic.
1468 * The @num_glyphs argument is preset to the number of glyph entries available
1469 * in the @glyphs buffer. If the @glyphs buffer is %NULL, the value of
1470 * @num_glyphs will be zero. If the provided glyph array is too short for
1471 * the conversion (or for convenience), a new glyph array may be allocated
1472 * using cairo_glyph_allocate() and placed in @glyphs. Upon return,
1473 * @num_glyphs should contain the number of generated glyphs. If the value
1474 * @glyphs points at has changed after the call, the caller will free the
1475 * allocated glyph array using cairo_glyph_free(). The caller will also free
1476 * the original value of @glyphs, so the callback shouldn't do so.
1477 * The callback should populate the glyph indices and positions (in font space)
1478 * assuming that the text is to be shown at the origin.
1480 * If @clusters is not %NULL, @num_clusters and @cluster_flags are also
1481 * non-%NULL, and cluster mapping should be computed. The semantics of how
1482 * cluster array allocation works is similar to the glyph array. That is,
1483 * if @clusters initially points to a non-%NULL value, that array may be used
1484 * as a cluster buffer, and @num_clusters points to the number of cluster
1485 * entries available there. If the provided cluster array is too short for
1486 * the conversion (or for convenience), a new cluster array may be allocated
1487 * using cairo_text_cluster_allocate() and placed in @clusters. In this case,
1488 * the original value of @clusters will still be freed by the caller. Upon
1489 * return, @num_clusters should contain the number of generated clusters.
1490 * If the value @clusters points at has changed after the call, the caller
1491 * will free the allocated cluster array using cairo_text_cluster_free().
1493 * The callback is optional. If @num_glyphs is negative upon
1494 * the callback returning or if the return value
1495 * is %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, the unicode_to_glyph callback
1496 * is tried. See #cairo_user_scaled_font_unicode_to_glyph_func_t.
1498 * Note: While cairo does not impose any limitation on glyph indices,
1499 * some applications may assume that a glyph index fits in a 16-bit
1500 * unsigned integer. As such, it is advised that user-fonts keep their
1501 * glyphs in the 0 to 65535 range. Furthermore, some applications may
1502 * assume that glyph 0 is a special glyph-not-found glyph. User-fonts
1503 * are advised to use glyph 0 for such purposes and do not use that
1504 * glyph value for other purposes.
1506 * Returns: %CAIRO_STATUS_SUCCESS upon success,
1507 * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
1508 * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
1510 * Since: 1.8
1512 alias cairo_user_scaled_font_text_to_glyphs_func_t = cairo_status_t function (cairo_scaled_font_t* scaled_font, const(char)* utf8, int utf8_len,
1513 cairo_glyph_t** glyphs, int* num_glyphs, cairo_text_cluster_t** clusters,
1514 int* num_clusters, cairo_text_cluster_flags_t* cluster_flags);
1517 * cairo_user_scaled_font_unicode_to_glyph_func_t:
1518 * @scaled_font: the scaled-font being created
1519 * @unicode: input unicode character code-point
1520 * @glyph_index: output glyph index
1522 * #cairo_user_scaled_font_unicode_to_glyph_func_t is the type of function which
1523 * is called to convert an input Unicode character to a single glyph.
1524 * This is used by the cairo_show_text() operation.
1526 * This callback is used to provide the same functionality as the
1527 * text_to_glyphs callback does (see #cairo_user_scaled_font_text_to_glyphs_func_t)
1528 * but has much less control on the output,
1529 * in exchange for increased ease of use. The inherent assumption to using
1530 * this callback is that each character maps to one glyph, and that the
1531 * mapping is context independent. It also assumes that glyphs are positioned
1532 * according to their advance width. These mean no ligatures, kerning, or
1533 * complex scripts can be implemented using this callback.
1535 * The callback is optional, and only used if text_to_glyphs callback is not
1536 * set or fails to return glyphs. If this callback is not set or if it returns
1537 * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode
1538 * code-points to glyph indices is assumed.
1540 * Note: While cairo does not impose any limitation on glyph indices,
1541 * some applications may assume that a glyph index fits in a 16-bit
1542 * unsigned integer. As such, it is advised that user-fonts keep their
1543 * glyphs in the 0 to 65535 range. Furthermore, some applications may
1544 * assume that glyph 0 is a special glyph-not-found glyph. User-fonts
1545 * are advised to use glyph 0 for such purposes and do not use that
1546 * glyph value for other purposes.
1548 * Returns: %CAIRO_STATUS_SUCCESS upon success,
1549 * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
1550 * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
1552 * Since: 1.8
1554 alias cairo_user_scaled_font_unicode_to_glyph_func_t = cairo_status_t function (cairo_scaled_font_t* scaled_font, c_ulong unicode, c_ulong* glyph_index);
1556 /* User-font method setters */
1557 /*cairo_public*/ void cairo_user_font_face_set_init_func (cairo_font_face_t* font_face, cairo_user_scaled_font_init_func_t init_func);
1558 /*cairo_public*/ void cairo_user_font_face_set_render_glyph_func (cairo_font_face_t* font_face, cairo_user_scaled_font_render_glyph_func_t render_glyph_func);
1559 /*cairo_public*/ void cairo_user_font_face_set_text_to_glyphs_func (cairo_font_face_t* font_face, cairo_user_scaled_font_text_to_glyphs_func_t text_to_glyphs_func);
1560 /*cairo_public*/ void cairo_user_font_face_set_unicode_to_glyph_func (cairo_font_face_t* font_face, cairo_user_scaled_font_unicode_to_glyph_func_t unicode_to_glyph_func);
1562 /* User-font method getters */
1563 /*cairo_public*/ cairo_user_scaled_font_init_func_t cairo_user_font_face_get_init_func (cairo_font_face_t* font_face);
1564 /*cairo_public*/ cairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func (cairo_font_face_t* font_face);
1565 /*cairo_public*/ cairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t* font_face);
1566 /*cairo_public*/ cairo_user_scaled_font_unicode_to_glyph_func_t cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t* font_face);
1568 /* Query functions */
1570 /*cairo_public*/ cairo_operator_t cairo_get_operator (cairo_t* cr);
1571 /*cairo_public*/ cairo_pattern_t* cairo_get_source (cairo_t* cr);
1572 /*cairo_public*/ double cairo_get_tolerance (cairo_t* cr);
1573 /*cairo_public*/ cairo_antialias_t cairo_get_antialias (cairo_t* cr);
1574 /*cairo_public*/ cairo_bool_t cairo_has_current_point (cairo_t* cr);
1575 /*cairo_public*/ void cairo_get_current_point (cairo_t* cr, double* x, double* y);
1576 /*cairo_public*/ cairo_fill_rule_t cairo_get_fill_rule (cairo_t* cr);
1577 /*cairo_public*/ double cairo_get_line_width (cairo_t* cr);
1578 /*cairo_public*/ cairo_line_cap_t cairo_get_line_cap (cairo_t* cr);
1579 /*cairo_public*/ cairo_line_join_t cairo_get_line_join (cairo_t* cr);
1580 /*cairo_public*/ double cairo_get_miter_limit (cairo_t* cr);
1581 /*cairo_public*/ int cairo_get_dash_count (cairo_t* cr);
1582 /*cairo_public*/ void cairo_get_dash (cairo_t* cr, double* dashes, double* offset);
1583 /*cairo_public*/ void cairo_get_matrix (cairo_t* cr, cairo_matrix_t* matrix);
1584 /*cairo_public*/ cairo_surface_t* cairo_get_target (cairo_t* cr);
1585 /*cairo_public*/ cairo_surface_t* cairo_get_group_target (cairo_t* cr);
1588 * cairo_path_data_type_t:
1589 * @CAIRO_PATH_MOVE_TO: A move-to operation, since 1.0
1590 * @CAIRO_PATH_LINE_TO: A line-to operation, since 1.0
1591 * @CAIRO_PATH_CURVE_TO: A curve-to operation, since 1.0
1592 * @CAIRO_PATH_CLOSE_PATH: A close-path operation, since 1.0
1594 * #cairo_path_data_t is used to describe the type of one portion
1595 * of a path when represented as a #cairo_path_t.
1596 * See #cairo_path_data_t for details.
1598 * Since: 1.0
1600 alias cairo_path_data_type_t = int;
1601 enum : cairo_path_data_type_t {
1602 CAIRO_PATH_MOVE_TO,
1603 CAIRO_PATH_LINE_TO,
1604 CAIRO_PATH_CURVE_TO,
1605 CAIRO_PATH_CLOSE_PATH
1609 * cairo_path_data_t:
1611 * #cairo_path_data_t is used to represent the path data inside a
1612 * #cairo_path_t.
1614 * The data structure is designed to try to balance the demands of
1615 * efficiency and ease-of-use. A path is represented as an array of
1616 * #cairo_path_data_t, which is a union of headers and points.
1618 * Each portion of the path is represented by one or more elements in
1619 * the array, (one header followed by 0 or more points). The length
1620 * value of the header is the number of array elements for the current
1621 * portion including the header, (ie. length == 1 + # of points), and
1622 * where the number of points for each element type is as follows:
1624 * <programlisting>
1625 * %CAIRO_PATH_MOVE_TO: 1 point
1626 * %CAIRO_PATH_LINE_TO: 1 point
1627 * %CAIRO_PATH_CURVE_TO: 3 points
1628 * %CAIRO_PATH_CLOSE_PATH: 0 points
1629 * </programlisting>
1631 * The semantics and ordering of the coordinate values are consistent
1632 * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
1633 * cairo_close_path().
1635 * Here is sample code for iterating through a #cairo_path_t:
1637 * <informalexample><programlisting>
1638 * int i;
1639 * cairo_path_t *path;
1640 * cairo_path_data_t *data;
1641 * &nbsp;
1642 * path = cairo_copy_path (cr);
1643 * &nbsp;
1644 * for (i=0; i < path->num_data; i += path->data[i].header.length) {
1645 * data = &amp;path->data[i];
1646 * switch (data->header.type) {
1647 * case CAIRO_PATH_MOVE_TO:
1648 * do_move_to_things (data[1].point.x, data[1].point.y);
1649 * break;
1650 * case CAIRO_PATH_LINE_TO:
1651 * do_line_to_things (data[1].point.x, data[1].point.y);
1652 * break;
1653 * case CAIRO_PATH_CURVE_TO:
1654 * do_curve_to_things (data[1].point.x, data[1].point.y,
1655 * data[2].point.x, data[2].point.y,
1656 * data[3].point.x, data[3].point.y);
1657 * break;
1658 * case CAIRO_PATH_CLOSE_PATH:
1659 * do_close_path_things ();
1660 * break;
1663 * cairo_path_destroy (path);
1664 * </programlisting></informalexample>
1666 * As of cairo 1.4, cairo does not mind if there are more elements in
1667 * a portion of the path than needed. Such elements can be used by
1668 * users of the cairo API to hold extra values in the path data
1669 * structure. For this reason, it is recommended that applications
1670 * always use <literal>data->header.length</literal> to
1671 * iterate over the path data, instead of hardcoding the number of
1672 * elements for each element type.
1674 * Since: 1.0
1676 union cairo_path_data_t {
1677 static struct Header {
1678 cairo_path_data_type_t type;
1679 int length;
1681 Header header;
1682 static struct Point {
1683 double x, y;
1685 Point point;
1689 * cairo_path_t:
1690 * @status: the current error status
1691 * @data: the elements in the path
1692 * @num_data: the number of elements in the data array
1694 * A data structure for holding a path. This data structure serves as
1695 * the return value for cairo_copy_path() and
1696 * cairo_copy_path_flat() as well the input value for
1697 * cairo_append_path().
1699 * See #cairo_path_data_t for hints on how to iterate over the
1700 * actual data within the path.
1702 * The num_data member gives the number of elements in the data
1703 * array. This number is larger than the number of independent path
1704 * portions (defined in #cairo_path_data_type_t), since the data
1705 * includes both headers and coordinates for each portion.
1707 * Since: 1.0
1709 struct cairo_path_t {
1710 cairo_status_t status;
1711 cairo_path_data_t* data;
1712 int num_data;
1715 /*cairo_public*/ cairo_path_t* cairo_copy_path (cairo_t* cr);
1716 /*cairo_public*/ cairo_path_t* cairo_copy_path_flat (cairo_t* cr);
1717 /*cairo_public*/ void cairo_append_path (cairo_t* cr, const(cairo_path_t)* path);
1718 /*cairo_public*/ void cairo_path_destroy (cairo_path_t* path);
1720 /* Error status queries */
1721 /*cairo_public*/ cairo_status_t cairo_status (cairo_t* cr);
1722 /*cairo_public*/ const(char)* cairo_status_to_string (cairo_status_t status);
1724 /* Backend device manipulation */
1725 /*cairo_public*/ cairo_device_t* cairo_device_reference (cairo_device_t* device);
1728 * cairo_device_type_t:
1729 * @CAIRO_DEVICE_TYPE_DRM: The device is of type Direct Render Manager, since 1.10
1730 * @CAIRO_DEVICE_TYPE_GL: The device is of type OpenGL, since 1.10
1731 * @CAIRO_DEVICE_TYPE_SCRIPT: The device is of type script, since 1.10
1732 * @CAIRO_DEVICE_TYPE_XCB: The device is of type xcb, since 1.10
1733 * @CAIRO_DEVICE_TYPE_XLIB: The device is of type xlib, since 1.10
1734 * @CAIRO_DEVICE_TYPE_XML: The device is of type XML, since 1.10
1735 * @CAIRO_DEVICE_TYPE_COGL: The device is of type cogl, since 1.12
1736 * @CAIRO_DEVICE_TYPE_WIN32: The device is of type win32, since 1.12
1737 * @CAIRO_DEVICE_TYPE_INVALID: The device is invalid, since 1.10
1739 * #cairo_device_type_t is used to describe the type of a given
1740 * device. The devices types are also known as "backends" within cairo.
1742 * The device type can be queried with cairo_device_get_type()
1744 * The various #cairo_device_t functions can be used with devices of
1745 * any type, but some backends also provide type-specific functions
1746 * that must only be called with a device of the appropriate
1747 * type. These functions have names that begin with
1748 * <literal>cairo_<emphasis>type</emphasis>_device</literal> such as
1749 * cairo_xcb_device_debug_cap_xrender_version().
1751 * The behavior of calling a type-specific function with a device of
1752 * the wrong type is undefined.
1754 * New entries may be added in future versions.
1756 * Since: 1.10
1758 alias cairo_device_type_t = int;
1759 enum : cairo_device_type_t {
1760 CAIRO_DEVICE_TYPE_DRM,
1761 CAIRO_DEVICE_TYPE_GL,
1762 CAIRO_DEVICE_TYPE_SCRIPT,
1763 CAIRO_DEVICE_TYPE_XCB,
1764 CAIRO_DEVICE_TYPE_XLIB,
1765 CAIRO_DEVICE_TYPE_XML,
1766 CAIRO_DEVICE_TYPE_COGL,
1767 CAIRO_DEVICE_TYPE_WIN32,
1769 CAIRO_DEVICE_TYPE_INVALID = -1
1772 /*cairo_public*/ cairo_device_type_t cairo_device_get_type (cairo_device_t* device);
1773 /*cairo_public*/ cairo_status_t cairo_device_status (cairo_device_t* device);
1774 /*cairo_public*/ cairo_status_t cairo_device_acquire (cairo_device_t* device);
1775 /*cairo_public*/ void cairo_device_release (cairo_device_t* device);
1776 /*cairo_public*/ void cairo_device_flush (cairo_device_t* device);
1777 /*cairo_public*/ void cairo_device_finish (cairo_device_t* device);
1778 /*cairo_public*/ void cairo_device_destroy (cairo_device_t* device);
1779 /*cairo_public*/ uint cairo_device_get_reference_count (cairo_device_t* device);
1780 /*cairo_public*/ void* cairo_device_get_user_data (cairo_device_t* device, const(cairo_user_data_key_t)* key);
1781 /*cairo_public*/ cairo_status_t cairo_device_set_user_data (cairo_device_t* device, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
1783 /* Surface manipulation */
1784 /*cairo_public*/ cairo_surface_t* cairo_surface_create_similar (cairo_surface_t* other, cairo_content_t content, int width, int height);
1785 /*cairo_public*/ cairo_surface_t* cairo_surface_create_similar_image (cairo_surface_t* other, cairo_format_t format, int width, int height);
1786 /*cairo_public*/ cairo_surface_t* cairo_surface_map_to_image (cairo_surface_t* surface, const(cairo_rectangle_int_t)* extents);
1787 /*cairo_public*/ void cairo_surface_unmap_image (cairo_surface_t* surface, cairo_surface_t* image);
1788 /*cairo_public*/ cairo_surface_t* cairo_surface_create_for_rectangle (cairo_surface_t* target, double x, double y, double width, double height);
1791 * cairo_surface_observer_mode_t:
1792 * @CAIRO_SURFACE_OBSERVER_NORMAL: no recording is done
1793 * @CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS: operations are recorded
1795 * Whether operations should be recorded.
1797 * Since: 1.12
1799 alias cairo_surface_observer_mode_t = int;
1800 enum : cairo_surface_observer_mode_t {
1801 CAIRO_SURFACE_OBSERVER_NORMAL = 0,
1802 CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS = 0x1
1805 /*cairo_public*/ cairo_surface_t* cairo_surface_create_observer (cairo_surface_t* target, cairo_surface_observer_mode_t mode);
1807 alias cairo_surface_observer_callback_t = void function (cairo_surface_t* observer, cairo_surface_t* target, void* data);
1809 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_paint_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1810 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_mask_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1811 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_fill_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1812 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_stroke_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1813 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_glyphs_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1814 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_flush_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1815 /*cairo_public*/ cairo_status_t cairo_surface_observer_add_finish_callback (cairo_surface_t* abstract_surface, cairo_surface_observer_callback_t func, void* data);
1816 /*cairo_public*/ cairo_status_t cairo_surface_observer_print (cairo_surface_t* surface, cairo_write_func_t write_func, void* closure);
1817 /*cairo_public*/ double cairo_surface_observer_elapsed (cairo_surface_t* surface);
1818 /*cairo_public*/ cairo_status_t cairo_device_observer_print (cairo_device_t* device, cairo_write_func_t write_func, void* closure);
1819 /*cairo_public*/ double cairo_device_observer_elapsed (cairo_device_t* device);
1820 /*cairo_public*/ double cairo_device_observer_paint_elapsed (cairo_device_t* device);
1821 /*cairo_public*/ double cairo_device_observer_mask_elapsed (cairo_device_t* device);
1822 /*cairo_public*/ double cairo_device_observer_fill_elapsed (cairo_device_t* device);
1823 /*cairo_public*/ double cairo_device_observer_stroke_elapsed (cairo_device_t* device);
1824 /*cairo_public*/ double cairo_device_observer_glyphs_elapsed (cairo_device_t* device);
1825 /*cairo_public*/ cairo_surface_t* cairo_surface_reference (cairo_surface_t* surface);
1826 /*cairo_public*/ void cairo_surface_finish (cairo_surface_t* surface);
1827 /*cairo_public*/ void cairo_surface_destroy (cairo_surface_t* surface);
1828 /*cairo_public*/ cairo_device_t* cairo_surface_get_device (cairo_surface_t* surface);
1829 /*cairo_public*/ uint cairo_surface_get_reference_count (cairo_surface_t* surface);
1830 /*cairo_public*/ cairo_status_t cairo_surface_status (cairo_surface_t* surface);
1833 * cairo_surface_type_t:
1834 * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image, since 1.2
1835 * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf, since 1.2
1836 * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps, since 1.2
1837 * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib, since 1.2
1838 * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb, since 1.2
1839 * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz, since 1.2
1840 * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz, since 1.2
1841 * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32, since 1.2
1842 * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos, since 1.2
1843 * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb, since 1.2
1844 * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg, since 1.2
1845 * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2, since 1.4
1846 * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface, since 1.6
1847 * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image, since 1.6
1848 * @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10
1849 * @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10
1850 * @CAIRO_SURFACE_TYPE_RECORDING: The surface is of type recording, since 1.10
1851 * @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10
1852 * @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10
1853 * @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10
1854 * @CAIRO_SURFACE_TYPE_TEE: The surface is of type 'tee' (a multiplexing surface), since 1.10
1855 * @CAIRO_SURFACE_TYPE_XML: The surface is of type XML (for debugging), since 1.10
1856 * @CAIRO_SURFACE_TYPE_SKIA: The surface is of type Skia, since 1.10
1857 * @CAIRO_SURFACE_TYPE_SUBSURFACE: The surface is a subsurface created with
1858 * cairo_surface_create_for_rectangle(), since 1.10
1859 * @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12
1861 * #cairo_surface_type_t is used to describe the type of a given
1862 * surface. The surface types are also known as "backends" or "surface
1863 * backends" within cairo.
1865 * The type of a surface is determined by the function used to create
1866 * it, which will generally be of the form
1867 * <function>cairo_<emphasis>type</emphasis>_surface_create(<!-- -->)</function>,
1868 * (though see cairo_surface_create_similar() as well).
1870 * The surface type can be queried with cairo_surface_get_type()
1872 * The various #cairo_surface_t functions can be used with surfaces of
1873 * any type, but some backends also provide type-specific functions
1874 * that must only be called with a surface of the appropriate
1875 * type. These functions have names that begin with
1876 * <literal>cairo_<emphasis>type</emphasis>_surface</literal> such as cairo_image_surface_get_width().
1878 * The behavior of calling a type-specific function with a surface of
1879 * the wrong type is undefined.
1881 * New entries may be added in future versions.
1883 * Since: 1.2
1885 alias cairo_surface_type_t = int;
1886 enum : cairo_surface_type_t {
1887 CAIRO_SURFACE_TYPE_IMAGE,
1888 CAIRO_SURFACE_TYPE_PDF,
1889 CAIRO_SURFACE_TYPE_PS,
1890 CAIRO_SURFACE_TYPE_XLIB,
1891 CAIRO_SURFACE_TYPE_XCB,
1892 CAIRO_SURFACE_TYPE_GLITZ,
1893 CAIRO_SURFACE_TYPE_QUARTZ,
1894 CAIRO_SURFACE_TYPE_WIN32,
1895 CAIRO_SURFACE_TYPE_BEOS,
1896 CAIRO_SURFACE_TYPE_DIRECTFB,
1897 CAIRO_SURFACE_TYPE_SVG,
1898 CAIRO_SURFACE_TYPE_OS2,
1899 CAIRO_SURFACE_TYPE_WIN32_PRINTING,
1900 CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
1901 CAIRO_SURFACE_TYPE_SCRIPT,
1902 CAIRO_SURFACE_TYPE_QT,
1903 CAIRO_SURFACE_TYPE_RECORDING,
1904 CAIRO_SURFACE_TYPE_VG,
1905 CAIRO_SURFACE_TYPE_GL,
1906 CAIRO_SURFACE_TYPE_DRM,
1907 CAIRO_SURFACE_TYPE_TEE,
1908 CAIRO_SURFACE_TYPE_XML,
1909 CAIRO_SURFACE_TYPE_SKIA,
1910 CAIRO_SURFACE_TYPE_SUBSURFACE,
1911 CAIRO_SURFACE_TYPE_COGL
1914 /*cairo_public*/ cairo_surface_type_t cairo_surface_get_type (cairo_surface_t* surface);
1915 /*cairo_public*/ cairo_content_t cairo_surface_get_content (cairo_surface_t* surface);
1916 static if (CAIRO_HAS_PNG_FUNCTIONS) {
1917 /*cairo_public*/ cairo_status_t cairo_surface_write_to_png (cairo_surface_t* surface, const(char)* filename);
1918 /*cairo_public*/ cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t* surface, cairo_write_func_t write_func, void* closure);
1920 /*cairo_public*/ void* cairo_surface_get_user_data (cairo_surface_t* surface, const(cairo_user_data_key_t)* key);
1921 /*cairo_public*/ cairo_status_t cairo_surface_set_user_data (cairo_surface_t* surface, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
1923 enum CAIRO_MIME_TYPE_JPEG = "image/jpeg";
1924 enum CAIRO_MIME_TYPE_PNG = "image/png";
1925 enum CAIRO_MIME_TYPE_JP2 = "image/jp2";
1926 enum CAIRO_MIME_TYPE_URI = "text/x-uri";
1927 enum CAIRO_MIME_TYPE_UNIQUE_ID = "application/x-cairo.uuid";
1928 enum CAIRO_MIME_TYPE_JBIG2 = "application/x-cairo.jbig2";
1929 enum CAIRO_MIME_TYPE_JBIG2_GLOBAL = "application/x-cairo.jbig2-global";
1930 enum CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID = "application/x-cairo.jbig2-global-id";
1932 /*cairo_public*/ void cairo_surface_get_mime_data (cairo_surface_t* surface, const(char)* mime_type, const(ubyte)** data, c_ulong* length);
1933 /*cairo_public*/ cairo_status_t cairo_surface_set_mime_data (cairo_surface_t* surface, const(char)* mime_type, const(ubyte)* data, c_ulong length,
1934 cairo_destroy_func_t destroy, void* closure);
1935 /*cairo_public*/ cairo_bool_t cairo_surface_supports_mime_type (cairo_surface_t* surface, const(char)* mime_type);
1936 /*cairo_public*/ void cairo_surface_get_font_options (cairo_surface_t* surface, cairo_font_options_t* options);
1937 /*cairo_public*/ void cairo_surface_flush (cairo_surface_t* surface);
1938 /*cairo_public*/ void cairo_surface_mark_dirty (cairo_surface_t* surface);
1939 /*cairo_public*/ void cairo_surface_mark_dirty_rectangle (cairo_surface_t* surface, int x, int y, int width, int height);
1940 /*cairo_public*/ void cairo_surface_set_device_scale (cairo_surface_t* surface, double x_scale, double y_scale);
1941 /*cairo_public*/ void cairo_surface_get_device_scale (cairo_surface_t* surface, double* x_scale, double* y_scale);
1942 /*cairo_public*/ void cairo_surface_set_device_offset (cairo_surface_t* surface, double x_offset, double y_offset);
1943 /*cairo_public*/ void cairo_surface_get_device_offset (cairo_surface_t* surface, double* x_offset, double* y_offset);
1944 /*cairo_public*/ void cairo_surface_set_fallback_resolution (cairo_surface_t* surface, double x_pixels_per_inch, double y_pixels_per_inch);
1945 /*cairo_public*/ void cairo_surface_get_fallback_resolution (cairo_surface_t* surface, double* x_pixels_per_inch, double* y_pixels_per_inch);
1946 /*cairo_public*/ void cairo_surface_copy_page (cairo_surface_t* surface);
1947 /*cairo_public*/ void cairo_surface_show_page (cairo_surface_t* surface);
1948 /*cairo_public*/ cairo_bool_t cairo_surface_has_show_text_glyphs (cairo_surface_t* surface);
1950 /* Image-surface functions */
1951 /*cairo_public*/ cairo_surface_t* cairo_image_surface_create (cairo_format_t format, int width, int height);
1952 /*cairo_public*/ int cairo_format_stride_for_width (cairo_format_t format, int width);
1953 /*cairo_public*/ cairo_surface_t* cairo_image_surface_create_for_data (ubyte* data, cairo_format_t format, int width, int height, int stride);
1954 /*cairo_public*/ ubyte* cairo_image_surface_get_data (cairo_surface_t* surface);
1955 /*cairo_public*/ cairo_format_t cairo_image_surface_get_format (cairo_surface_t* surface);
1956 /*cairo_public*/ int cairo_image_surface_get_width (cairo_surface_t* surface);
1957 /*cairo_public*/ int cairo_image_surface_get_height (cairo_surface_t* surface);
1958 /*cairo_public*/ int cairo_image_surface_get_stride (cairo_surface_t* surface);
1959 static if (CAIRO_HAS_PNG_FUNCTIONS) {
1960 /*cairo_public*/ cairo_surface_t* cairo_image_surface_create_from_png (const(char)* filename);
1961 /*cairo_public*/ cairo_surface_t* cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void* closure);
1964 /* Recording-surface functions */
1965 /*cairo_public*/ cairo_surface_t* cairo_recording_surface_create (cairo_content_t content, const(cairo_rectangle_t)* extents);
1966 /*cairo_public*/ void cairo_recording_surface_ink_extents (cairo_surface_t* surface, double* x0, double* y0, double* width, double* height);
1967 /*cairo_public*/ cairo_bool_t cairo_recording_surface_get_extents (cairo_surface_t* surface, cairo_rectangle_t* extents);
1969 /* raster-source pattern (callback) functions */
1972 * cairo_raster_source_acquire_func_t:
1973 * @pattern: the pattern being rendered from
1974 * @callback_data: the user data supplied during creation
1975 * @target: the rendering target surface
1976 * @extents: rectangular region of interest in pixels in sample space
1978 * #cairo_raster_source_acquire_func_t is the type of function which is
1979 * called when a pattern is being rendered from. It should create a surface
1980 * that provides the pixel data for the region of interest as defined by
1981 * extents, though the surface itself does not have to be limited to that
1982 * area. For convenience the surface should probably be of image type,
1983 * created with cairo_surface_create_similar_image() for the target (which
1984 * enables the number of copies to be reduced during transfer to the
1985 * device). Another option, might be to return a similar surface to the
1986 * target for explicit handling by the application of a set of cached sources
1987 * on the device. The region of sample data provided should be defined using
1988 * cairo_surface_set_device_offset() to specify the top-left corner of the
1989 * sample data (along with width and height of the surface).
1991 * Returns: a #cairo_surface_t
1993 * Since: 1.12
1995 alias cairo_raster_source_acquire_func_t = cairo_surface_t* function (cairo_pattern_t* pattern, void* callback_data, cairo_surface_t* target, const(cairo_rectangle_int_t)* extents);
1998 * cairo_raster_source_release_func_t:
1999 * @pattern: the pattern being rendered from
2000 * @callback_data: the user data supplied during creation
2001 * @surface: the surface created during acquire
2003 * #cairo_raster_source_release_func_t is the type of function which is
2004 * called when the pixel data is no longer being access by the pattern
2005 * for the rendering operation. Typically this function will simply
2006 * destroy the surface created during acquire.
2008 * Since: 1.12
2010 alias cairo_raster_source_release_func_t = void function (cairo_pattern_t* pattern, void* callback_data, cairo_surface_t* surface);
2013 * cairo_raster_source_snapshot_func_t:
2014 * @pattern: the pattern being rendered from
2015 * @callback_data: the user data supplied during creation
2017 * #cairo_raster_source_snapshot_func_t is the type of function which is
2018 * called when the pixel data needs to be preserved for later use
2019 * during printing. This pattern will be accessed again later, and it
2020 * is expected to provide the pixel data that was current at the time
2021 * of snapshotting.
2023 * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
2024 * #cairo_status_t error codes for failure.
2026 * Since: 1.12
2028 alias cairo_raster_source_snapshot_func_t = cairo_status_t function (cairo_pattern_t* pattern, void* callback_data);
2031 * cairo_raster_source_copy_func_t:
2032 * @pattern: the #cairo_pattern_t that was copied to
2033 * @callback_data: the user data supplied during creation
2034 * @other: the #cairo_pattern_t being used as the source for the copy
2036 * #cairo_raster_source_copy_func_t is the type of function which is
2037 * called when the pattern gets copied as a normal part of rendering.
2039 * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
2040 * #cairo_status_t error codes for failure.
2042 * Since: 1.12
2044 alias cairo_raster_source_copy_func_t = cairo_status_t function (cairo_pattern_t* pattern, void* callback_data, const(cairo_pattern_t)* other);
2047 * cairo_raster_source_finish_func_t:
2048 * @pattern: the pattern being rendered from
2049 * @callback_data: the user data supplied during creation
2051 * #cairo_raster_source_finish_func_t is the type of function which is
2052 * called when the pattern (or a copy thereof) is no longer required.
2054 * Since: 1.12
2056 alias cairo_raster_source_finish_func_t = void function (cairo_pattern_t* pattern, void* callback_data);
2058 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_raster_source (void* user_data, cairo_content_t content, int width, int height);
2059 /*cairo_public*/ void cairo_raster_source_pattern_set_callback_data (cairo_pattern_t* pattern, void* data);
2060 /*cairo_public*/ void* cairo_raster_source_pattern_get_callback_data (cairo_pattern_t* pattern);
2061 /*cairo_public*/ void cairo_raster_source_pattern_set_acquire (cairo_pattern_t* pattern, cairo_raster_source_acquire_func_t acquire, cairo_raster_source_release_func_t release);
2062 /*cairo_public*/ void cairo_raster_source_pattern_get_acquire (cairo_pattern_t* pattern, cairo_raster_source_acquire_func_t* acquire, cairo_raster_source_release_func_t* release);
2063 /*cairo_public*/ void cairo_raster_source_pattern_set_snapshot (cairo_pattern_t* pattern, cairo_raster_source_snapshot_func_t snapshot);
2064 /*cairo_public*/ cairo_raster_source_snapshot_func_t cairo_raster_source_pattern_get_snapshot (cairo_pattern_t* pattern);
2065 /*cairo_public*/ void cairo_raster_source_pattern_set_copy (cairo_pattern_t* pattern, cairo_raster_source_copy_func_t copy);
2066 /*cairo_public*/ cairo_raster_source_copy_func_t cairo_raster_source_pattern_get_copy (cairo_pattern_t* pattern);
2067 /*cairo_public*/ void cairo_raster_source_pattern_set_finish (cairo_pattern_t* pattern, cairo_raster_source_finish_func_t finish);
2068 /*cairo_public*/ cairo_raster_source_finish_func_t cairo_raster_source_pattern_get_finish (cairo_pattern_t* pattern);
2070 /* Pattern creation functions */
2071 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_rgb (double red, double green, double blue);
2072 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_rgba (double red, double green, double blue, double alpha);
2073 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_for_surface (cairo_surface_t* surface);
2074 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_linear (double x0, double y0, double x1, double y1);
2075 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1);
2076 /*cairo_public*/ cairo_pattern_t* cairo_pattern_create_mesh ();
2077 /*cairo_public*/ cairo_pattern_t* cairo_pattern_reference (cairo_pattern_t* pattern);
2078 /*cairo_public*/ void cairo_pattern_destroy (cairo_pattern_t* pattern);
2079 /*cairo_public*/ uint cairo_pattern_get_reference_count (cairo_pattern_t* pattern);
2080 /*cairo_public*/ cairo_status_t cairo_pattern_status (cairo_pattern_t* pattern);
2081 /*cairo_public*/ void* cairo_pattern_get_user_data (cairo_pattern_t* pattern, const(cairo_user_data_key_t)* key);
2082 /*cairo_public*/ cairo_status_t cairo_pattern_set_user_data (cairo_pattern_t* pattern, const(cairo_user_data_key_t)* key, void* user_data, cairo_destroy_func_t destroy);
2085 * cairo_pattern_type_t:
2086 * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
2087 * color. It may be opaque or translucent, since 1.2.
2088 * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image), since 1.2.
2089 * @CAIRO_PATTERN_TYPE_LINEAR: The pattern is a linear gradient, since 1.2.
2090 * @CAIRO_PATTERN_TYPE_RADIAL: The pattern is a radial gradient, since 1.2.
2091 * @CAIRO_PATTERN_TYPE_MESH: The pattern is a mesh, since 1.12.
2092 * @CAIRO_PATTERN_TYPE_RASTER_SOURCE: The pattern is a user pattern providing raster data, since 1.12.
2094 * #cairo_pattern_type_t is used to describe the type of a given pattern.
2096 * The type of a pattern is determined by the function used to create
2097 * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
2098 * functions create SOLID patterns. The remaining
2099 * cairo_pattern_create<!-- --> functions map to pattern types in obvious
2100 * ways.
2102 * The pattern type can be queried with cairo_pattern_get_type()
2104 * Most #cairo_pattern_t functions can be called with a pattern of any
2105 * type, (though trying to change the extend or filter for a solid
2106 * pattern will have no effect). A notable exception is
2107 * cairo_pattern_add_color_stop_rgb() and
2108 * cairo_pattern_add_color_stop_rgba() which must only be called with
2109 * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
2110 * will be shutdown and put into an error state.
2112 * New entries may be added in future versions.
2114 * Since: 1.2
2116 alias cairo_pattern_type_t = int;
2117 enum : cairo_pattern_type_t {
2118 CAIRO_PATTERN_TYPE_SOLID,
2119 CAIRO_PATTERN_TYPE_SURFACE,
2120 CAIRO_PATTERN_TYPE_LINEAR,
2121 CAIRO_PATTERN_TYPE_RADIAL,
2122 CAIRO_PATTERN_TYPE_MESH,
2123 CAIRO_PATTERN_TYPE_RASTER_SOURCE
2126 /*cairo_public*/ cairo_pattern_type_t cairo_pattern_get_type (cairo_pattern_t* pattern);
2127 /*cairo_public*/ void cairo_pattern_add_color_stop_rgb (cairo_pattern_t* pattern, double offset, double red, double green, double blue);
2128 /*cairo_public*/ void cairo_pattern_add_color_stop_rgba (cairo_pattern_t* pattern, double offset, double red, double green, double blue, double alpha);
2129 /*cairo_public*/ void cairo_mesh_pattern_begin_patch (cairo_pattern_t* pattern);
2130 /*cairo_public*/ void cairo_mesh_pattern_end_patch (cairo_pattern_t* pattern);
2131 /*cairo_public*/ void cairo_mesh_pattern_curve_to (cairo_pattern_t* pattern, double x1, double y1, double x2, double y2, double x3, double y3);
2132 /*cairo_public*/ void cairo_mesh_pattern_line_to (cairo_pattern_t* pattern, double x, double y);
2133 /*cairo_public*/ void cairo_mesh_pattern_move_to (cairo_pattern_t* pattern, double x, double y);
2134 /*cairo_public*/ void cairo_mesh_pattern_set_control_point (cairo_pattern_t* pattern, uint point_num, double x, double y);
2135 /*cairo_public*/ void cairo_mesh_pattern_set_corner_color_rgb (cairo_pattern_t* pattern, uint corner_num, double red, double green, double blue);
2136 /*cairo_public*/ void cairo_mesh_pattern_set_corner_color_rgba (cairo_pattern_t* pattern, uint corner_num, double red, double green, double blue, double alpha);
2137 /*cairo_public*/ void cairo_pattern_set_matrix (cairo_pattern_t* pattern, const(cairo_matrix_t)* matrix);
2138 /*cairo_public*/ void cairo_pattern_get_matrix (cairo_pattern_t* pattern, cairo_matrix_t* matrix);
2141 * cairo_extend_t:
2142 * @CAIRO_EXTEND_NONE: pixels outside of the source pattern
2143 * are fully transparent (Since 1.0)
2144 * @CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating (Since 1.0)
2145 * @CAIRO_EXTEND_REFLECT: the pattern is tiled by reflecting
2146 * at the edges (Since 1.0; but only implemented for surface patterns since 1.6)
2147 * @CAIRO_EXTEND_PAD: pixels outside of the pattern copy
2148 * the closest pixel from the source (Since 1.2; but only
2149 * implemented for surface patterns since 1.6)
2151 * #cairo_extend_t is used to describe how pattern color/alpha will be
2152 * determined for areas "outside" the pattern's natural area, (for
2153 * example, outside the surface bounds or outside the gradient
2154 * geometry).
2156 * Mesh patterns are not affected by the extend mode.
2158 * The default extend mode is %CAIRO_EXTEND_NONE for surface patterns
2159 * and %CAIRO_EXTEND_PAD for gradient patterns.
2161 * New entries may be added in future versions.
2163 * Since: 1.0
2165 alias cairo_extend_t = int;
2166 enum : cairo_extend_t {
2167 CAIRO_EXTEND_NONE,
2168 CAIRO_EXTEND_REPEAT,
2169 CAIRO_EXTEND_REFLECT,
2170 CAIRO_EXTEND_PAD
2173 /*cairo_public*/ void cairo_pattern_set_extend (cairo_pattern_t* pattern, cairo_extend_t extend);
2174 /*cairo_public*/ cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t* pattern);
2177 * cairo_filter_t:
2178 * @CAIRO_FILTER_FAST: A high-performance filter, with quality similar
2179 * to %CAIRO_FILTER_NEAREST (Since 1.0)
2180 * @CAIRO_FILTER_GOOD: A reasonable-performance filter, with quality
2181 * similar to %CAIRO_FILTER_BILINEAR (Since 1.0)
2182 * @CAIRO_FILTER_BEST: The highest-quality available, performance may
2183 * not be suitable for interactive use. (Since 1.0)
2184 * @CAIRO_FILTER_NEAREST: Nearest-neighbor filtering (Since 1.0)
2185 * @CAIRO_FILTER_BILINEAR: Linear interpolation in two dimensions (Since 1.0)
2186 * @CAIRO_FILTER_GAUSSIAN: This filter value is currently
2187 * unimplemented, and should not be used in current code. (Since 1.0)
2189 * #cairo_filter_t is used to indicate what filtering should be
2190 * applied when reading pixel values from patterns. See
2191 * cairo_pattern_set_filter() for indicating the desired filter to be
2192 * used with a particular pattern.
2194 * Since: 1.0
2196 alias cairo_filter_t = int;
2197 enum : cairo_filter_t {
2198 CAIRO_FILTER_FAST,
2199 CAIRO_FILTER_GOOD,
2200 CAIRO_FILTER_BEST,
2201 CAIRO_FILTER_NEAREST,
2202 CAIRO_FILTER_BILINEAR,
2203 CAIRO_FILTER_GAUSSIAN
2206 /*cairo_public*/ void cairo_pattern_set_filter (cairo_pattern_t* pattern, cairo_filter_t filter);
2207 /*cairo_public*/ cairo_filter_t cairo_pattern_get_filter (cairo_pattern_t* pattern);
2208 /*cairo_public*/ cairo_status_t cairo_pattern_get_rgba (cairo_pattern_t* pattern, double* red, double* green, double* blue, double* alpha);
2209 /*cairo_public*/ cairo_status_t cairo_pattern_get_surface (cairo_pattern_t* pattern, cairo_surface_t** surface);
2211 /*cairo_public*/ cairo_status_t cairo_pattern_get_color_stop_rgba (cairo_pattern_t* pattern, int index, double* offset, double* red, double* green, double* blue, double* alpha);
2212 /*cairo_public*/ cairo_status_t cairo_pattern_get_color_stop_count (cairo_pattern_t* pattern, int* count);
2213 /*cairo_public*/ cairo_status_t cairo_pattern_get_linear_points (cairo_pattern_t* pattern, double* x0, double* y0, double* x1, double* y1);
2214 /*cairo_public*/ cairo_status_t cairo_pattern_get_radial_circles (cairo_pattern_t* pattern, double* x0, double* y0, double* r0, double* x1, double* y1, double* r1);
2215 /*cairo_public*/ cairo_status_t cairo_mesh_pattern_get_patch_count (cairo_pattern_t* pattern, uint* count);
2216 /*cairo_public*/ cairo_path_t* cairo_mesh_pattern_get_path (cairo_pattern_t* pattern, uint patch_num);
2217 /*cairo_public*/ cairo_status_t cairo_mesh_pattern_get_corner_color_rgba (cairo_pattern_t* pattern, uint patch_num, uint corner_num, double* red, double* green, double* blue, double* alpha);
2218 /*cairo_public*/ cairo_status_t cairo_mesh_pattern_get_control_point (cairo_pattern_t* pattern, uint patch_num, uint point_num, double* x, double* y);
2220 /* Matrix functions */
2221 /*cairo_public*/ void cairo_matrix_init (cairo_matrix_t* matrix, double xx, double yx, double xy, double yy, double x0, double y0);
2222 /*cairo_public*/ void cairo_matrix_init_identity (cairo_matrix_t* matrix);
2223 /*cairo_public*/ void cairo_matrix_init_translate (cairo_matrix_t* matrix, double tx, double ty);
2224 /*cairo_public*/ void cairo_matrix_init_scale (cairo_matrix_t* matrix, double sx, double sy);
2225 /*cairo_public*/ void cairo_matrix_init_rotate (cairo_matrix_t* matrix, double radians);
2226 /*cairo_public*/ void cairo_matrix_translate (cairo_matrix_t* matrix, double tx, double ty);
2227 /*cairo_public*/ void cairo_matrix_scale (cairo_matrix_t* matrix, double sx, double sy);
2228 /*cairo_public*/ void cairo_matrix_rotate (cairo_matrix_t* matrix, double radians);
2229 /*cairo_public*/ cairo_status_t cairo_matrix_invert (cairo_matrix_t* matrix);
2230 /*cairo_public*/ void cairo_matrix_multiply (cairo_matrix_t* result, const(cairo_matrix_t)* a, const(cairo_matrix_t)* b);
2231 /*cairo_public*/ void cairo_matrix_transform_distance (const(cairo_matrix_t)* matrix, double* dx, double* dy);
2232 /*cairo_public*/ void cairo_matrix_transform_point (const(cairo_matrix_t)* matrix, double* x, double* y);
2234 /* Region functions */
2237 * cairo_region_t:
2239 * A #cairo_region_t represents a set of integer-aligned rectangles.
2241 * It allows set-theoretical operations like cairo_region_union() and
2242 * cairo_region_intersect() to be performed on them.
2244 * Memory management of #cairo_region_t is done with
2245 * cairo_region_reference() and cairo_region_destroy().
2247 * Since: 1.10
2249 struct cairo_region_t;
2252 * cairo_region_overlap_t:
2253 * @CAIRO_REGION_OVERLAP_IN: The contents are entirely inside the region. (Since 1.10)
2254 * @CAIRO_REGION_OVERLAP_OUT: The contents are entirely outside the region. (Since 1.10)
2255 * @CAIRO_REGION_OVERLAP_PART: The contents are partially inside and
2256 * partially outside the region. (Since 1.10)
2258 * Used as the return value for cairo_region_contains_rectangle().
2260 * Since: 1.10
2262 alias cairo_region_overlap_t = int;
2263 enum : cairo_region_overlap_t {
2264 CAIRO_REGION_OVERLAP_IN, /* completely inside region */
2265 CAIRO_REGION_OVERLAP_OUT, /* completely outside region */
2266 CAIRO_REGION_OVERLAP_PART /* partly inside region */
2269 /*cairo_public*/ cairo_region_t* cairo_region_create ();
2270 /*cairo_public*/ cairo_region_t* cairo_region_create_rectangle (const(cairo_rectangle_int_t)* rectangle);
2271 /*cairo_public*/ cairo_region_t* cairo_region_create_rectangles (const(cairo_rectangle_int_t)* rects, int count);
2272 /*cairo_public*/ cairo_region_t* cairo_region_copy (const(cairo_region_t)* original);
2273 /*cairo_public*/ cairo_region_t* cairo_region_reference (cairo_region_t* region);
2274 /*cairo_public*/ void cairo_region_destroy (cairo_region_t* region);
2275 /*cairo_public*/ cairo_bool_t cairo_region_equal (const(cairo_region_t)* a, const(cairo_region_t)* b);
2276 /*cairo_public*/ cairo_status_t cairo_region_status (const(cairo_region_t)* region);
2277 /*cairo_public*/ void cairo_region_get_extents (const(cairo_region_t)* region, cairo_rectangle_int_t* extents);
2278 /*cairo_public*/ int cairo_region_num_rectangles (const(cairo_region_t)* region);
2279 /*cairo_public*/ void cairo_region_get_rectangle (const(cairo_region_t)* region, int nth, cairo_rectangle_int_t* rectangle);
2280 /*cairo_public*/ cairo_bool_t cairo_region_is_empty (const(cairo_region_t)* region);
2281 /*cairo_public*/ cairo_region_overlap_t cairo_region_contains_rectangle (const(cairo_region_t)* region, const(cairo_rectangle_int_t)* rectangle);
2282 /*cairo_public*/ cairo_bool_t cairo_region_contains_point (const(cairo_region_t)* region, int x, int y);
2283 /*cairo_public*/ void cairo_region_translate (cairo_region_t* region, int dx, int dy);
2284 /*cairo_public*/ cairo_status_t cairo_region_subtract (cairo_region_t* dst, const(cairo_region_t)* other);
2285 /*cairo_public*/ cairo_status_t cairo_region_subtract_rectangle (cairo_region_t* dst, const(cairo_rectangle_int_t)* rectangle);
2286 /*cairo_public*/ cairo_status_t cairo_region_intersect (cairo_region_t* dst, const(cairo_region_t)* other);
2287 /*cairo_public*/ cairo_status_t cairo_region_intersect_rectangle (cairo_region_t* dst, const(cairo_rectangle_int_t)* rectangle);
2288 /*cairo_public*/ cairo_status_t cairo_region_union (cairo_region_t* dst, const(cairo_region_t)* other);
2289 /*cairo_public*/ cairo_status_t cairo_region_union_rectangle (cairo_region_t* dst, const(cairo_rectangle_int_t)* rectangle);
2290 /*cairo_public*/ cairo_status_t cairo_region_xor (cairo_region_t* dst, const(cairo_region_t)* other);
2291 /*cairo_public*/ cairo_status_t cairo_region_xor_rectangle (cairo_region_t* dst, const(cairo_rectangle_int_t)* rectangle);
2293 /* Functions to be used while debugging (not intended for use in production code) */
2294 /*cairo_public*/ void cairo_debug_reset_static_data ();
2297 /* cairo - a vector graphics library with display and print output
2299 * Copyright © 2002 University of Southern California
2301 * This library is free software; you can redistribute it and/or
2302 * modify it either under the terms of the GNU Lesser General Public
2303 * License version 2.1 as published by the Free Software Foundation
2304 * (the "LGPL") or, at your option, under the terms of the Mozilla
2305 * Public License Version 1.1 (the "MPL"). If you do not alter this
2306 * notice, a recipient may use your version of this file under either
2307 * the MPL or the LGPL.
2309 * You should have received a copy of the LGPL along with this library
2310 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2311 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2312 * You should have received a copy of the MPL along with this library
2313 * in the file COPYING-MPL-1.1
2315 * The contents of this file are subject to the Mozilla Public License
2316 * Version 1.1 (the "License"); you may not use this file except in
2317 * compliance with the License. You may obtain a copy of the License at
2318 * http://www.mozilla.org/MPL/
2320 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2321 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2322 * the specific language governing rights and limitations.
2324 * The Original Code is the cairo graphics library.
2326 * The Initial Developer of the Original Code is University of Southern
2327 * California.
2329 * Contributor(s):
2330 * Carl D. Worth <cworth@cworth.org>
2332 static if (CAIRO_HAS_XLIB_SURFACE) {
2333 import iv.x11.x11;
2334 import iv.x11.xlib;
2336 /*cairo_public*/ cairo_surface_t* cairo_xlib_surface_create (Display* dpy, Drawable drawable, Visual* visual, int width, int height);
2337 /*cairo_public*/ cairo_surface_t* cairo_xlib_surface_create_for_bitmap (Display* dpy, Pixmap bitmap, Screen* screen, int width, int height);
2338 /*cairo_public*/ void cairo_xlib_surface_set_size (cairo_surface_t* surface, int width, int height);
2339 /*cairo_public*/ void cairo_xlib_surface_set_drawable (cairo_surface_t* surface, Drawable drawable, int width, int height);
2340 /*cairo_public*/ Display* cairo_xlib_surface_get_display (cairo_surface_t* surface);
2341 /*cairo_public*/ Drawable cairo_xlib_surface_get_drawable (cairo_surface_t* surface);
2342 /*cairo_public*/ Screen* cairo_xlib_surface_get_screen (cairo_surface_t* surface);
2343 /*cairo_public*/ Visual* cairo_xlib_surface_get_visual (cairo_surface_t* surface);
2344 /*cairo_public*/ int cairo_xlib_surface_get_depth (cairo_surface_t* surface);
2345 /*cairo_public*/ int cairo_xlib_surface_get_width (cairo_surface_t* surface);
2346 /*cairo_public*/ int cairo_xlib_surface_get_height (cairo_surface_t* surface);
2348 /* debug interface */
2349 /*cairo_public*/ void cairo_xlib_device_debug_cap_xrender_version (cairo_device_t* device, int major_version, int minor_version);
2352 * @precision: -1 implies automatically choose based on antialiasing mode,
2353 * any other value overrides and sets the corresponding PolyMode.
2355 /*cairo_public*/ void cairo_xlib_device_debug_set_precision (cairo_device_t* device, int precision);
2357 /*cairo_public*/ int cairo_xlib_device_debug_get_precision (cairo_device_t* device);
2361 /* cairo - a vector graphics library with display and print output
2363 * Copyright © 2002 University of Southern California
2365 * This library is free software; you can redistribute it and/or
2366 * modify it either under the terms of the GNU Lesser General Public
2367 * License version 2.1 as published by the Free Software Foundation
2368 * (the "LGPL") or, at your option, under the terms of the Mozilla
2369 * Public License Version 1.1 (the "MPL"). If you do not alter this
2370 * notice, a recipient may use your version of this file under either
2371 * the MPL or the LGPL.
2373 * You should have received a copy of the LGPL along with this library
2374 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2375 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2376 * You should have received a copy of the MPL along with this library
2377 * in the file COPYING-MPL-1.1
2379 * The contents of this file are subject to the Mozilla Public License
2380 * Version 1.1 (the "License"); you may not use this file except in
2381 * compliance with the License. You may obtain a copy of the License at
2382 * http://www.mozilla.org/MPL/
2384 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2385 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2386 * the specific language governing rights and limitations.
2388 * The Original Code is the cairo graphics library.
2390 * The Initial Developer of the Original Code is University of Southern
2391 * California.
2393 * Contributor(s):
2394 * Carl D. Worth <cworth@cworth.org>
2396 static if (CAIRO_HAS_XLIB_XRENDER_SURFACE) {
2397 import iv.x11.xlib;
2398 import iv.x11.extensions.xrender;
2400 /*cairo_public*/ cairo_surface_t* cairo_xlib_surface_create_with_xrender_format (Display* dpy, Drawable drawable, Screen* screen, XRenderPictFormat* format, int width, int height);
2401 /*cairo_public*/ XRenderPictFormat* cairo_xlib_surface_get_xrender_format (cairo_surface_t* surface);
2405 /* Cairo - a vector graphics library with display and print output
2407 * Copyright © 2009 Eric Anholt
2408 * Copyright © 2009 Chris Wilson
2410 * This library is free software; you can redistribute it and/or
2411 * modify it either under the terms of the GNU Lesser General Public
2412 * License version 2.1 as published by the Free Software Foundation
2413 * (the "LGPL") or, at your option, under the terms of the Mozilla
2414 * Public License Version 1.1 (the "MPL"). If you do not alter this
2415 * notice, a recipient may use your version of this file under either
2416 * the MPL or the LGPL.
2418 * You should have received a copy of the LGPL along with this library
2419 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2420 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2421 * You should have received a copy of the MPL along with this library
2422 * in the file COPYING-MPL-1.1
2424 * The contents of this file are subject to the Mozilla Public License
2425 * Version 1.1 (the "License"); you may not use this file except in
2426 * compliance with the License. You may obtain a copy of the License at
2427 * http://www.mozilla.org/MPL/
2429 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2430 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2431 * the specific language governing rights and limitations.
2433 * The Original Code is the cairo graphics library.
2435 * The Initial Developer of the Original Code is Eric Anholt.
2439 * cairo-gl.h:
2441 * The cairo-gl backend provides an implementation of possibly
2442 * hardware-accelerated cairo rendering by targeting the OpenGL API.
2443 * The goal of the cairo-gl backend is to provide better performance
2444 * with equal functionality to cairo-image where possible. It does
2445 * not directly provide for applying additional OpenGL effects to
2446 * cairo surfaces.
2448 * Cairo-gl allows interoperability with other GL rendering through GL
2449 * context sharing. Cairo-gl surfaces are created in reference to a
2450 * #cairo_device_t, which represents a GL context created by the user.
2451 * When that GL context is created with its sharePtr set to another
2452 * context (or vice versa), its objects (textures backing cairo-gl
2453 * surfaces) can be accessed in the other OpenGL context. This allows
2454 * cairo-gl to maintain its drawing state in one context while the
2455 * user's 3D rendering occurs in the user's other context.
2457 * However, as only one context can be current to a thread at a time,
2458 * cairo-gl may make its context current to the thread on any cairo
2459 * call which interacts with a cairo-gl surface or the cairo-gl
2460 * device. As a result, the user must make their own context current
2461 * between any cairo calls and their own OpenGL rendering.
2463 static if (CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE) {
2464 /*cairo_public*/ cairo_surface_t* cairo_gl_surface_create (cairo_device_t* device, cairo_content_t content, int width, int height);
2465 /*cairo_public*/ cairo_surface_t* cairo_gl_surface_create_for_texture (cairo_device_t* abstract_device, cairo_content_t content, uint tex, int width, int height);
2466 /*cairo_public*/ void cairo_gl_surface_set_size (cairo_surface_t* surface, int width, int height);
2467 /*cairo_public*/ int cairo_gl_surface_get_width (cairo_surface_t* abstract_surface);
2468 /*cairo_public*/ int cairo_gl_surface_get_height (cairo_surface_t* abstract_surface);
2469 /*cairo_public*/ void cairo_gl_surface_swapbuffers (cairo_surface_t* surface);
2470 /*cairo_public*/ void cairo_gl_device_set_thread_aware (cairo_device_t* device, cairo_bool_t thread_aware);
2472 static if (CAIRO_HAS_GLX_FUNCTIONS) {
2473 import iv.glbinds : GLXContext;
2474 /*cairo_public*/ cairo_device_t* cairo_glx_device_create (Display* dpy, GLXContext gl_ctx);
2475 /*cairo_public*/ Display* cairo_glx_device_get_display (cairo_device_t* device);
2476 /*cairo_public*/ GLXContext cairo_glx_device_get_context (cairo_device_t* device);
2477 /*cairo_public*/ cairo_surface_t* cairo_gl_surface_create_for_window (cairo_device_t* device, Window win, int width, int height);
2481 #if CAIRO_HAS_WGL_FUNCTIONS
2482 #include <windows.h>
2484 /*cairo_public*/ cairo_device_t*
2485 cairo_wgl_device_create (HGLRC rc);
2487 /*cairo_public*/ HGLRC
2488 cairo_wgl_device_get_context (cairo_device_t* device);
2490 /*cairo_public*/ cairo_surface_t*
2491 cairo_gl_surface_create_for_dc (cairo_device_t* device,
2492 HDC dc,
2493 int width,
2494 int height);
2495 #endif
2499 #if CAIRO_HAS_EGL_FUNCTIONS
2500 #include <EGL/egl.h>
2502 /*cairo_public*/ cairo_device_t*
2503 cairo_egl_device_create (EGLDisplay dpy, EGLContext egl);
2505 /*cairo_public*/ cairo_surface_t*
2506 cairo_gl_surface_create_for_egl (cairo_device_t* device,
2507 EGLSurface egl,
2508 int width,
2509 int height);
2511 /*cairo_public*/ EGLDisplay
2512 cairo_egl_device_get_display (cairo_device_t* device);
2514 /*cairo_public*/ EGLSurface
2515 cairo_egl_device_get_context (cairo_device_t* device);
2516 #endif
2521 /* cairo - a vector graphics library with display and print output
2523 * Copyright © 2005 Red Hat, Inc
2525 * This library is free software; you can redistribute it and/or
2526 * modify it either under the terms of the GNU Lesser General Public
2527 * License version 2.1 as published by the Free Software Foundation
2528 * (the "LGPL") or, at your option, under the terms of the Mozilla
2529 * Public License Version 1.1 (the "MPL"). If you do not alter this
2530 * notice, a recipient may use your version of this file under either
2531 * the MPL or the LGPL.
2533 * You should have received a copy of the LGPL along with this library
2534 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2535 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2536 * You should have received a copy of the MPL along with this library
2537 * in the file COPYING-MPL-1.1
2539 * The contents of this file are subject to the Mozilla Public License
2540 * Version 1.1 (the "License"); you may not use this file except in
2541 * compliance with the License. You may obtain a copy of the License at
2542 * http://www.mozilla.org/MPL/
2544 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2545 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2546 * the specific language governing rights and limitations.
2548 * The Original Code is the cairo graphics library.
2550 * The Initial Developer of the Original Code is Red Hat, Inc.
2552 * Contributor(s):
2553 * Graydon Hoare <graydon@redhat.com>
2554 * Owen Taylor <otaylor@redhat.com>
2556 static if (CAIRO_HAS_FT_FONT) {
2557 /* Fontconfig/Freetype platform-specific font interface */
2558 import iv.freetype;
2559 static if (CAIRO_HAS_FC_FONT) import iv.fontconfig;
2561 /*cairo_public*/ cairo_font_face_t* cairo_ft_font_face_create_for_ft_face (FT_Face face, int load_flags);
2564 * cairo_ft_synthesize_t:
2565 * @CAIRO_FT_SYNTHESIZE_BOLD: Embolden the glyphs (redraw with a pixel offset)
2566 * @CAIRO_FT_SYNTHESIZE_OBLIQUE: Slant the glyph outline by 12 degrees to the
2567 * right.
2569 * A set of synthesis options to control how FreeType renders the glyphs
2570 * for a particular font face.
2572 * Individual synthesis features of a #cairo_ft_font_face_t can be set
2573 * using cairo_ft_font_face_set_synthesize(), or disabled using
2574 * cairo_ft_font_face_unset_synthesize(). The currently enabled set of
2575 * synthesis options can be queried with cairo_ft_font_face_get_synthesize().
2577 * Note: that when synthesizing glyphs, the font metrics returned will only
2578 * be estimates.
2580 * Since: 1.12
2582 alias cairo_ft_synthesize_t = int;
2583 enum : cairo_ft_synthesize_t {
2584 CAIRO_FT_SYNTHESIZE_BOLD = 1 << 0,
2585 CAIRO_FT_SYNTHESIZE_OBLIQUE = 1 << 1
2588 /*cairo_public*/ void cairo_ft_font_face_set_synthesize (cairo_font_face_t* font_face, uint synth_flags);
2589 /*cairo_public*/ void cairo_ft_font_face_unset_synthesize (cairo_font_face_t* font_face, uint synth_flags);
2590 /*cairo_public*/ uint cairo_ft_font_face_get_synthesize (cairo_font_face_t* font_face);
2592 /*cairo_public*/ FT_Face cairo_ft_scaled_font_lock_face (cairo_scaled_font_t* scaled_font);
2593 /*cairo_public*/ void cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t* scaled_font);
2595 static if (CAIRO_HAS_FC_FONT) {
2596 /*cairo_public*/ cairo_font_face_t* cairo_ft_font_face_create_for_pattern (FcPattern* pattern);
2597 /*cairo_public*/ void cairo_ft_font_options_substitute (const(cairo_font_options_t)* options, FcPattern* pattern);
2602 /* cairo - a vector graphics library with display and print output
2604 * Copyright © 2002 University of Southern California
2606 * This library is free software; you can redistribute it and/or
2607 * modify it either under the terms of the GNU Lesser General Public
2608 * License version 2.1 as published by the Free Software Foundation
2609 * (the "LGPL") or, at your option, under the terms of the Mozilla
2610 * Public License Version 1.1 (the "MPL"). If you do not alter this
2611 * notice, a recipient may use your version of this file under either
2612 * the MPL or the LGPL.
2614 * You should have received a copy of the LGPL along with this library
2615 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2616 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2617 * You should have received a copy of the MPL along with this library
2618 * in the file COPYING-MPL-1.1
2620 * The contents of this file are subject to the Mozilla Public License
2621 * Version 1.1 (the "License"); you may not use this file except in
2622 * compliance with the License. You may obtain a copy of the License at
2623 * http://www.mozilla.org/MPL/
2625 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2626 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2627 * the specific language governing rights and limitations.
2629 * The Original Code is the cairo graphics library.
2631 * The Initial Developer of the Original Code is University of Southern
2632 * California.
2634 * Contributor(s):
2635 * Carl D. Worth <cworth@cworth.org>
2637 static if (CAIRO_HAS_PDF_SURFACE) {
2639 * cairo_pdf_version_t:
2640 * @CAIRO_PDF_VERSION_1_4: The version 1.4 of the PDF specification. (Since 1.10)
2641 * @CAIRO_PDF_VERSION_1_5: The version 1.5 of the PDF specification. (Since 1.10)
2643 * #cairo_pdf_version_t is used to describe the version number of the PDF
2644 * specification that a generated PDF file will conform to.
2646 * Since: 1.10
2648 alias cairo_pdf_version_t = int;
2649 enum : cairo_pdf_version_t {
2650 CAIRO_PDF_VERSION_1_4,
2651 CAIRO_PDF_VERSION_1_5
2654 /*cairo_public*/ cairo_surface_t* cairo_pdf_surface_create (const(char)* filename, double width_in_points, double height_in_points);
2655 /*cairo_public*/ cairo_surface_t* cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func, void* closure, double width_in_points, double height_in_points);
2656 /*cairo_public*/ void cairo_pdf_surface_restrict_to_version (cairo_surface_t* surface, cairo_pdf_version_t version_);
2657 /*cairo_public*/ void cairo_pdf_get_versions (const(cairo_pdf_version_t)** versions, int* num_versions);
2658 /*cairo_public*/ const(char)* cairo_pdf_version_to_string (cairo_pdf_version_t version_);
2659 /*cairo_public*/ void cairo_pdf_surface_set_size (cairo_surface_t* surface, double width_in_points, double height_in_points);
2663 /* cairo - a vector graphics library with display and print output
2665 * Copyright © 2002 University of Southern California
2667 * This library is free software; you can redistribute it and/or
2668 * modify it either under the terms of the GNU Lesser General Public
2669 * License version 2.1 as published by the Free Software Foundation
2670 * (the "LGPL") or, at your option, under the terms of the Mozilla
2671 * Public License Version 1.1 (the "MPL"). If you do not alter this
2672 * notice, a recipient may use your version of this file under either
2673 * the MPL or the LGPL.
2675 * You should have received a copy of the LGPL along with this library
2676 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2677 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2678 * You should have received a copy of the MPL along with this library
2679 * in the file COPYING-MPL-1.1
2681 * The contents of this file are subject to the Mozilla Public License
2682 * Version 1.1 (the "License"); you may not use this file except in
2683 * compliance with the License. You may obtain a copy of the License at
2684 * http://www.mozilla.org/MPL/
2686 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2687 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2688 * the specific language governing rights and limitations.
2690 * The Original Code is the cairo graphics library.
2692 * The Initial Developer of the Original Code is University of Southern
2693 * California.
2695 * Contributor(s):
2696 * Carl D. Worth <cworth@cworth.org>
2698 static if (CAIRO_HAS_PS_SURFACE) {
2699 /* PS-surface functions */
2702 * cairo_ps_level_t:
2703 * @CAIRO_PS_LEVEL_2: The language level 2 of the PostScript specification. (Since 1.6)
2704 * @CAIRO_PS_LEVEL_3: The language level 3 of the PostScript specification. (Since 1.6)
2706 * #cairo_ps_level_t is used to describe the language level of the
2707 * PostScript Language Reference that a generated PostScript file will
2708 * conform to.
2710 * Since: 1.6
2712 alias cairo_ps_level_t = int;
2713 enum : cairo_ps_level_t {
2714 CAIRO_PS_LEVEL_2,
2715 CAIRO_PS_LEVEL_3
2718 /*cairo_public*/ cairo_surface_t* cairo_ps_surface_create (const(char)* filename, double width_in_points, double height_in_points);
2719 /*cairo_public*/ cairo_surface_t* cairo_ps_surface_create_for_stream (cairo_write_func_t write_func, void* closure, double width_in_points, double height_in_points);
2720 /*cairo_public*/ void cairo_ps_surface_restrict_to_level (cairo_surface_t* surface, cairo_ps_level_t level);
2721 /*cairo_public*/ void cairo_ps_get_levels (const(cairo_ps_level_t)** levels, int* num_levels);
2722 /*cairo_public*/ const(char)* cairo_ps_level_to_string (cairo_ps_level_t level);
2723 /*cairo_public*/ void cairo_ps_surface_set_eps (cairo_surface_t* surface, cairo_bool_t eps);
2724 /*cairo_public*/ cairo_bool_t cairo_ps_surface_get_eps (cairo_surface_t* surface);
2725 /*cairo_public*/ void cairo_ps_surface_set_size (cairo_surface_t* surface, double width_in_points, double height_in_points);
2726 /*cairo_public*/ void cairo_ps_surface_dsc_comment (cairo_surface_t* surface, const(char)* comment);
2727 /*cairo_public*/ void cairo_ps_surface_dsc_begin_setup (cairo_surface_t* surface);
2728 /*cairo_public*/ void cairo_ps_surface_dsc_begin_page_setup (cairo_surface_t* surface);
2732 /* cairo - a vector graphics library with display and print output
2734 * Copyright © 2008 Chris Wilson
2736 * This library is free software; you can redistribute it and/or
2737 * modify it either under the terms of the GNU Lesser General Public
2738 * License version 2.1 as published by the Free Software Foundation
2739 * (the "LGPL") or, at your option, under the terms of the Mozilla
2740 * Public License Version 1.1 (the "MPL"). If you do not alter this
2741 * notice, a recipient may use your version of this file under either
2742 * the MPL or the LGPL.
2744 * You should have received a copy of the LGPL along with this library
2745 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2746 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2747 * You should have received a copy of the MPL along with this library
2748 * in the file COPYING-MPL-1.1
2750 * The contents of this file are subject to the Mozilla Public License
2751 * Version 1.1 (the "License"); you may not use this file except in
2752 * compliance with the License. You may obtain a copy of the License at
2753 * http://www.mozilla.org/MPL/
2755 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2756 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2757 * the specific language governing rights and limitations.
2759 * The Original Code is the cairo graphics library.
2761 * The Initial Developer of the Original Code is Chris Wilson
2763 * Contributor(s):
2764 * Chris Wilson <chris@chris-wilson.co.uk>
2766 static if (CAIRO_HAS_SCRIPT_SURFACE) {
2768 * cairo_script_mode_t:
2769 * @CAIRO_SCRIPT_MODE_ASCII: the output will be in readable text (default). (Since 1.12)
2770 * @CAIRO_SCRIPT_MODE_BINARY: the output will use byte codes. (Since 1.12)
2772 * A set of script output variants.
2774 * Since: 1.12
2776 alias cairo_script_mode_t = int;
2777 enum : cairo_script_mode_t {
2778 CAIRO_SCRIPT_MODE_ASCII,
2779 CAIRO_SCRIPT_MODE_BINARY
2782 /*cairo_public*/ cairo_device_t* cairo_script_create (const(char)* filename);
2783 /*cairo_public*/ cairo_device_t* cairo_script_create_for_stream (cairo_write_func_t write_func, void* closure);
2784 /*cairo_public*/ void cairo_script_write_comment (cairo_device_t* script, const(char)* comment, int len);
2785 /*cairo_public*/ void cairo_script_set_mode (cairo_device_t* script, cairo_script_mode_t mode);
2786 /*cairo_public*/ cairo_script_mode_t cairo_script_get_mode (cairo_device_t* script);
2787 /*cairo_public*/ cairo_surface_t* cairo_script_surface_create (cairo_device_t* script, cairo_content_t content, double width, double height);
2788 /*cairo_public*/ cairo_surface_t* cairo_script_surface_create_for_target (cairo_device_t* script, cairo_surface_t* target);
2789 /*cairo_public*/ cairo_status_t cairo_script_from_recording_surface (cairo_device_t* script, cairo_surface_t* recording_surface);
2793 /* cairo - a vector graphics library with display and print output
2795 * Copyright © 2008 Chris Wilson
2797 * This library is free software; you can redistribute it and/or
2798 * modify it either under the terms of the GNU Lesser General Public
2799 * License version 2.1 as published by the Free Software Foundation
2800 * (the "LGPL") or, at your option, under the terms of the Mozilla
2801 * Public License Version 1.1 (the "MPL"). If you do not alter this
2802 * notice, a recipient may use your version of this file under either
2803 * the MPL or the LGPL.
2805 * You should have received a copy of the LGPL along with this library
2806 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2807 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2808 * You should have received a copy of the MPL along with this library
2809 * in the file COPYING-MPL-1.1
2811 * The contents of this file are subject to the Mozilla Public License
2812 * Version 1.1 (the "License"); you may not use this file except in
2813 * compliance with the License. You may obtain a copy of the License at
2814 * http://www.mozilla.org/MPL/
2816 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2817 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2818 * the specific language governing rights and limitations.
2820 * The Original Code is the cairo graphics library.
2822 * The Initial Developer of the Original Code is Chris Wilson
2824 * Contributor(s):
2825 * Chris Wilson <chris@chris-wilson.co.uk>
2827 import core.stdc.stdio : FILE;
2828 struct cairo_script_interpreter_t;
2830 /* XXX expose csi_dictionary_t and pass to hooks */
2831 alias csi_destroy_func_t = void function (void* closure, void* ptr);
2833 alias csi_surface_create_func_t = cairo_surface_t* function (void* closure, cairo_content_t content, double width, double height, c_long uid);
2834 alias csi_context_create_func_t = cairo_t* function (void* closure, cairo_surface_t* surface);
2835 alias csi_show_page_func_t = void function (void* closure, cairo_t* cr);
2836 alias csi_copy_page_func_t = void function (void* closure, cairo_t* cr);
2837 alias csi_create_source_image_t = cairo_surface_t* function (void* closure, cairo_format_t format, int width, int height, c_long uid);
2839 struct cairo_script_interpreter_hooks_t {
2840 void* closure;
2841 csi_surface_create_func_t surface_create;
2842 csi_destroy_func_t surface_destroy;
2843 csi_context_create_func_t context_create;
2844 csi_destroy_func_t context_destroy;
2845 csi_show_page_func_t show_page;
2846 csi_copy_page_func_t copy_page;
2847 csi_create_source_image_t create_source_image;
2850 /*cairo_public*/ cairo_script_interpreter_t* cairo_script_interpreter_create ();
2851 /*cairo_public*/ void cairo_script_interpreter_install_hooks (cairo_script_interpreter_t* ctx, const(cairo_script_interpreter_hooks_t)* hooks);
2852 /*cairo_public*/ cairo_status_t cairo_script_interpreter_run (cairo_script_interpreter_t* ctx, const(char)* filename);
2853 /*cairo_public*/ cairo_status_t cairo_script_interpreter_feed_stream (cairo_script_interpreter_t* ctx, FILE* stream);
2854 /*cairo_public*/ cairo_status_t cairo_script_interpreter_feed_string (cairo_script_interpreter_t* ctx, const(char)* line, int len);
2855 /*cairo_public*/ uint cairo_script_interpreter_get_line_number (cairo_script_interpreter_t* ctx);
2856 /*cairo_public*/ cairo_script_interpreter_t* cairo_script_interpreter_reference (cairo_script_interpreter_t* ctx);
2857 /*cairo_public*/ cairo_status_t cairo_script_interpreter_finish (cairo_script_interpreter_t* ctx);
2858 /*cairo_public*/ cairo_status_t cairo_script_interpreter_destroy (cairo_script_interpreter_t* ctx);
2859 /*cairo_public*/ cairo_status_t cairo_script_interpreter_translate_stream (FILE* stream, cairo_write_func_t write_func, void* closure);
2862 /* cairo - a vector graphics library with display and print output
2864 * cairo-svg.h
2866 * Copyright © 2005 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
2868 * This library is free software; you can redistribute it and/or
2869 * modify it either under the terms of the GNU Lesser General Public
2870 * License version 2.1 as published by the Free Software Foundation
2871 * (the "LGPL") or, at your option, under the terms of the Mozilla
2872 * Public License Version 1.1 (the "MPL"). If you do not alter this
2873 * notice, a recipient may use your version of this file under either
2874 * the MPL or the LGPL.
2876 * You should have received a copy of the LGPL along with this library
2877 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2878 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2879 * You should have received a copy of the MPL along with this library
2880 * in the file COPYING-MPL-1.1
2882 * The contents of this file are subject to the Mozilla Public License
2883 * Version 1.1 (the "License"); you may not use this file except in
2884 * compliance with the License. You may obtain a copy of the License at
2885 * http://www.mozilla.org/MPL/
2887 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2888 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2889 * the specific language governing rights and limitations.
2892 static if (CAIRO_HAS_SVG_SURFACE) {
2894 * cairo_svg_version_t:
2895 * @CAIRO_SVG_VERSION_1_1: The version 1.1 of the SVG specification. (Since 1.2)
2896 * @CAIRO_SVG_VERSION_1_2: The version 1.2 of the SVG specification. (Since 1.2)
2898 * #cairo_svg_version_t is used to describe the version number of the SVG
2899 * specification that a generated SVG file will conform to.
2901 * Since: 1.2
2903 alias cairo_svg_version_t = int;
2904 enum : cairo_svg_version_t {
2905 CAIRO_SVG_VERSION_1_1,
2906 CAIRO_SVG_VERSION_1_2
2909 /*cairo_public*/ cairo_surface_t* cairo_svg_surface_create (const(char)* filename, double width_in_points, double height_in_points);
2910 /*cairo_public*/ cairo_surface_t* cairo_svg_surface_create_for_stream (cairo_write_func_t write_func, void* closure, double width_in_points, double height_in_points);
2911 /*cairo_public*/ void cairo_svg_surface_restrict_to_version (cairo_surface_t* surface, cairo_svg_version_t version_);
2912 /*cairo_public*/ void cairo_svg_get_versions (const(cairo_svg_version_t)** versions, int* num_versions);
2913 /*cairo_public*/ const(char)* cairo_svg_version_to_string (cairo_svg_version_t version_);
2917 /* cairo - a vector graphics library with display and print output
2919 * Copyright © 2009 Chris Wilson
2921 * This library is free software; you can redistribute it and/or
2922 * modify it either under the terms of the GNU Lesser General Public
2923 * License version 2.1 as published by the Free Software Foundation
2924 * (the "LGPL") or, at your option, under the terms of the Mozilla
2925 * Public License Version 1.1 (the "MPL"). If you do not alter this
2926 * notice, a recipient may use your version of this file under either
2927 * the MPL or the LGPL.
2929 * You should have received a copy of the LGPL along with this library
2930 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2931 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2932 * You should have received a copy of the MPL along with this library
2933 * in the file COPYING-MPL-1.1
2935 * The contents of this file are subject to the Mozilla Public License
2936 * Version 1.1 (the "License"); you may not use this file except in
2937 * compliance with the License. You may obtain a copy of the License at
2938 * http://www.mozilla.org/MPL/
2940 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2941 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2942 * the specific language governing rights and limitations.
2944 * The Original Code is the cairo graphics library.
2946 * The Initial Developer of the Original Code is Chris Wilson
2948 * Contributor(s):
2949 * Chris Wilson <chris@chris-wilson.co.uk>
2951 static if (CAIRO_HAS_TEE_SURFACE) {
2952 /*cairo_public*/ cairo_surface_t* cairo_tee_surface_create (cairo_surface_t* master);
2953 /*cairo_public*/ void cairo_tee_surface_add (cairo_surface_t* surface, cairo_surface_t* target);
2954 /*cairo_public*/ void cairo_tee_surface_remove (cairo_surface_t* surface, cairo_surface_t* target);
2955 /*cairo_public*/ cairo_surface_t* cairo_tee_surface_index (cairo_surface_t* surface, uint index);
2959 /* cairo - a vector graphics library with display and print output
2961 * Copyright © 2009 Chris Wilson
2963 * This library is free software; you can redistribute it and/or
2964 * modify it either under the terms of the GNU Lesser General Public
2965 * License version 2.1 as published by the Free Software Foundation
2966 * (the "LGPL") or, at your option, under the terms of the Mozilla
2967 * Public License Version 1.1 (the "MPL"). If you do not alter this
2968 * notice, a recipient may use your version of this file under either
2969 * the MPL or the LGPL.
2971 * You should have received a copy of the LGPL along with this library
2972 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
2973 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
2974 * You should have received a copy of the MPL along with this library
2975 * in the file COPYING-MPL-1.1
2977 * The contents of this file are subject to the Mozilla Public License
2978 * Version 1.1 (the "License"); you may not use this file except in
2979 * compliance with the License. You may obtain a copy of the License at
2980 * http://www.mozilla.org/MPL/
2982 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
2983 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
2984 * the specific language governing rights and limitations.
2986 * The Original Code is the cairo graphics library.
2988 * The Initial Developer of the Original Code is Chris Wilson
2990 * Contributor(s):
2991 * Chris Wilson <chris@chris-wilson.co.uk>
2993 static if (CAIRO_HAS_XML_SURFACE) {
2994 /*cairo_public*/ cairo_device_t* cairo_xml_create (const(char)* filename);
2995 /*cairo_public*/ cairo_device_t* cairo_xml_create_for_stream (cairo_write_func_t write_func, void* closure);
2996 /*cairo_public*/ cairo_surface_t* cairo_xml_surface_create (cairo_device_t* xml, cairo_content_t content, double width, double height);
2997 /*cairo_public*/ cairo_status_t cairo_xml_for_recording_surface (cairo_device_t* xml, cairo_surface_t* surface);