Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:53:25

0001 /* cairo - a vector graphics library with display and print output
0002  *
0003  * Copyright © 2002 University of Southern California
0004  * Copyright © 2005 Red Hat, Inc.
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it either under the terms of the GNU Lesser General Public
0008  * License version 2.1 as published by the Free Software Foundation
0009  * (the "LGPL") or, at your option, under the terms of the Mozilla
0010  * Public License Version 1.1 (the "MPL"). If you do not alter this
0011  * notice, a recipient may use your version of this file under either
0012  * the MPL or the LGPL.
0013  *
0014  * You should have received a copy of the LGPL along with this library
0015  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
0017  * You should have received a copy of the MPL along with this library
0018  * in the file COPYING-MPL-1.1
0019  *
0020  * The contents of this file are subject to the Mozilla Public License
0021  * Version 1.1 (the "License"); you may not use this file except in
0022  * compliance with the License. You may obtain a copy of the License at
0023  * http://www.mozilla.org/MPL/
0024  *
0025  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
0026  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
0027  * the specific language governing rights and limitations.
0028  *
0029  * The Original Code is the cairo graphics library.
0030  *
0031  * The Initial Developer of the Original Code is University of Southern
0032  * California.
0033  *
0034  * Contributor(s):
0035  *  Carl D. Worth <cworth@cworth.org>
0036  */
0037 
0038 #ifndef CAIRO_H
0039 #define CAIRO_H
0040 
0041 #include "cairo-version.h"
0042 #include "cairo-features.h"
0043 #include "cairo-deprecated.h"
0044 
0045 #ifdef  __cplusplus
0046 # define CAIRO_BEGIN_DECLS  extern "C" {
0047 # define CAIRO_END_DECLS    }
0048 #else
0049 # define CAIRO_BEGIN_DECLS
0050 # define CAIRO_END_DECLS
0051 #endif
0052 
0053 #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(CAIRO_WIN32_STATIC_BUILD)
0054 # define _cairo_export __declspec(dllexport)
0055 # define _cairo_import __declspec(dllimport)
0056 #elif defined(__GNUC__) && (__GNUC__ >= 4)
0057 # define _cairo_export __attribute__((__visibility__("default")))
0058 # define _cairo_import
0059 #else
0060 # define _cairo_export
0061 # define _cairo_import
0062 #endif
0063 
0064 #ifdef CAIRO_COMPILATION
0065 # define _cairo_api _cairo_export
0066 #else
0067 # define _cairo_api _cairo_import
0068 #endif
0069 
0070 #define cairo_public _cairo_api extern
0071 
0072 CAIRO_BEGIN_DECLS
0073 
0074 #define CAIRO_VERSION_ENCODE(major, minor, micro) ( \
0075       ((major) * 10000)             \
0076     + ((minor) *   100)             \
0077     + ((micro) *     1))
0078 
0079 #define CAIRO_VERSION CAIRO_VERSION_ENCODE( \
0080     CAIRO_VERSION_MAJOR,            \
0081     CAIRO_VERSION_MINOR,            \
0082     CAIRO_VERSION_MICRO)
0083 
0084 
0085 #define CAIRO_VERSION_STRINGIZE_(major, minor, micro)   \
0086     #major"."#minor"."#micro
0087 #define CAIRO_VERSION_STRINGIZE(major, minor, micro)    \
0088     CAIRO_VERSION_STRINGIZE_(major, minor, micro)
0089 
0090 #define CAIRO_VERSION_STRING CAIRO_VERSION_STRINGIZE(   \
0091     CAIRO_VERSION_MAJOR,                \
0092     CAIRO_VERSION_MINOR,                \
0093     CAIRO_VERSION_MICRO)
0094 
0095 
0096 cairo_public int
0097 cairo_version (void);
0098 
0099 cairo_public const char*
0100 cairo_version_string (void);
0101 
0102 /**
0103  * cairo_bool_t:
0104  *
0105  * #cairo_bool_t is used for boolean values. Returns of type
0106  * #cairo_bool_t will always be either 0 or 1, but testing against
0107  * these values explicitly is not encouraged; just use the
0108  * value as a boolean condition.
0109  *
0110  * <informalexample><programlisting>
0111  *  if (cairo_in_stroke (cr, x, y)) {
0112  *      /<!-- -->* do something *<!-- -->/
0113  *  }
0114  * </programlisting></informalexample>
0115  *
0116  * Since: 1.0
0117  **/
0118 typedef int cairo_bool_t;
0119 
0120 /**
0121  * cairo_t:
0122  *
0123  * A #cairo_t contains the current state of the rendering device,
0124  * including coordinates of yet to be drawn shapes.
0125  *
0126  * Cairo contexts, as #cairo_t objects are named, are central to
0127  * cairo and all drawing with cairo is always done to a #cairo_t
0128  * object.
0129  *
0130  * Memory management of #cairo_t is done with
0131  * cairo_reference() and cairo_destroy().
0132  *
0133  * Since: 1.0
0134  **/
0135 typedef struct _cairo cairo_t;
0136 
0137 /**
0138  * cairo_surface_t:
0139  *
0140  * A #cairo_surface_t represents an image, either as the destination
0141  * of a drawing operation or as source when drawing onto another
0142  * surface.  To draw to a #cairo_surface_t, create a cairo context
0143  * with the surface as the target, using cairo_create().
0144  *
0145  * There are different subtypes of #cairo_surface_t for
0146  * different drawing backends; for example, cairo_image_surface_create()
0147  * creates a bitmap image in memory.
0148  * The type of a surface can be queried with cairo_surface_get_type().
0149  *
0150  * The initial contents of a surface after creation depend upon the manner
0151  * of its creation. If cairo creates the surface and backing storage for
0152  * the user, it will be initially cleared; for example,
0153  * cairo_image_surface_create() and cairo_surface_create_similar().
0154  * Alternatively, if the user passes in a reference to some backing storage
0155  * and asks cairo to wrap that in a #cairo_surface_t, then the contents are
0156  * not modified; for example, cairo_image_surface_create_for_data() and
0157  * cairo_xlib_surface_create().
0158  *
0159  * Memory management of #cairo_surface_t is done with
0160  * cairo_surface_reference() and cairo_surface_destroy().
0161  *
0162  * Since: 1.0
0163  **/
0164 typedef struct _cairo_surface cairo_surface_t;
0165 
0166 /**
0167  * cairo_device_t:
0168  *
0169  * A #cairo_device_t represents the driver interface for drawing
0170  * operations to a #cairo_surface_t.  There are different subtypes of
0171  * #cairo_device_t for different drawing backends.
0172  *
0173  * The type of a device can be queried with cairo_device_get_type().
0174  *
0175  * Memory management of #cairo_device_t is done with
0176  * cairo_device_reference() and cairo_device_destroy().
0177  *
0178  * Since: 1.10
0179  **/
0180 typedef struct _cairo_device cairo_device_t;
0181 
0182 /**
0183  * cairo_matrix_t:
0184  * @xx: xx component of the affine transformation
0185  * @yx: yx component of the affine transformation
0186  * @xy: xy component of the affine transformation
0187  * @yy: yy component of the affine transformation
0188  * @x0: X translation component of the affine transformation
0189  * @y0: Y translation component of the affine transformation
0190  *
0191  * A #cairo_matrix_t holds an affine transformation, such as a scale,
0192  * rotation, shear, or a combination of those. The transformation of
0193  * a point (x, y) is given by:
0194  * <programlisting>
0195  *     x_new = xx * x + xy * y + x0;
0196  *     y_new = yx * x + yy * y + y0;
0197  * </programlisting>
0198  *
0199  * Since: 1.0
0200  **/
0201 typedef struct _cairo_matrix {
0202     double xx; double yx;
0203     double xy; double yy;
0204     double x0; double y0;
0205 } cairo_matrix_t;
0206 
0207 /**
0208  * cairo_pattern_t:
0209  *
0210  * A #cairo_pattern_t represents a source when drawing onto a
0211  * surface. There are different subtypes of #cairo_pattern_t,
0212  * for different types of sources; for example,
0213  * cairo_pattern_create_rgb() creates a pattern for a solid
0214  * opaque color.
0215  *
0216  * Other than various
0217  * <function>cairo_pattern_create_<emphasis>type</emphasis>()</function>
0218  * functions, some of the pattern types can be implicitly created using various
0219  * <function>cairo_set_source_<emphasis>type</emphasis>()</function> functions;
0220  * for example cairo_set_source_rgb().
0221  *
0222  * The type of a pattern can be queried with cairo_pattern_get_type().
0223  *
0224  * Memory management of #cairo_pattern_t is done with
0225  * cairo_pattern_reference() and cairo_pattern_destroy().
0226  *
0227  * Since: 1.0
0228  **/
0229 typedef struct _cairo_pattern cairo_pattern_t;
0230 
0231 /**
0232  * cairo_destroy_func_t:
0233  * @data: The data element being destroyed.
0234  *
0235  * #cairo_destroy_func_t the type of function which is called when a
0236  * data element is destroyed. It is passed the pointer to the data
0237  * element and should free any memory and resources allocated for it.
0238  *
0239  * Since: 1.0
0240  **/
0241 typedef void (*cairo_destroy_func_t) (void *data);
0242 
0243 /**
0244  * cairo_user_data_key_t:
0245  * @unused: not used; ignore.
0246  *
0247  * #cairo_user_data_key_t is used for attaching user data to cairo
0248  * data structures.  The actual contents of the struct is never used,
0249  * and there is no need to initialize the object; only the unique
0250  * address of a #cairo_data_key_t object is used.  Typically, you
0251  * would just use the address of a static #cairo_data_key_t object.
0252  *
0253  * Since: 1.0
0254  **/
0255 typedef struct _cairo_user_data_key {
0256     int unused;
0257 } cairo_user_data_key_t;
0258 
0259 /**
0260  * cairo_status_t:
0261  * @CAIRO_STATUS_SUCCESS: no error has occurred (Since 1.0)
0262  * @CAIRO_STATUS_NO_MEMORY: out of memory (Since 1.0)
0263  * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save() (Since 1.0)
0264  * @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop, i.e. cairo_pop_group() without matching cairo_push_group() (Since 1.0)
0265  * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined (Since 1.0)
0266  * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible) (Since 1.0)
0267  * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input #cairo_status_t (Since 1.0)
0268  * @CAIRO_STATUS_NULL_POINTER: %NULL pointer (Since 1.0)
0269  * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8 (Since 1.0)
0270  * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid (Since 1.0)
0271  * @CAIRO_STATUS_READ_ERROR: error while reading from input stream (Since 1.0)
0272  * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream (Since 1.0)
0273  * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished (Since 1.0)
0274  * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation (Since 1.0)
0275  * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation (Since 1.0)
0276  * @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input #cairo_content_t (Since 1.0)
0277  * @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input #cairo_format_t (Since 1.0)
0278  * @CAIRO_STATUS_INVALID_VISUAL: invalid value for an input Visual* (Since 1.0)
0279  * @CAIRO_STATUS_FILE_NOT_FOUND: file not found (Since 1.0)
0280  * @CAIRO_STATUS_INVALID_DASH: invalid value for a dash setting (Since 1.0)
0281  * @CAIRO_STATUS_INVALID_DSC_COMMENT: invalid value for a DSC comment (Since 1.2)
0282  * @CAIRO_STATUS_INVALID_INDEX: invalid index passed to getter (Since 1.4)
0283  * @CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: clip region not representable in desired format (Since 1.4)
0284  * @CAIRO_STATUS_TEMP_FILE_ERROR: error creating or writing to a temporary file (Since 1.6)
0285  * @CAIRO_STATUS_INVALID_STRIDE: invalid value for stride (Since 1.6)
0286  * @CAIRO_STATUS_FONT_TYPE_MISMATCH: the font type is not appropriate for the operation (Since 1.8)
0287  * @CAIRO_STATUS_USER_FONT_IMMUTABLE: the user-font is immutable (Since 1.8)
0288  * @CAIRO_STATUS_USER_FONT_ERROR: error occurred in a user-font callback function (Since 1.8)
0289  * @CAIRO_STATUS_NEGATIVE_COUNT: negative number used where it is not allowed (Since 1.8)
0290  * @CAIRO_STATUS_INVALID_CLUSTERS: input clusters do not represent the accompanying text and glyph array (Since 1.8)
0291  * @CAIRO_STATUS_INVALID_SLANT: invalid value for an input #cairo_font_slant_t (Since 1.8)
0292  * @CAIRO_STATUS_INVALID_WEIGHT: invalid value for an input #cairo_font_weight_t (Since 1.8)
0293  * @CAIRO_STATUS_INVALID_SIZE: invalid value (typically too big) for the size of the input (surface, pattern, etc.) (Since 1.10)
0294  * @CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED: user-font method not implemented (Since 1.10)
0295  * @CAIRO_STATUS_DEVICE_TYPE_MISMATCH: the device type is not appropriate for the operation (Since 1.10)
0296  * @CAIRO_STATUS_DEVICE_ERROR: an operation to the device caused an unspecified error (Since 1.10)
0297  * @CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: a mesh pattern
0298  *   construction operation was used outside of a
0299  *   cairo_mesh_pattern_begin_patch()/cairo_mesh_pattern_end_patch()
0300  *   pair (Since 1.12)
0301  * @CAIRO_STATUS_DEVICE_FINISHED: target device has been finished (Since 1.12)
0302  * @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
0303  *   but no image provided %CAIRO_MIME_TYPE_JBIG2_GLOBAL (Since 1.14)
0304  * @CAIRO_STATUS_PNG_ERROR: error occurred in libpng while reading from or writing to a PNG file (Since 1.16)
0305  * @CAIRO_STATUS_FREETYPE_ERROR: error occurred in libfreetype (Since 1.16)
0306  * @CAIRO_STATUS_WIN32_GDI_ERROR: error occurred in the Windows Graphics Device Interface (Since 1.16)
0307  * @CAIRO_STATUS_TAG_ERROR: invalid tag name, attributes, or nesting (Since 1.16)
0308  * @CAIRO_STATUS_DWRITE_ERROR: error occurred in the Windows Direct Write API (Since 1.18)
0309  * @CAIRO_STATUS_SVG_FONT_ERROR: error occurred in OpenType-SVG font rendering (Since 1.18)
0310  * @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
0311  *   status values defined in this enumeration.  When using this value, note
0312  *   that the version of cairo at run-time may have additional status values
0313  *   defined than the value of this symbol at compile-time. (Since 1.10)
0314  *
0315  * #cairo_status_t is used to indicate errors that can occur when
0316  * using Cairo. In some cases it is returned directly by functions.
0317  * but when using #cairo_t, the last error, if any, is stored in
0318  * the context and can be retrieved with cairo_status().
0319  *
0320  * New entries may be added in future versions.  Use cairo_status_to_string()
0321  * to get a human-readable representation of an error message.
0322  *
0323  * Since: 1.0
0324  **/
0325 typedef enum _cairo_status {
0326     CAIRO_STATUS_SUCCESS = 0,
0327 
0328     CAIRO_STATUS_NO_MEMORY,
0329     CAIRO_STATUS_INVALID_RESTORE,
0330     CAIRO_STATUS_INVALID_POP_GROUP,
0331     CAIRO_STATUS_NO_CURRENT_POINT,
0332     CAIRO_STATUS_INVALID_MATRIX,
0333     CAIRO_STATUS_INVALID_STATUS,
0334     CAIRO_STATUS_NULL_POINTER,
0335     CAIRO_STATUS_INVALID_STRING,
0336     CAIRO_STATUS_INVALID_PATH_DATA,
0337     CAIRO_STATUS_READ_ERROR,
0338     CAIRO_STATUS_WRITE_ERROR,
0339     CAIRO_STATUS_SURFACE_FINISHED,
0340     CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
0341     CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
0342     CAIRO_STATUS_INVALID_CONTENT,
0343     CAIRO_STATUS_INVALID_FORMAT,
0344     CAIRO_STATUS_INVALID_VISUAL,
0345     CAIRO_STATUS_FILE_NOT_FOUND,
0346     CAIRO_STATUS_INVALID_DASH,
0347     CAIRO_STATUS_INVALID_DSC_COMMENT,
0348     CAIRO_STATUS_INVALID_INDEX,
0349     CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
0350     CAIRO_STATUS_TEMP_FILE_ERROR,
0351     CAIRO_STATUS_INVALID_STRIDE,
0352     CAIRO_STATUS_FONT_TYPE_MISMATCH,
0353     CAIRO_STATUS_USER_FONT_IMMUTABLE,
0354     CAIRO_STATUS_USER_FONT_ERROR,
0355     CAIRO_STATUS_NEGATIVE_COUNT,
0356     CAIRO_STATUS_INVALID_CLUSTERS,
0357     CAIRO_STATUS_INVALID_SLANT,
0358     CAIRO_STATUS_INVALID_WEIGHT,
0359     CAIRO_STATUS_INVALID_SIZE,
0360     CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
0361     CAIRO_STATUS_DEVICE_TYPE_MISMATCH,
0362     CAIRO_STATUS_DEVICE_ERROR,
0363     CAIRO_STATUS_INVALID_MESH_CONSTRUCTION,
0364     CAIRO_STATUS_DEVICE_FINISHED,
0365     CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
0366     CAIRO_STATUS_PNG_ERROR,
0367     CAIRO_STATUS_FREETYPE_ERROR,
0368     CAIRO_STATUS_WIN32_GDI_ERROR,
0369     CAIRO_STATUS_TAG_ERROR,
0370     CAIRO_STATUS_DWRITE_ERROR,
0371     CAIRO_STATUS_SVG_FONT_ERROR,
0372 
0373     CAIRO_STATUS_LAST_STATUS
0374 } cairo_status_t;
0375 
0376 /**
0377  * cairo_content_t:
0378  * @CAIRO_CONTENT_COLOR: The surface will hold color content only. (Since 1.0)
0379  * @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only. (Since 1.0)
0380  * @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content. (Since 1.0)
0381  *
0382  * #cairo_content_t is used to describe the content that a surface will
0383  * contain, whether color information, alpha information (translucence
0384  * vs. opacity), or both.
0385  *
0386  * Note: The large values here are designed to keep #cairo_content_t
0387  * values distinct from #cairo_format_t values so that the
0388  * implementation can detect the error if users confuse the two types.
0389  *
0390  * Since: 1.0
0391  **/
0392 typedef enum _cairo_content {
0393     CAIRO_CONTENT_COLOR     = 0x1000,
0394     CAIRO_CONTENT_ALPHA     = 0x2000,
0395     CAIRO_CONTENT_COLOR_ALPHA   = 0x3000
0396 } cairo_content_t;
0397 
0398 /**
0399  * cairo_format_t:
0400  * @CAIRO_FORMAT_INVALID: no such format exists or is supported.
0401  * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
0402  *   alpha in the upper 8 bits, then red, then green, then blue.
0403  *   The 32-bit quantities are stored native-endian. Pre-multiplied
0404  *   alpha is used. (That is, 50% transparent red is 0x80800000,
0405  *   not 0x80ff0000.) (Since 1.0)
0406  * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
0407  *   the upper 8 bits unused. Red, Green, and Blue are stored
0408  *   in the remaining 24 bits in that order. (Since 1.0)
0409  * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
0410  *   an alpha value. (Since 1.0)
0411  * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
0412  *   an alpha value. Pixels are packed together into 32-bit
0413  *   quantities. The ordering of the bits matches the
0414  *   endianness of the platform. On a big-endian machine, the
0415  *   first pixel is in the uppermost bit, on a little-endian
0416  *   machine the first pixel is in the least-significant bit. (Since 1.0)
0417  * @CAIRO_FORMAT_RGB16_565: each pixel is a 16-bit quantity
0418  *   with red in the upper 5 bits, then green in the middle
0419  *   6 bits, and blue in the lower 5 bits. (Since 1.2)
0420  * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12)
0421  * @CAIRO_FORMAT_RGB96F: 3 floats, R, G, B. (Since 1.17.2)
0422  * @CAIRO_FORMAT_RGBA128F: 4 floats, R, G, B, A. (Since 1.17.2)
0423  *
0424  * #cairo_format_t is used to identify the memory format of
0425  * image data.
0426  *
0427  * New entries may be added in future versions.
0428  *
0429  * Since: 1.0
0430  **/
0431 typedef enum _cairo_format {
0432     CAIRO_FORMAT_INVALID   = -1,
0433     CAIRO_FORMAT_ARGB32    = 0,
0434     CAIRO_FORMAT_RGB24     = 1,
0435     CAIRO_FORMAT_A8        = 2,
0436     CAIRO_FORMAT_A1        = 3,
0437     CAIRO_FORMAT_RGB16_565 = 4,
0438     CAIRO_FORMAT_RGB30     = 5,
0439     CAIRO_FORMAT_RGB96F    = 6,
0440     CAIRO_FORMAT_RGBA128F  = 7
0441 } cairo_format_t;
0442 
0443 /**
0444  * cairo_dither_t:
0445  * @CAIRO_DITHER_NONE: No dithering.
0446  * @CAIRO_DITHER_DEFAULT: Default choice at cairo compile time. Currently NONE.
0447  * @CAIRO_DITHER_FAST: Fastest dithering algorithm supported by the backend
0448  * @CAIRO_DITHER_GOOD: An algorithm with smoother dithering than FAST
0449  * @CAIRO_DITHER_BEST: Best algorithm available in the backend
0450  *
0451  * Dither is an intentionally applied form of noise used to randomize
0452  * quantization error, preventing large-scale patterns such as color banding
0453  * in images (e.g. for gradients). Ordered dithering applies a precomputed
0454  * threshold matrix to spread the errors smoothly.
0455  *
0456  *  #cairo_dither_t is modeled on pixman dithering algorithm choice.
0457  * As of Pixman 0.40, FAST corresponds to a 8x8 ordered bayer noise and GOOD
0458  * and BEST use an ordered 64x64 precomputed blue noise.
0459  *
0460  * Since: 1.18
0461  **/
0462 typedef enum _cairo_dither {
0463     CAIRO_DITHER_NONE,
0464     CAIRO_DITHER_DEFAULT,
0465     CAIRO_DITHER_FAST,
0466     CAIRO_DITHER_GOOD,
0467     CAIRO_DITHER_BEST
0468 } cairo_dither_t;
0469 
0470 cairo_public void
0471 cairo_pattern_set_dither (cairo_pattern_t *pattern, cairo_dither_t dither);
0472 
0473 cairo_public cairo_dither_t
0474 cairo_pattern_get_dither (cairo_pattern_t *pattern);
0475 
0476 /**
0477  * cairo_write_func_t:
0478  * @closure: the output closure
0479  * @data: the buffer containing the data to write
0480  * @length: the amount of data to write
0481  *
0482  * #cairo_write_func_t is the type of function which is called when a
0483  * backend needs to write data to an output stream.  It is passed the
0484  * closure which was specified by the user at the time the write
0485  * function was registered, the data to write and the length of the
0486  * data in bytes.  The write function should return
0487  * %CAIRO_STATUS_SUCCESS if all the data was successfully written,
0488  * %CAIRO_STATUS_WRITE_ERROR otherwise.
0489  *
0490  * Returns: the status code of the write operation
0491  *
0492  * Since: 1.0
0493  **/
0494 typedef cairo_status_t (*cairo_write_func_t) (void        *closure,
0495                           const unsigned char *data,
0496                           unsigned int     length);
0497 
0498 /**
0499  * cairo_read_func_t:
0500  * @closure: the input closure
0501  * @data: the buffer into which to read the data
0502  * @length: the amount of data to read
0503  *
0504  * #cairo_read_func_t is the type of function which is called when a
0505  * backend needs to read data from an input stream.  It is passed the
0506  * closure which was specified by the user at the time the read
0507  * function was registered, the buffer to read the data into and the
0508  * length of the data in bytes.  The read function should return
0509  * %CAIRO_STATUS_SUCCESS if all the data was successfully read,
0510  * %CAIRO_STATUS_READ_ERROR otherwise.
0511  *
0512  * Returns: the status code of the read operation
0513  *
0514  * Since: 1.0
0515  **/
0516 typedef cairo_status_t (*cairo_read_func_t) (void       *closure,
0517                          unsigned char  *data,
0518                          unsigned int   length);
0519 
0520 /**
0521  * cairo_rectangle_int_t:
0522  * @x: X coordinate of the left side of the rectangle
0523  * @y: Y coordinate of the top side of the rectangle
0524  * @width: width of the rectangle
0525  * @height: height of the rectangle
0526  *
0527  * A data structure for holding a rectangle with integer coordinates.
0528  *
0529  * Since: 1.10
0530  **/
0531 
0532 typedef struct _cairo_rectangle_int {
0533     int x, y;
0534     int width, height;
0535 } cairo_rectangle_int_t;
0536 
0537 
0538 /* Functions for manipulating state objects */
0539 cairo_public cairo_t *
0540 cairo_create (cairo_surface_t *target);
0541 
0542 cairo_public cairo_t *
0543 cairo_reference (cairo_t *cr);
0544 
0545 cairo_public void
0546 cairo_destroy (cairo_t *cr);
0547 
0548 cairo_public unsigned int
0549 cairo_get_reference_count (cairo_t *cr);
0550 
0551 cairo_public void *
0552 cairo_get_user_data (cairo_t             *cr,
0553              const cairo_user_data_key_t *key);
0554 
0555 cairo_public cairo_status_t
0556 cairo_set_user_data (cairo_t             *cr,
0557              const cairo_user_data_key_t *key,
0558              void            *user_data,
0559              cairo_destroy_func_t     destroy);
0560 
0561 cairo_public void
0562 cairo_save (cairo_t *cr);
0563 
0564 cairo_public void
0565 cairo_restore (cairo_t *cr);
0566 
0567 cairo_public void
0568 cairo_push_group (cairo_t *cr);
0569 
0570 cairo_public void
0571 cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
0572 
0573 cairo_public cairo_pattern_t *
0574 cairo_pop_group (cairo_t *cr);
0575 
0576 cairo_public void
0577 cairo_pop_group_to_source (cairo_t *cr);
0578 
0579 /* Modify state */
0580 
0581 /**
0582  * cairo_operator_t:
0583  * @CAIRO_OPERATOR_CLEAR: clear destination layer (bounded) (Since 1.0)
0584  * @CAIRO_OPERATOR_SOURCE: replace destination layer (bounded) (Since 1.0)
0585  * @CAIRO_OPERATOR_OVER: draw source layer on top of destination layer
0586  * (bounded) (Since 1.0)
0587  * @CAIRO_OPERATOR_IN: draw source where there was destination content
0588  * (unbounded) (Since 1.0)
0589  * @CAIRO_OPERATOR_OUT: draw source where there was no destination
0590  * content (unbounded) (Since 1.0)
0591  * @CAIRO_OPERATOR_ATOP: draw source on top of destination content and
0592  * only there (Since 1.0)
0593  * @CAIRO_OPERATOR_DEST: ignore the source (Since 1.0)
0594  * @CAIRO_OPERATOR_DEST_OVER: draw destination on top of source (Since 1.0)
0595  * @CAIRO_OPERATOR_DEST_IN: leave destination only where there was
0596  * source content (unbounded) (Since 1.0)
0597  * @CAIRO_OPERATOR_DEST_OUT: leave destination only where there was no
0598  * source content (Since 1.0)
0599  * @CAIRO_OPERATOR_DEST_ATOP: leave destination on top of source content
0600  * and only there (unbounded) (Since 1.0)
0601  * @CAIRO_OPERATOR_XOR: source and destination are shown where there is only
0602  * one of them (Since 1.0)
0603  * @CAIRO_OPERATOR_ADD: source and destination layers are accumulated (Since 1.0)
0604  * @CAIRO_OPERATOR_SATURATE: like over, but assuming source and dest are
0605  * disjoint geometries (Since 1.0)
0606  * @CAIRO_OPERATOR_MULTIPLY: source and destination layers are multiplied.
0607  * This causes the result to be at least as dark as the darker inputs. (Since 1.10)
0608  * @CAIRO_OPERATOR_SCREEN: source and destination are complemented and
0609  * multiplied. This causes the result to be at least as light as the lighter
0610  * inputs. (Since 1.10)
0611  * @CAIRO_OPERATOR_OVERLAY: multiplies or screens, depending on the
0612  * lightness of the destination color. (Since 1.10)
0613  * @CAIRO_OPERATOR_DARKEN: replaces the destination with the source if it
0614  * is darker, otherwise keeps the source. (Since 1.10)
0615  * @CAIRO_OPERATOR_LIGHTEN: replaces the destination with the source if it
0616  * is lighter, otherwise keeps the source. (Since 1.10)
0617  * @CAIRO_OPERATOR_COLOR_DODGE: brightens the destination color to reflect
0618  * the source color. (Since 1.10)
0619  * @CAIRO_OPERATOR_COLOR_BURN: darkens the destination color to reflect
0620  * the source color. (Since 1.10)
0621  * @CAIRO_OPERATOR_HARD_LIGHT: Multiplies or screens, dependent on source
0622  * color. (Since 1.10)
0623  * @CAIRO_OPERATOR_SOFT_LIGHT: Darkens or lightens, dependent on source
0624  * color. (Since 1.10)
0625  * @CAIRO_OPERATOR_DIFFERENCE: Takes the difference of the source and
0626  * destination color. (Since 1.10)
0627  * @CAIRO_OPERATOR_EXCLUSION: Produces an effect similar to difference, but
0628  * with lower contrast. (Since 1.10)
0629  * @CAIRO_OPERATOR_HSL_HUE: Creates a color with the hue of the source
0630  * and the saturation and luminosity of the target. (Since 1.10)
0631  * @CAIRO_OPERATOR_HSL_SATURATION: Creates a color with the saturation
0632  * of the source and the hue and luminosity of the target. Painting with
0633  * this mode onto a gray area produces no change. (Since 1.10)
0634  * @CAIRO_OPERATOR_HSL_COLOR: Creates a color with the hue and saturation
0635  * of the source and the luminosity of the target. This preserves the gray
0636  * levels of the target and is useful for coloring monochrome images or
0637  * tinting color images. (Since 1.10)
0638  * @CAIRO_OPERATOR_HSL_LUMINOSITY: Creates a color with the luminosity of
0639  * the source and the hue and saturation of the target. This produces an
0640  * inverse effect to @CAIRO_OPERATOR_HSL_COLOR. (Since 1.10)
0641  *
0642  * #cairo_operator_t is used to set the compositing operator for all cairo
0643  * drawing operations.
0644  *
0645  * The default operator is %CAIRO_OPERATOR_OVER.
0646  *
0647  * The operators marked as <firstterm>unbounded</firstterm> modify their
0648  * destination even outside of the mask layer (that is, their effect is not
0649  * bound by the mask layer).  However, their effect can still be limited by
0650  * way of clipping.
0651  *
0652  * To keep things simple, the operator descriptions here
0653  * document the behavior for when both source and destination are either fully
0654  * transparent or fully opaque.  The actual implementation works for
0655  * translucent layers too.
0656  * For a more detailed explanation of the effects of each operator, including
0657  * the mathematical definitions, see
0658  * <ulink url="https://cairographics.org/operators/">https://cairographics.org/operators/</ulink>.
0659  *
0660  * Since: 1.0
0661  **/
0662 typedef enum _cairo_operator {
0663     CAIRO_OPERATOR_CLEAR,
0664 
0665     CAIRO_OPERATOR_SOURCE,
0666     CAIRO_OPERATOR_OVER,
0667     CAIRO_OPERATOR_IN,
0668     CAIRO_OPERATOR_OUT,
0669     CAIRO_OPERATOR_ATOP,
0670 
0671     CAIRO_OPERATOR_DEST,
0672     CAIRO_OPERATOR_DEST_OVER,
0673     CAIRO_OPERATOR_DEST_IN,
0674     CAIRO_OPERATOR_DEST_OUT,
0675     CAIRO_OPERATOR_DEST_ATOP,
0676 
0677     CAIRO_OPERATOR_XOR,
0678     CAIRO_OPERATOR_ADD,
0679     CAIRO_OPERATOR_SATURATE,
0680 
0681     CAIRO_OPERATOR_MULTIPLY,
0682     CAIRO_OPERATOR_SCREEN,
0683     CAIRO_OPERATOR_OVERLAY,
0684     CAIRO_OPERATOR_DARKEN,
0685     CAIRO_OPERATOR_LIGHTEN,
0686     CAIRO_OPERATOR_COLOR_DODGE,
0687     CAIRO_OPERATOR_COLOR_BURN,
0688     CAIRO_OPERATOR_HARD_LIGHT,
0689     CAIRO_OPERATOR_SOFT_LIGHT,
0690     CAIRO_OPERATOR_DIFFERENCE,
0691     CAIRO_OPERATOR_EXCLUSION,
0692     CAIRO_OPERATOR_HSL_HUE,
0693     CAIRO_OPERATOR_HSL_SATURATION,
0694     CAIRO_OPERATOR_HSL_COLOR,
0695     CAIRO_OPERATOR_HSL_LUMINOSITY
0696 } cairo_operator_t;
0697 
0698 cairo_public void
0699 cairo_set_operator (cairo_t *cr, cairo_operator_t op);
0700 
0701 cairo_public void
0702 cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
0703 
0704 cairo_public void
0705 cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
0706 
0707 cairo_public void
0708 cairo_set_source_rgba (cairo_t *cr,
0709                double red, double green, double blue,
0710                double alpha);
0711 
0712 cairo_public void
0713 cairo_set_source_surface (cairo_t     *cr,
0714               cairo_surface_t *surface,
0715               double       x,
0716               double       y);
0717 
0718 cairo_public void
0719 cairo_set_tolerance (cairo_t *cr, double tolerance);
0720 
0721 /**
0722  * cairo_antialias_t:
0723  * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for
0724  *   the subsystem and target device, since 1.0
0725  * @CAIRO_ANTIALIAS_NONE: Use a bilevel alpha mask, since 1.0
0726  * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using
0727  *  shades of gray for black text on a white background, for example), since 1.0
0728  * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking
0729  *  advantage of the order of subpixel elements on devices
0730  *  such as LCD panels, since 1.0
0731  * @CAIRO_ANTIALIAS_FAST: Hint that the backend should perform some
0732  * antialiasing but prefer speed over quality, since 1.12
0733  * @CAIRO_ANTIALIAS_GOOD: The backend should balance quality against
0734  * performance, since 1.12
0735  * @CAIRO_ANTIALIAS_BEST: Hint that the backend should render at the highest
0736  * quality, sacrificing speed if necessary, since 1.12
0737  *
0738  * Specifies the type of antialiasing to do when rendering text or shapes.
0739  *
0740  * As it is not necessarily clear from the above what advantages a particular
0741  * antialias method provides, since 1.12, there is also a set of hints:
0742  * @CAIRO_ANTIALIAS_FAST: Allow the backend to degrade raster quality for speed
0743  * @CAIRO_ANTIALIAS_GOOD: A balance between speed and quality
0744  * @CAIRO_ANTIALIAS_BEST: A high-fidelity, but potentially slow, raster mode
0745  *
0746  * These make no guarantee on how the backend will perform its rasterisation
0747  * (if it even rasterises!), nor that they have any differing effect other
0748  * than to enable some form of antialiasing. In the case of glyph rendering,
0749  * @CAIRO_ANTIALIAS_FAST and @CAIRO_ANTIALIAS_GOOD will be mapped to
0750  * @CAIRO_ANTIALIAS_GRAY, with @CAIRO_ANTALIAS_BEST being equivalent to
0751  * @CAIRO_ANTIALIAS_SUBPIXEL.
0752  *
0753  * The interpretation of @CAIRO_ANTIALIAS_DEFAULT is left entirely up to
0754  * the backend, typically this will be similar to @CAIRO_ANTIALIAS_GOOD.
0755  *
0756  * Since: 1.0
0757  **/
0758 typedef enum _cairo_antialias {
0759     CAIRO_ANTIALIAS_DEFAULT,
0760 
0761     /* method */
0762     CAIRO_ANTIALIAS_NONE,
0763     CAIRO_ANTIALIAS_GRAY,
0764     CAIRO_ANTIALIAS_SUBPIXEL,
0765 
0766     /* hints */
0767     CAIRO_ANTIALIAS_FAST,
0768     CAIRO_ANTIALIAS_GOOD,
0769     CAIRO_ANTIALIAS_BEST
0770 } cairo_antialias_t;
0771 
0772 cairo_public void
0773 cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
0774 
0775 /**
0776  * cairo_fill_rule_t:
0777  * @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
0778  * left-to-right, counts +1. If the path crosses the ray
0779  * from right to left, counts -1. (Left and right are determined
0780  * from the perspective of looking along the ray from the starting
0781  * point.) If the total count is non-zero, the point will be filled. (Since 1.0)
0782  * @CAIRO_FILL_RULE_EVEN_ODD: Counts the total number of
0783  * intersections, without regard to the orientation of the contour. If
0784  * the total number of intersections is odd, the point will be
0785  * filled. (Since 1.0)
0786  *
0787  * #cairo_fill_rule_t is used to select how paths are filled. For both
0788  * fill rules, whether or not a point is included in the fill is
0789  * determined by taking a ray from that point to infinity and looking
0790  * at intersections with the path. The ray can be in any direction,
0791  * as long as it doesn't pass through the end point of a segment
0792  * or have a tricky intersection such as intersecting tangent to the path.
0793  * (Note that filling is not actually implemented in this way. This
0794  * is just a description of the rule that is applied.)
0795  *
0796  * The default fill rule is %CAIRO_FILL_RULE_WINDING.
0797  *
0798  * New entries may be added in future versions.
0799  *
0800  * Since: 1.0
0801  **/
0802 typedef enum _cairo_fill_rule {
0803     CAIRO_FILL_RULE_WINDING,
0804     CAIRO_FILL_RULE_EVEN_ODD
0805 } cairo_fill_rule_t;
0806 
0807 cairo_public void
0808 cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
0809 
0810 cairo_public void
0811 cairo_set_line_width (cairo_t *cr, double width);
0812 
0813 cairo_public void
0814 cairo_set_hairline (cairo_t *cr, cairo_bool_t set_hairline);
0815 
0816 /**
0817  * cairo_line_cap_t:
0818  * @CAIRO_LINE_CAP_BUTT: start(stop) the line exactly at the start(end) point (Since 1.0)
0819  * @CAIRO_LINE_CAP_ROUND: use a round ending, the center of the circle is the end point (Since 1.0)
0820  * @CAIRO_LINE_CAP_SQUARE: use squared ending, the center of the square is the end point (Since 1.0)
0821  *
0822  * Specifies how to render the endpoints of the path when stroking.
0823  *
0824  * The default line cap style is %CAIRO_LINE_CAP_BUTT.
0825  *
0826  * Since: 1.0
0827  **/
0828 typedef enum _cairo_line_cap {
0829     CAIRO_LINE_CAP_BUTT,
0830     CAIRO_LINE_CAP_ROUND,
0831     CAIRO_LINE_CAP_SQUARE
0832 } cairo_line_cap_t;
0833 
0834 cairo_public void
0835 cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
0836 
0837 /**
0838  * cairo_line_join_t:
0839  * @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
0840  * cairo_set_miter_limit() (Since 1.0)
0841  * @CAIRO_LINE_JOIN_ROUND: use a rounded join, the center of the circle is the
0842  * joint point (Since 1.0)
0843  * @CAIRO_LINE_JOIN_BEVEL: use a cut-off join, the join is cut off at half
0844  * the line width from the joint point (Since 1.0)
0845  *
0846  * Specifies how to render the junction of two lines when stroking.
0847  *
0848  * The default line join style is %CAIRO_LINE_JOIN_MITER.
0849  *
0850  * Since: 1.0
0851  **/
0852 typedef enum _cairo_line_join {
0853     CAIRO_LINE_JOIN_MITER,
0854     CAIRO_LINE_JOIN_ROUND,
0855     CAIRO_LINE_JOIN_BEVEL
0856 } cairo_line_join_t;
0857 
0858 cairo_public void
0859 cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
0860 
0861 cairo_public void
0862 cairo_set_dash (cairo_t      *cr,
0863         const double *dashes,
0864         int       num_dashes,
0865         double        offset);
0866 
0867 cairo_public void
0868 cairo_set_miter_limit (cairo_t *cr, double limit);
0869 
0870 cairo_public void
0871 cairo_translate (cairo_t *cr, double tx, double ty);
0872 
0873 cairo_public void
0874 cairo_scale (cairo_t *cr, double sx, double sy);
0875 
0876 cairo_public void
0877 cairo_rotate (cairo_t *cr, double angle);
0878 
0879 cairo_public void
0880 cairo_transform (cairo_t          *cr,
0881          const cairo_matrix_t *matrix);
0882 
0883 cairo_public void
0884 cairo_set_matrix (cairo_t          *cr,
0885           const cairo_matrix_t *matrix);
0886 
0887 cairo_public void
0888 cairo_identity_matrix (cairo_t *cr);
0889 
0890 cairo_public void
0891 cairo_user_to_device (cairo_t *cr, double *x, double *y);
0892 
0893 cairo_public void
0894 cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
0895 
0896 cairo_public void
0897 cairo_device_to_user (cairo_t *cr, double *x, double *y);
0898 
0899 cairo_public void
0900 cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
0901 
0902 /* Path creation functions */
0903 cairo_public void
0904 cairo_new_path (cairo_t *cr);
0905 
0906 cairo_public void
0907 cairo_move_to (cairo_t *cr, double x, double y);
0908 
0909 cairo_public void
0910 cairo_new_sub_path (cairo_t *cr);
0911 
0912 cairo_public void
0913 cairo_line_to (cairo_t *cr, double x, double y);
0914 
0915 cairo_public void
0916 cairo_curve_to (cairo_t *cr,
0917         double x1, double y1,
0918         double x2, double y2,
0919         double x3, double y3);
0920 
0921 cairo_public void
0922 cairo_arc (cairo_t *cr,
0923        double xc, double yc,
0924        double radius,
0925        double angle1, double angle2);
0926 
0927 cairo_public void
0928 cairo_arc_negative (cairo_t *cr,
0929             double xc, double yc,
0930             double radius,
0931             double angle1, double angle2);
0932 
0933 /* XXX: NYI
0934 cairo_public void
0935 cairo_arc_to (cairo_t *cr,
0936           double x1, double y1,
0937           double x2, double y2,
0938           double radius);
0939 */
0940 
0941 cairo_public void
0942 cairo_rel_move_to (cairo_t *cr, double dx, double dy);
0943 
0944 cairo_public void
0945 cairo_rel_line_to (cairo_t *cr, double dx, double dy);
0946 
0947 cairo_public void
0948 cairo_rel_curve_to (cairo_t *cr,
0949             double dx1, double dy1,
0950             double dx2, double dy2,
0951             double dx3, double dy3);
0952 
0953 cairo_public void
0954 cairo_rectangle (cairo_t *cr,
0955          double x, double y,
0956          double width, double height);
0957 
0958 /* XXX: NYI
0959 cairo_public void
0960 cairo_stroke_to_path (cairo_t *cr);
0961 */
0962 
0963 cairo_public void
0964 cairo_close_path (cairo_t *cr);
0965 
0966 cairo_public void
0967 cairo_path_extents (cairo_t *cr,
0968             double *x1, double *y1,
0969             double *x2, double *y2);
0970 
0971 /* Painting functions */
0972 cairo_public void
0973 cairo_paint (cairo_t *cr);
0974 
0975 cairo_public void
0976 cairo_paint_with_alpha (cairo_t *cr,
0977             double   alpha);
0978 
0979 cairo_public void
0980 cairo_mask (cairo_t         *cr,
0981         cairo_pattern_t *pattern);
0982 
0983 cairo_public void
0984 cairo_mask_surface (cairo_t         *cr,
0985             cairo_surface_t *surface,
0986             double           surface_x,
0987             double           surface_y);
0988 
0989 cairo_public void
0990 cairo_stroke (cairo_t *cr);
0991 
0992 cairo_public void
0993 cairo_stroke_preserve (cairo_t *cr);
0994 
0995 cairo_public void
0996 cairo_fill (cairo_t *cr);
0997 
0998 cairo_public void
0999 cairo_fill_preserve (cairo_t *cr);
1000 
1001 cairo_public void
1002 cairo_copy_page (cairo_t *cr);
1003 
1004 cairo_public void
1005 cairo_show_page (cairo_t *cr);
1006 
1007 /* Insideness testing */
1008 cairo_public cairo_bool_t
1009 cairo_in_stroke (cairo_t *cr, double x, double y);
1010 
1011 cairo_public cairo_bool_t
1012 cairo_in_fill (cairo_t *cr, double x, double y);
1013 
1014 cairo_public cairo_bool_t
1015 cairo_in_clip (cairo_t *cr, double x, double y);
1016 
1017 /* Rectangular extents */
1018 cairo_public void
1019 cairo_stroke_extents (cairo_t *cr,
1020               double *x1, double *y1,
1021               double *x2, double *y2);
1022 
1023 cairo_public void
1024 cairo_fill_extents (cairo_t *cr,
1025             double *x1, double *y1,
1026             double *x2, double *y2);
1027 
1028 /* Clipping */
1029 cairo_public void
1030 cairo_reset_clip (cairo_t *cr);
1031 
1032 cairo_public void
1033 cairo_clip (cairo_t *cr);
1034 
1035 cairo_public void
1036 cairo_clip_preserve (cairo_t *cr);
1037 
1038 cairo_public void
1039 cairo_clip_extents (cairo_t *cr,
1040             double *x1, double *y1,
1041             double *x2, double *y2);
1042 
1043 /**
1044  * cairo_rectangle_t:
1045  * @x: X coordinate of the left side of the rectangle
1046  * @y: Y coordinate of the top side of the rectangle
1047  * @width: width of the rectangle
1048  * @height: height of the rectangle
1049  *
1050  * A data structure for holding a rectangle.
1051  *
1052  * Since: 1.4
1053  **/
1054 typedef struct _cairo_rectangle {
1055     double x, y, width, height;
1056 } cairo_rectangle_t;
1057 
1058 /**
1059  * cairo_rectangle_list_t:
1060  * @status: Error status of the rectangle list
1061  * @rectangles: Array containing the rectangles
1062  * @num_rectangles: Number of rectangles in this list
1063  * 
1064  * A data structure for holding a dynamically allocated
1065  * array of rectangles.
1066  *
1067  * Since: 1.4
1068  **/
1069 typedef struct _cairo_rectangle_list {
1070     cairo_status_t     status;
1071     cairo_rectangle_t *rectangles;
1072     int                num_rectangles;
1073 } cairo_rectangle_list_t;
1074 
1075 cairo_public cairo_rectangle_list_t *
1076 cairo_copy_clip_rectangle_list (cairo_t *cr);
1077 
1078 cairo_public void
1079 cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list);
1080 
1081 /* Logical structure tagging functions */
1082 
1083 #define CAIRO_TAG_DEST "cairo.dest"
1084 #define CAIRO_TAG_LINK "Link"
1085 #define CAIRO_TAG_CONTENT "cairo.content"
1086 #define CAIRO_TAG_CONTENT_REF "cairo.content_ref"
1087 
1088 cairo_public void
1089 cairo_tag_begin (cairo_t *cr, const char *tag_name, const char *attributes);
1090 
1091 cairo_public void
1092 cairo_tag_end (cairo_t *cr, const char *tag_name);
1093 
1094 /* Font/Text functions */
1095 
1096 /**
1097  * cairo_scaled_font_t:
1098  *
1099  * A #cairo_scaled_font_t is a font scaled to a particular size and device
1100  * resolution. A #cairo_scaled_font_t is most useful for low-level font
1101  * usage where a library or application wants to cache a reference
1102  * to a scaled font to speed up the computation of metrics.
1103  *
1104  * There are various types of scaled fonts, depending on the
1105  * <firstterm>font backend</firstterm> they use. The type of a
1106  * scaled font can be queried using cairo_scaled_font_get_type().
1107  *
1108  * Memory management of #cairo_scaled_font_t is done with
1109  * cairo_scaled_font_reference() and cairo_scaled_font_destroy().
1110  *
1111  * Since: 1.0
1112  **/
1113 typedef struct _cairo_scaled_font cairo_scaled_font_t;
1114 
1115 /**
1116  * cairo_font_face_t:
1117  *
1118  * A #cairo_font_face_t specifies all aspects of a font other
1119  * than the size or font matrix (a font matrix is used to distort
1120  * a font by shearing it or scaling it unequally in the two
1121  * directions) . A font face can be set on a #cairo_t by using
1122  * cairo_set_font_face(); the size and font matrix are set with
1123  * cairo_set_font_size() and cairo_set_font_matrix().
1124  *
1125  * There are various types of font faces, depending on the
1126  * <firstterm>font backend</firstterm> they use. The type of a
1127  * font face can be queried using cairo_font_face_get_type().
1128  *
1129  * Memory management of #cairo_font_face_t is done with
1130  * cairo_font_face_reference() and cairo_font_face_destroy().
1131  *
1132  * Since: 1.0
1133  **/
1134 typedef struct _cairo_font_face cairo_font_face_t;
1135 
1136 /**
1137  * cairo_glyph_t:
1138  * @index: glyph index in the font. The exact interpretation of the
1139  *      glyph index depends on the font technology being used.
1140  * @x: the offset in the X direction between the origin used for
1141  *     drawing or measuring the string and the origin of this glyph.
1142  * @y: the offset in the Y direction between the origin used for
1143  *     drawing or measuring the string and the origin of this glyph.
1144  *
1145  * The #cairo_glyph_t structure holds information about a single glyph
1146  * when drawing or measuring text. A font is (in simple terms) a
1147  * collection of shapes used to draw text. A glyph is one of these
1148  * shapes. There can be multiple glyphs for a single character
1149  * (alternates to be used in different contexts, for example), or a
1150  * glyph can be a <firstterm>ligature</firstterm> of multiple
1151  * characters. Cairo doesn't expose any way of converting input text
1152  * into glyphs, so in order to use the Cairo interfaces that take
1153  * arrays of glyphs, you must directly access the appropriate
1154  * underlying font system.
1155  *
1156  * Note that the offsets given by @x and @y are not cumulative. When
1157  * drawing or measuring text, each glyph is individually positioned
1158  * with respect to the overall origin
1159  *
1160  * Since: 1.0
1161  **/
1162 typedef struct {
1163     unsigned long        index;
1164     double               x;
1165     double               y;
1166 } cairo_glyph_t;
1167 
1168 cairo_public cairo_glyph_t *
1169 cairo_glyph_allocate (int num_glyphs);
1170 
1171 cairo_public void
1172 cairo_glyph_free (cairo_glyph_t *glyphs);
1173 
1174 /**
1175  * cairo_text_cluster_t:
1176  * @num_bytes: the number of bytes of UTF-8 text covered by cluster
1177  * @num_glyphs: the number of glyphs covered by cluster
1178  *
1179  * The #cairo_text_cluster_t structure holds information about a single
1180  * <firstterm>text cluster</firstterm>.  A text cluster is a minimal
1181  * mapping of some glyphs corresponding to some UTF-8 text.
1182  *
1183  * For a cluster to be valid, both @num_bytes and @num_glyphs should
1184  * be non-negative, and at least one should be non-zero.
1185  * Note that clusters with zero glyphs are not as well supported as
1186  * normal clusters.  For example, PDF rendering applications typically
1187  * ignore those clusters when PDF text is being selected.
1188  *
1189  * See cairo_show_text_glyphs() for how clusters are used in advanced
1190  * text operations.
1191  *
1192  * Since: 1.8
1193  **/
1194 typedef struct {
1195     int        num_bytes;
1196     int        num_glyphs;
1197 } cairo_text_cluster_t;
1198 
1199 cairo_public cairo_text_cluster_t *
1200 cairo_text_cluster_allocate (int num_clusters);
1201 
1202 cairo_public void
1203 cairo_text_cluster_free (cairo_text_cluster_t *clusters);
1204 
1205 /**
1206  * cairo_text_cluster_flags_t:
1207  * @CAIRO_TEXT_CLUSTER_FLAG_BACKWARD: The clusters in the cluster array
1208  * map to glyphs in the glyph array from end to start. (Since 1.8)
1209  *
1210  * Specifies properties of a text cluster mapping.
1211  *
1212  * Since: 1.8
1213  **/
1214 typedef enum _cairo_text_cluster_flags {
1215     CAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001
1216 } cairo_text_cluster_flags_t;
1217 
1218 /**
1219  * cairo_text_extents_t:
1220  * @x_bearing: the horizontal distance from the origin to the
1221  *   leftmost part of the glyphs as drawn. Positive if the
1222  *   glyphs lie entirely to the right of the origin.
1223  * @y_bearing: the vertical distance from the origin to the
1224  *   topmost part of the glyphs as drawn. Positive only if the
1225  *   glyphs lie completely below the origin; will usually be
1226  *   negative.
1227  * @width: width of the glyphs as drawn
1228  * @height: height of the glyphs as drawn
1229  * @x_advance:distance to advance in the X direction
1230  *    after drawing these glyphs
1231  * @y_advance: distance to advance in the Y direction
1232  *   after drawing these glyphs. Will typically be zero except
1233  *   for vertical text layout as found in East-Asian languages.
1234  *
1235  * The #cairo_text_extents_t structure stores the extents of a single
1236  * glyph or a string of glyphs in user-space coordinates. Because text
1237  * extents are in user-space coordinates, they are mostly, but not
1238  * entirely, independent of the current transformation matrix. If you call
1239  * <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
1240  * be drawn twice as big, but the reported text extents will not be
1241  * doubled. They will change slightly due to hinting (so you can't
1242  * assume that metrics are independent of the transformation matrix),
1243  * but otherwise will remain unchanged.
1244  *
1245  * Since: 1.0
1246  **/
1247 typedef struct {
1248     double x_bearing;
1249     double y_bearing;
1250     double width;
1251     double height;
1252     double x_advance;
1253     double y_advance;
1254 } cairo_text_extents_t;
1255 
1256 /**
1257  * cairo_font_extents_t:
1258  * @ascent: the distance that the font extends above the baseline.
1259  *          Note that this is not always exactly equal to the maximum
1260  *          of the extents of all the glyphs in the font, but rather
1261  *          is picked to express the font designer's intent as to
1262  *          how the font should align with elements above it.
1263  * @descent: the distance that the font extends below the baseline.
1264  *           This value is positive for typical fonts that include
1265  *           portions below the baseline. Note that this is not always
1266  *           exactly equal to the maximum of the extents of all the
1267  *           glyphs in the font, but rather is picked to express the
1268  *           font designer's intent as to how the font should
1269  *           align with elements below it.
1270  * @height: the recommended vertical distance between baselines when
1271  *          setting consecutive lines of text with the font. This
1272  *          is greater than @ascent+@descent by a
1273  *          quantity known as the <firstterm>line spacing</firstterm>
1274  *          or <firstterm>external leading</firstterm>. When space
1275  *          is at a premium, most fonts can be set with only
1276  *          a distance of @ascent+@descent between lines.
1277  * @max_x_advance: the maximum distance in the X direction that
1278  *         the origin is advanced for any glyph in the font.
1279  * @max_y_advance: the maximum distance in the Y direction that
1280  *         the origin is advanced for any glyph in the font.
1281  *         This will be zero for normal fonts used for horizontal
1282  *         writing. (The scripts of East Asia are sometimes written
1283  *         vertically.)
1284  *
1285  * The #cairo_font_extents_t structure stores metric information for
1286  * a font. Values are given in the current user-space coordinate
1287  * system.
1288  *
1289  * Because font metrics are in user-space coordinates, they are
1290  * mostly, but not entirely, independent of the current transformation
1291  * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
1292  * text will be drawn twice as big, but the reported text extents will
1293  * not be doubled. They will change slightly due to hinting (so you
1294  * can't assume that metrics are independent of the transformation
1295  * matrix), but otherwise will remain unchanged.
1296  *
1297  * Since: 1.0
1298  **/
1299 typedef struct {
1300     double ascent;
1301     double descent;
1302     double height;
1303     double max_x_advance;
1304     double max_y_advance;
1305 } cairo_font_extents_t;
1306 
1307 /**
1308  * cairo_font_slant_t:
1309  * @CAIRO_FONT_SLANT_NORMAL: Upright font style, since 1.0
1310  * @CAIRO_FONT_SLANT_ITALIC: Italic font style, since 1.0
1311  * @CAIRO_FONT_SLANT_OBLIQUE: Oblique font style, since 1.0
1312  *
1313  * Specifies variants of a font face based on their slant.
1314  *
1315  * Since: 1.0
1316  **/
1317 typedef enum _cairo_font_slant {
1318     CAIRO_FONT_SLANT_NORMAL,
1319     CAIRO_FONT_SLANT_ITALIC,
1320     CAIRO_FONT_SLANT_OBLIQUE
1321 } cairo_font_slant_t;
1322 
1323 /**
1324  * cairo_font_weight_t:
1325  * @CAIRO_FONT_WEIGHT_NORMAL: Normal font weight, since 1.0
1326  * @CAIRO_FONT_WEIGHT_BOLD: Bold font weight, since 1.0
1327  *
1328  * Specifies variants of a font face based on their weight.
1329  *
1330  * Since: 1.0
1331  **/
1332 typedef enum _cairo_font_weight {
1333     CAIRO_FONT_WEIGHT_NORMAL,
1334     CAIRO_FONT_WEIGHT_BOLD
1335 } cairo_font_weight_t;
1336 
1337 /**
1338  * cairo_subpixel_order_t:
1339  * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for
1340  *   for the target device, since 1.0
1341  * @CAIRO_SUBPIXEL_ORDER_RGB: Subpixel elements are arranged horizontally
1342  *   with red at the left, since 1.0
1343  * @CAIRO_SUBPIXEL_ORDER_BGR:  Subpixel elements are arranged horizontally
1344  *   with blue at the left, since 1.0
1345  * @CAIRO_SUBPIXEL_ORDER_VRGB: Subpixel elements are arranged vertically
1346  *   with red at the top, since 1.0
1347  * @CAIRO_SUBPIXEL_ORDER_VBGR: Subpixel elements are arranged vertically
1348  *   with blue at the top, since 1.0
1349  *
1350  * The subpixel order specifies the order of color elements within
1351  * each pixel on the display device when rendering with an
1352  * antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
1353  *
1354  * Since: 1.0
1355  **/
1356 typedef enum _cairo_subpixel_order {
1357     CAIRO_SUBPIXEL_ORDER_DEFAULT,
1358     CAIRO_SUBPIXEL_ORDER_RGB,
1359     CAIRO_SUBPIXEL_ORDER_BGR,
1360     CAIRO_SUBPIXEL_ORDER_VRGB,
1361     CAIRO_SUBPIXEL_ORDER_VBGR
1362 } cairo_subpixel_order_t;
1363 
1364 /**
1365  * cairo_hint_style_t:
1366  * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
1367  *   font backend and target device, since 1.0
1368  * @CAIRO_HINT_STYLE_NONE: Do not hint outlines, since 1.0
1369  * @CAIRO_HINT_STYLE_SLIGHT: Hint outlines slightly to improve
1370  *   contrast while retaining good fidelity to the original
1371  *   shapes, since 1.0
1372  * @CAIRO_HINT_STYLE_MEDIUM: Hint outlines with medium strength
1373  *   giving a compromise between fidelity to the original shapes
1374  *   and contrast, since 1.0
1375  * @CAIRO_HINT_STYLE_FULL: Hint outlines to maximize contrast, since 1.0
1376  *
1377  * Specifies the type of hinting to do on font outlines. Hinting
1378  * is the process of fitting outlines to the pixel grid in order
1379  * to improve the appearance of the result. Since hinting outlines
1380  * involves distorting them, it also reduces the faithfulness
1381  * to the original outline shapes. Not all of the outline hinting
1382  * styles are supported by all font backends.
1383  *
1384  * New entries may be added in future versions.
1385  *
1386  * Since: 1.0
1387  **/
1388 typedef enum _cairo_hint_style {
1389     CAIRO_HINT_STYLE_DEFAULT,
1390     CAIRO_HINT_STYLE_NONE,
1391     CAIRO_HINT_STYLE_SLIGHT,
1392     CAIRO_HINT_STYLE_MEDIUM,
1393     CAIRO_HINT_STYLE_FULL
1394 } cairo_hint_style_t;
1395 
1396 /**
1397  * cairo_hint_metrics_t:
1398  * @CAIRO_HINT_METRICS_DEFAULT: Hint metrics in the default
1399  *  manner for the font backend and target device, since 1.0
1400  * @CAIRO_HINT_METRICS_OFF: Do not hint font metrics, since 1.0
1401  * @CAIRO_HINT_METRICS_ON: Hint font metrics, since 1.0
1402  *
1403  * Specifies whether to hint font metrics; hinting font metrics
1404  * means quantizing them so that they are integer values in
1405  * device space. Doing this improves the consistency of
1406  * letter and line spacing, however it also means that text
1407  * will be laid out differently at different zoom factors.
1408  *
1409  * Since: 1.0
1410  **/
1411 typedef enum _cairo_hint_metrics {
1412     CAIRO_HINT_METRICS_DEFAULT,
1413     CAIRO_HINT_METRICS_OFF,
1414     CAIRO_HINT_METRICS_ON
1415 } cairo_hint_metrics_t;
1416 
1417 /**
1418  * cairo_color_mode_t:
1419  * @CAIRO_COLOR_MODE_DEFAULT: Use the default color mode for
1420  * font backend and target device, since 1.18.
1421  * @CAIRO_COLOR_MODE_NO_COLOR: Disable rendering color glyphs. Glyphs are
1422  * always rendered as outline glyphs, since 1.18.
1423  * @CAIRO_COLOR_MODE_COLOR: Enable rendering color glyphs. If the font
1424  * contains a color presentation for a glyph, and when supported by
1425  * the font backend, the glyph will be rendered in color, since 1.18.
1426  *
1427  * Specifies if color fonts are to be rendered using the color
1428  * glyphs or outline glyphs. Glyphs that do not have a color
1429  * presentation, and non-color fonts are not affected by this font
1430  * option.
1431  *
1432  * Since: 1.18
1433  **/
1434 typedef enum _cairo_color_mode {
1435     CAIRO_COLOR_MODE_DEFAULT,
1436     CAIRO_COLOR_MODE_NO_COLOR,
1437     CAIRO_COLOR_MODE_COLOR
1438 } cairo_color_mode_t;
1439 
1440 /**
1441  * cairo_font_options_t:
1442  *
1443  * An opaque structure holding all options that are used when
1444  * rendering fonts.
1445  *
1446  * Individual features of a #cairo_font_options_t can be set or
1447  * accessed using functions named
1448  * <function>cairo_font_options_set_<emphasis>feature_name</emphasis>()</function> and
1449  * <function>cairo_font_options_get_<emphasis>feature_name</emphasis>()</function>, like
1450  * cairo_font_options_set_antialias() and
1451  * cairo_font_options_get_antialias().
1452  *
1453  * New features may be added to a #cairo_font_options_t in the
1454  * future.  For this reason, cairo_font_options_copy(),
1455  * cairo_font_options_equal(), cairo_font_options_merge(), and
1456  * cairo_font_options_hash() should be used to copy, check
1457  * for equality, merge, or compute a hash value of
1458  * #cairo_font_options_t objects.
1459  *
1460  * Since: 1.0
1461  **/
1462 typedef struct _cairo_font_options cairo_font_options_t;
1463 
1464 cairo_public cairo_font_options_t *
1465 cairo_font_options_create (void);
1466 
1467 cairo_public cairo_font_options_t *
1468 cairo_font_options_copy (const cairo_font_options_t *original);
1469 
1470 cairo_public void
1471 cairo_font_options_destroy (cairo_font_options_t *options);
1472 
1473 cairo_public cairo_status_t
1474 cairo_font_options_status (cairo_font_options_t *options);
1475 
1476 cairo_public void
1477 cairo_font_options_merge (cairo_font_options_t       *options,
1478               const cairo_font_options_t *other);
1479 cairo_public cairo_bool_t
1480 cairo_font_options_equal (const cairo_font_options_t *options,
1481               const cairo_font_options_t *other);
1482 
1483 cairo_public unsigned long
1484 cairo_font_options_hash (const cairo_font_options_t *options);
1485 
1486 cairo_public void
1487 cairo_font_options_set_antialias (cairo_font_options_t *options,
1488                   cairo_antialias_t     antialias);
1489 cairo_public cairo_antialias_t
1490 cairo_font_options_get_antialias (const cairo_font_options_t *options);
1491 
1492 cairo_public void
1493 cairo_font_options_set_subpixel_order (cairo_font_options_t   *options,
1494                        cairo_subpixel_order_t  subpixel_order);
1495 cairo_public cairo_subpixel_order_t
1496 cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
1497 
1498 cairo_public void
1499 cairo_font_options_set_hint_style (cairo_font_options_t *options,
1500                    cairo_hint_style_t     hint_style);
1501 cairo_public cairo_hint_style_t
1502 cairo_font_options_get_hint_style (const cairo_font_options_t *options);
1503 
1504 cairo_public void
1505 cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
1506                      cairo_hint_metrics_t  hint_metrics);
1507 cairo_public cairo_hint_metrics_t
1508 cairo_font_options_get_hint_metrics (const cairo_font_options_t *options);
1509 
1510 cairo_public const char *
1511 cairo_font_options_get_variations (cairo_font_options_t *options);
1512 
1513 cairo_public void
1514 cairo_font_options_set_variations (cairo_font_options_t *options,
1515                                    const char           *variations);
1516 
1517 #define CAIRO_COLOR_PALETTE_DEFAULT 0
1518 
1519 cairo_public void
1520 cairo_font_options_set_color_mode (cairo_font_options_t *options,
1521                                    cairo_color_mode_t    color_mode);
1522 
1523 cairo_public cairo_color_mode_t
1524 cairo_font_options_get_color_mode (const cairo_font_options_t *options);
1525 
1526 cairo_public unsigned int
1527 cairo_font_options_get_color_palette (const cairo_font_options_t *options);
1528 
1529 cairo_public void
1530 cairo_font_options_set_color_palette (cairo_font_options_t *options,
1531                                       unsigned int          palette_index);
1532 
1533 cairo_public void
1534 cairo_font_options_set_custom_palette_color (cairo_font_options_t *options,
1535                                              unsigned int index,
1536                                              double red, double green,
1537                                              double blue, double alpha);
1538 
1539 cairo_public cairo_status_t
1540 cairo_font_options_get_custom_palette_color (cairo_font_options_t *options,
1541                                              unsigned int index,
1542                                              double *red, double *green,
1543                                              double *blue, double *alpha);
1544 
1545 /* This interface is for dealing with text as text, not caring about the
1546    font object inside the cairo_t. */
1547 
1548 cairo_public void
1549 cairo_select_font_face (cairo_t              *cr,
1550             const char           *family,
1551             cairo_font_slant_t   slant,
1552             cairo_font_weight_t  weight);
1553 
1554 cairo_public void
1555 cairo_set_font_size (cairo_t *cr, double size);
1556 
1557 cairo_public void
1558 cairo_set_font_matrix (cairo_t          *cr,
1559                const cairo_matrix_t *matrix);
1560 
1561 cairo_public void
1562 cairo_get_font_matrix (cairo_t *cr,
1563                cairo_matrix_t *matrix);
1564 
1565 cairo_public void
1566 cairo_set_font_options (cairo_t                    *cr,
1567             const cairo_font_options_t *options);
1568 
1569 cairo_public void
1570 cairo_get_font_options (cairo_t              *cr,
1571             cairo_font_options_t *options);
1572 
1573 cairo_public void
1574 cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
1575 
1576 cairo_public cairo_font_face_t *
1577 cairo_get_font_face (cairo_t *cr);
1578 
1579 cairo_public void
1580 cairo_set_scaled_font (cairo_t                   *cr,
1581                const cairo_scaled_font_t *scaled_font);
1582 
1583 cairo_public cairo_scaled_font_t *
1584 cairo_get_scaled_font (cairo_t *cr);
1585 
1586 cairo_public void
1587 cairo_show_text (cairo_t *cr, const char *utf8);
1588 
1589 cairo_public void
1590 cairo_show_glyphs (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
1591 
1592 cairo_public void
1593 cairo_show_text_glyphs (cairo_t            *cr,
1594             const char         *utf8,
1595             int             utf8_len,
1596             const cairo_glyph_t    *glyphs,
1597             int             num_glyphs,
1598             const cairo_text_cluster_t *clusters,
1599             int             num_clusters,
1600             cairo_text_cluster_flags_t  cluster_flags);
1601 
1602 cairo_public void
1603 cairo_text_path  (cairo_t *cr, const char *utf8);
1604 
1605 cairo_public void
1606 cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
1607 
1608 cairo_public void
1609 cairo_text_extents (cairo_t              *cr,
1610             const char       *utf8,
1611             cairo_text_extents_t *extents);
1612 
1613 cairo_public void
1614 cairo_glyph_extents (cairo_t               *cr,
1615              const cairo_glyph_t   *glyphs,
1616              int                   num_glyphs,
1617              cairo_text_extents_t  *extents);
1618 
1619 cairo_public void
1620 cairo_font_extents (cairo_t              *cr,
1621             cairo_font_extents_t *extents);
1622 
1623 /* Generic identifier for a font style */
1624 
1625 cairo_public cairo_font_face_t *
1626 cairo_font_face_reference (cairo_font_face_t *font_face);
1627 
1628 cairo_public void
1629 cairo_font_face_destroy (cairo_font_face_t *font_face);
1630 
1631 cairo_public unsigned int
1632 cairo_font_face_get_reference_count (cairo_font_face_t *font_face);
1633 
1634 cairo_public cairo_status_t
1635 cairo_font_face_status (cairo_font_face_t *font_face);
1636 
1637 
1638 /**
1639  * cairo_font_type_t:
1640  * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api (Since: 1.2)
1641  * @CAIRO_FONT_TYPE_FT: The font is of type FreeType (Since: 1.2)
1642  * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32 (Since: 1.2)
1643  * @CAIRO_FONT_TYPE_QUARTZ: The font is of type Quartz (Since: 1.6, in 1.2 and
1644  * 1.4 it was named CAIRO_FONT_TYPE_ATSUI)
1645  * @CAIRO_FONT_TYPE_USER: The font was create using cairo's user font api (Since: 1.8)
1646  * @CAIRO_FONT_TYPE_DWRITE: The font is of type Win32 DWrite (Since: 1.18)
1647  *
1648  * #cairo_font_type_t is used to describe the type of a given font
1649  * face or scaled font. The font types are also known as "font
1650  * backends" within cairo.
1651  *
1652  * The type of a font face is determined by the function used to
1653  * create it, which will generally be of the form
1654  * <function>cairo_<emphasis>type</emphasis>_font_face_create(<!-- -->)</function>.
1655  * The font face type can be queried with cairo_font_face_get_type()
1656  *
1657  * The various #cairo_font_face_t functions can be used with a font face
1658  * of any type.
1659  *
1660  * The type of a scaled font is determined by the type of the font
1661  * face passed to cairo_scaled_font_create(). The scaled font type can
1662  * be queried with cairo_scaled_font_get_type()
1663  *
1664  * The various #cairo_scaled_font_t functions can be used with scaled
1665  * fonts of any type, but some font backends also provide
1666  * type-specific functions that must only be called with a scaled font
1667  * of the appropriate type. These functions have names that begin with
1668  * <function>cairo_<emphasis>type</emphasis>_scaled_font(<!-- -->)</function>
1669  * such as cairo_ft_scaled_font_lock_face().
1670  *
1671  * The behavior of calling a type-specific function with a scaled font
1672  * of the wrong type is undefined.
1673  *
1674  * New entries may be added in future versions.
1675  *
1676  * Since: 1.2
1677  **/
1678 typedef enum _cairo_font_type {
1679     CAIRO_FONT_TYPE_TOY,
1680     CAIRO_FONT_TYPE_FT,
1681     CAIRO_FONT_TYPE_WIN32,
1682     CAIRO_FONT_TYPE_QUARTZ,
1683     CAIRO_FONT_TYPE_USER,
1684     CAIRO_FONT_TYPE_DWRITE
1685 } cairo_font_type_t;
1686 
1687 cairo_public cairo_font_type_t
1688 cairo_font_face_get_type (cairo_font_face_t *font_face);
1689 
1690 cairo_public void *
1691 cairo_font_face_get_user_data (cairo_font_face_t       *font_face,
1692                    const cairo_user_data_key_t *key);
1693 
1694 cairo_public cairo_status_t
1695 cairo_font_face_set_user_data (cairo_font_face_t       *font_face,
1696                    const cairo_user_data_key_t *key,
1697                    void            *user_data,
1698                    cairo_destroy_func_t     destroy);
1699 
1700 /* Portable interface to general font features. */
1701 
1702 cairo_public cairo_scaled_font_t *
1703 cairo_scaled_font_create (cairo_font_face_t          *font_face,
1704               const cairo_matrix_t       *font_matrix,
1705               const cairo_matrix_t       *ctm,
1706               const cairo_font_options_t *options);
1707 
1708 cairo_public cairo_scaled_font_t *
1709 cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
1710 
1711 cairo_public void
1712 cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
1713 
1714 cairo_public unsigned int
1715 cairo_scaled_font_get_reference_count (cairo_scaled_font_t *scaled_font);
1716 
1717 cairo_public cairo_status_t
1718 cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
1719 
1720 cairo_public cairo_font_type_t
1721 cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
1722 
1723 cairo_public void *
1724 cairo_scaled_font_get_user_data (cairo_scaled_font_t         *scaled_font,
1725                  const cairo_user_data_key_t *key);
1726 
1727 cairo_public cairo_status_t
1728 cairo_scaled_font_set_user_data (cairo_scaled_font_t         *scaled_font,
1729                  const cairo_user_data_key_t *key,
1730                  void                        *user_data,
1731                  cairo_destroy_func_t         destroy);
1732 
1733 cairo_public void
1734 cairo_scaled_font_extents (cairo_scaled_font_t  *scaled_font,
1735                cairo_font_extents_t *extents);
1736 
1737 cairo_public void
1738 cairo_scaled_font_text_extents (cairo_scaled_font_t  *scaled_font,
1739                 const char           *utf8,
1740                 cairo_text_extents_t *extents);
1741 
1742 cairo_public void
1743 cairo_scaled_font_glyph_extents (cairo_scaled_font_t   *scaled_font,
1744                  const cairo_glyph_t   *glyphs,
1745                  int                   num_glyphs,
1746                  cairo_text_extents_t  *extents);
1747 
1748 cairo_public cairo_status_t
1749 cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t        *scaled_font,
1750                   double              x,
1751                   double              y,
1752                   const char                 *utf8,
1753                   int                     utf8_len,
1754                   cairo_glyph_t             **glyphs,
1755                   int                    *num_glyphs,
1756                   cairo_text_cluster_t      **clusters,
1757                   int                    *num_clusters,
1758                   cairo_text_cluster_flags_t *cluster_flags);
1759 
1760 cairo_public cairo_font_face_t *
1761 cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
1762 
1763 cairo_public void
1764 cairo_scaled_font_get_font_matrix (cairo_scaled_font_t  *scaled_font,
1765                    cairo_matrix_t   *font_matrix);
1766 
1767 cairo_public void
1768 cairo_scaled_font_get_ctm (cairo_scaled_font_t  *scaled_font,
1769                cairo_matrix_t   *ctm);
1770 
1771 cairo_public void
1772 cairo_scaled_font_get_scale_matrix (cairo_scaled_font_t *scaled_font,
1773                     cairo_matrix_t  *scale_matrix);
1774 
1775 cairo_public void
1776 cairo_scaled_font_get_font_options (cairo_scaled_font_t     *scaled_font,
1777                     cairo_font_options_t    *options);
1778 
1779 
1780 /* Toy fonts */
1781 
1782 cairo_public cairo_font_face_t *
1783 cairo_toy_font_face_create (const char           *family,
1784                 cairo_font_slant_t    slant,
1785                 cairo_font_weight_t   weight);
1786 
1787 cairo_public const char *
1788 cairo_toy_font_face_get_family (cairo_font_face_t *font_face);
1789 
1790 cairo_public cairo_font_slant_t
1791 cairo_toy_font_face_get_slant (cairo_font_face_t *font_face);
1792 
1793 cairo_public cairo_font_weight_t
1794 cairo_toy_font_face_get_weight (cairo_font_face_t *font_face);
1795 
1796 
1797 /* User fonts */
1798 
1799 cairo_public cairo_font_face_t *
1800 cairo_user_font_face_create (void);
1801 
1802 /* User-font method signatures */
1803 
1804 /**
1805  * cairo_user_scaled_font_init_func_t:
1806  * @scaled_font: the scaled-font being created
1807  * @cr: a cairo context, in font space
1808  * @extents: font extents to fill in, in font space
1809  *
1810  * #cairo_user_scaled_font_init_func_t is the type of function which is
1811  * called when a scaled-font needs to be created for a user font-face.
1812  *
1813  * The cairo context @cr is not used by the caller, but is prepared in font
1814  * space, similar to what the cairo contexts passed to the render_glyph
1815  * method will look like.  The callback can use this context for extents
1816  * computation for example.  After the callback is called, @cr is checked
1817  * for any error status.
1818  *
1819  * The @extents argument is where the user font sets the font extents for
1820  * @scaled_font.  It is in font space, which means that for most cases its
1821  * ascent and descent members should add to 1.0.  @extents is preset to
1822  * hold a value of 1.0 for ascent, height, and max_x_advance, and 0.0 for
1823  * descent and max_y_advance members.
1824  *
1825  * The callback is optional.  If not set, default font extents as described
1826  * in the previous paragraph will be used.
1827  *
1828  * Note that @scaled_font is not fully initialized at this
1829  * point and trying to use it for text operations in the callback will result
1830  * in deadlock.
1831  *
1832  * Returns: %CAIRO_STATUS_SUCCESS upon success, or an error status on error.
1833  *
1834  * Since: 1.8
1835  **/
1836 typedef cairo_status_t (*cairo_user_scaled_font_init_func_t) (cairo_scaled_font_t  *scaled_font,
1837                                   cairo_t              *cr,
1838                                   cairo_font_extents_t *extents);
1839 
1840 /**
1841  * cairo_user_scaled_font_render_glyph_func_t:
1842  * @scaled_font: user scaled-font
1843  * @glyph: glyph code to render
1844  * @cr: cairo context to draw to, in font space
1845  * @extents: glyph extents to fill in, in font space
1846  *
1847  * #cairo_user_scaled_font_render_glyph_func_t is the type of function which
1848  * is called when a user scaled-font needs to render a glyph.
1849  *
1850  * The callback is mandatory, and expected to draw the glyph with code @glyph to
1851  * the cairo context @cr.  @cr is prepared such that the glyph drawing is done in
1852  * font space.  That is, the matrix set on @cr is the scale matrix of @scaled_font.
1853  * The @extents argument is where the user font sets the font extents for
1854  * @scaled_font.  However, if user prefers to draw in user space, they can
1855  * achieve that by changing the matrix on @cr.
1856  *
1857  * All cairo rendering operations to @cr are permitted. However, when
1858  * this callback is set with
1859  * cairo_user_font_face_set_render_glyph_func(), the result is
1860  * undefined if any source other than the default source on @cr is
1861  * used.  That means, glyph bitmaps should be rendered using
1862  * cairo_mask() instead of cairo_paint().
1863  *
1864  * When this callback is set with
1865  * cairo_user_font_face_set_render_color_glyph_func(), the default
1866  * source is black. Setting the source is a valid
1867  * operation. cairo_user_scaled_font_get_foreground_marker() or
1868  * cairo_user_scaled_font_get_foreground_source() may be called to
1869  * obtain the current source at the time the glyph is rendered.
1870  *
1871  * Other non-default settings on @cr include a font size of 1.0 (given that
1872  * it is set up to be in font space), and font options corresponding to
1873  * @scaled_font.
1874  *
1875  * The @extents argument is preset to have <literal>x_bearing</literal>,
1876  * <literal>width</literal>, and <literal>y_advance</literal> of zero,
1877  * <literal>y_bearing</literal> set to <literal>-font_extents.ascent</literal>,
1878  * <literal>height</literal> to <literal>font_extents.ascent+font_extents.descent</literal>,
1879  * and <literal>x_advance</literal> to <literal>font_extents.max_x_advance</literal>.
1880  * The only field user needs to set in majority of cases is
1881  * <literal>x_advance</literal>.
1882  * If the <literal>width</literal> field is zero upon the callback returning
1883  * (which is its preset value), the glyph extents are automatically computed
1884  * based on the drawings done to @cr.  This is in most cases exactly what the
1885  * desired behavior is.  However, if for any reason the callback sets the
1886  * extents, it must be ink extents, and include the extents of all drawing
1887  * done to @cr in the callback.
1888  *
1889  * Where both color and non-color callbacks has been set using
1890  * cairo_user_font_face_set_render_color_glyph_func(), and
1891  * cairo_user_font_face_set_render_glyph_func(), the color glyph
1892  * callback will be called first. If the color glyph callback returns
1893  * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, any drawing operations are
1894  * discarded and the non-color callback will be called. This is the
1895  * only case in which the %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED may
1896  * be returned from a render callback. This fallback sequence allows a
1897  * user font face to contain a combination of both color and non-color
1898  * glyphs.
1899  *
1900  * Returns: %CAIRO_STATUS_SUCCESS upon success,
1901  * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
1902  * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
1903  *
1904  * Since: 1.8
1905  **/
1906 typedef cairo_status_t (*cairo_user_scaled_font_render_glyph_func_t) (cairo_scaled_font_t  *scaled_font,
1907                                       unsigned long         glyph,
1908                                       cairo_t              *cr,
1909                                       cairo_text_extents_t *extents);
1910 
1911 /**
1912  * cairo_user_scaled_font_text_to_glyphs_func_t:
1913  * @scaled_font: the scaled-font being created
1914  * @utf8: a string of text encoded in UTF-8
1915  * @utf8_len: length of @utf8 in bytes
1916  * @glyphs: pointer to array of glyphs to fill, in font space
1917  * @num_glyphs: pointer to number of glyphs
1918  * @clusters: pointer to array of cluster mapping information to fill, or %NULL
1919  * @num_clusters: pointer to number of clusters
1920  * @cluster_flags: pointer to location to store cluster flags corresponding to the
1921  *                 output @clusters
1922  *
1923  * #cairo_user_scaled_font_text_to_glyphs_func_t is the type of function which
1924  * is called to convert input text to an array of glyphs.  This is used by the
1925  * cairo_show_text() operation.
1926  *
1927  * Using this callback the user-font has full control on glyphs and their
1928  * positions.  That means, it allows for features like ligatures and kerning,
1929  * as well as complex <firstterm>shaping</firstterm> required for scripts like
1930  * Arabic and Indic.
1931  *
1932  * The @num_glyphs argument is preset to the number of glyph entries available
1933  * in the @glyphs buffer. If the @glyphs buffer is %NULL, the value of
1934  * @num_glyphs will be zero.  If the provided glyph array is too short for
1935  * the conversion (or for convenience), a new glyph array may be allocated
1936  * using cairo_glyph_allocate() and placed in @glyphs.  Upon return,
1937  * @num_glyphs should contain the number of generated glyphs.  If the value
1938  * @glyphs points at has changed after the call, the caller will free the
1939  * allocated glyph array using cairo_glyph_free().  The caller will also free
1940  * the original value of @glyphs, so the callback shouldn't do so.
1941  * The callback should populate the glyph indices and positions (in font space)
1942  * assuming that the text is to be shown at the origin.
1943  *
1944  * If @clusters is not %NULL, @num_clusters and @cluster_flags are also
1945  * non-%NULL, and cluster mapping should be computed. The semantics of how
1946  * cluster array allocation works is similar to the glyph array.  That is,
1947  * if @clusters initially points to a non-%NULL value, that array may be used
1948  * as a cluster buffer, and @num_clusters points to the number of cluster
1949  * entries available there.  If the provided cluster array is too short for
1950  * the conversion (or for convenience), a new cluster array may be allocated
1951  * using cairo_text_cluster_allocate() and placed in @clusters.  In this case,
1952  * the original value of @clusters will still be freed by the caller.  Upon
1953  * return, @num_clusters should contain the number of generated clusters.
1954  * If the value @clusters points at has changed after the call, the caller
1955  * will free the allocated cluster array using cairo_text_cluster_free().
1956  *
1957  * The callback is optional.  If @num_glyphs is negative upon
1958  * the callback returning or if the return value
1959  * is %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, the unicode_to_glyph callback
1960  * is tried.  See #cairo_user_scaled_font_unicode_to_glyph_func_t.
1961  *
1962  * Note: While cairo does not impose any limitation on glyph indices,
1963  * some applications may assume that a glyph index fits in a 16-bit
1964  * unsigned integer.  As such, it is advised that user-fonts keep their
1965  * glyphs in the 0 to 65535 range.  Furthermore, some applications may
1966  * assume that glyph 0 is a special glyph-not-found glyph.  User-fonts
1967  * are advised to use glyph 0 for such purposes and do not use that
1968  * glyph value for other purposes.
1969  *
1970  * Returns: %CAIRO_STATUS_SUCCESS upon success,
1971  * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
1972  * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
1973  *
1974  * Since: 1.8
1975  **/
1976 typedef cairo_status_t (*cairo_user_scaled_font_text_to_glyphs_func_t) (cairo_scaled_font_t        *scaled_font,
1977                                     const char             *utf8,
1978                                     int                 utf8_len,
1979                                     cairo_glyph_t             **glyphs,
1980                                     int                *num_glyphs,
1981                                     cairo_text_cluster_t      **clusters,
1982                                     int                *num_clusters,
1983                                     cairo_text_cluster_flags_t *cluster_flags);
1984 
1985 /**
1986  * cairo_user_scaled_font_unicode_to_glyph_func_t:
1987  * @scaled_font: the scaled-font being created
1988  * @unicode: input unicode character code-point
1989  * @glyph_index: output glyph index
1990  *
1991  * #cairo_user_scaled_font_unicode_to_glyph_func_t is the type of function which
1992  * is called to convert an input Unicode character to a single glyph.
1993  * This is used by the cairo_show_text() operation.
1994  *
1995  * This callback is used to provide the same functionality as the
1996  * text_to_glyphs callback does (see #cairo_user_scaled_font_text_to_glyphs_func_t)
1997  * but has much less control on the output,
1998  * in exchange for increased ease of use.  The inherent assumption to using
1999  * this callback is that each character maps to one glyph, and that the
2000  * mapping is context independent.  It also assumes that glyphs are positioned
2001  * according to their advance width.  These mean no ligatures, kerning, or
2002  * complex scripts can be implemented using this callback.
2003  *
2004  * The callback is optional, and only used if text_to_glyphs callback is not
2005  * set or fails to return glyphs.  If this callback is not set or if it returns
2006  * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED, an identity mapping from Unicode
2007  * code-points to glyph indices is assumed.
2008  *
2009  * Note: While cairo does not impose any limitation on glyph indices,
2010  * some applications may assume that a glyph index fits in a 16-bit
2011  * unsigned integer.  As such, it is advised that user-fonts keep their
2012  * glyphs in the 0 to 65535 range.  Furthermore, some applications may
2013  * assume that glyph 0 is a special glyph-not-found glyph.  User-fonts
2014  * are advised to use glyph 0 for such purposes and do not use that
2015  * glyph value for other purposes.
2016  *
2017  * Returns: %CAIRO_STATUS_SUCCESS upon success,
2018  * %CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED if fallback options should be tried,
2019  * or %CAIRO_STATUS_USER_FONT_ERROR or any other error status on error.
2020  *
2021  * Since: 1.8
2022  **/
2023 typedef cairo_status_t (*cairo_user_scaled_font_unicode_to_glyph_func_t) (cairo_scaled_font_t *scaled_font,
2024                                       unsigned long        unicode,
2025                                       unsigned long       *glyph_index);
2026 
2027 /* User-font method setters */
2028 
2029 cairo_public void
2030 cairo_user_font_face_set_init_func (cairo_font_face_t                  *font_face,
2031                     cairo_user_scaled_font_init_func_t  init_func);
2032 
2033 cairo_public void
2034 cairo_user_font_face_set_render_glyph_func (cairo_font_face_t                          *font_face,
2035                         cairo_user_scaled_font_render_glyph_func_t  render_glyph_func);
2036 
2037 cairo_public void
2038 cairo_user_font_face_set_render_color_glyph_func (cairo_font_face_t                          *font_face,
2039                                                   cairo_user_scaled_font_render_glyph_func_t  render_glyph_func);
2040 
2041 cairo_public void
2042 cairo_user_font_face_set_text_to_glyphs_func (cairo_font_face_t                            *font_face,
2043                           cairo_user_scaled_font_text_to_glyphs_func_t  text_to_glyphs_func);
2044 
2045 cairo_public void
2046 cairo_user_font_face_set_unicode_to_glyph_func (cairo_font_face_t                              *font_face,
2047                             cairo_user_scaled_font_unicode_to_glyph_func_t  unicode_to_glyph_func);
2048 
2049 /* User-font method getters */
2050 
2051 cairo_public cairo_user_scaled_font_init_func_t
2052 cairo_user_font_face_get_init_func (cairo_font_face_t *font_face);
2053 
2054 cairo_public cairo_user_scaled_font_render_glyph_func_t
2055 cairo_user_font_face_get_render_glyph_func (cairo_font_face_t *font_face);
2056 
2057 cairo_public cairo_user_scaled_font_render_glyph_func_t
2058 cairo_user_font_face_get_render_color_glyph_func (cairo_font_face_t *font_face);
2059 
2060 cairo_public cairo_user_scaled_font_text_to_glyphs_func_t
2061 cairo_user_font_face_get_text_to_glyphs_func (cairo_font_face_t *font_face);
2062 
2063 cairo_public cairo_user_scaled_font_unicode_to_glyph_func_t
2064 cairo_user_font_face_get_unicode_to_glyph_func (cairo_font_face_t *font_face);
2065 
2066 cairo_public cairo_pattern_t *
2067 cairo_user_scaled_font_get_foreground_marker (cairo_scaled_font_t *scaled_font);
2068 
2069 cairo_public cairo_pattern_t *
2070 cairo_user_scaled_font_get_foreground_source (cairo_scaled_font_t *scaled_font);
2071 
2072 /* Query functions */
2073 
2074 cairo_public cairo_operator_t
2075 cairo_get_operator (cairo_t *cr);
2076 
2077 cairo_public cairo_pattern_t *
2078 cairo_get_source (cairo_t *cr);
2079 
2080 cairo_public double
2081 cairo_get_tolerance (cairo_t *cr);
2082 
2083 cairo_public cairo_antialias_t
2084 cairo_get_antialias (cairo_t *cr);
2085 
2086 cairo_public cairo_bool_t
2087 cairo_has_current_point (cairo_t *cr);
2088 
2089 cairo_public void
2090 cairo_get_current_point (cairo_t *cr, double *x, double *y);
2091 
2092 cairo_public cairo_fill_rule_t
2093 cairo_get_fill_rule (cairo_t *cr);
2094 
2095 cairo_public double
2096 cairo_get_line_width (cairo_t *cr);
2097 
2098 cairo_public cairo_bool_t
2099 cairo_get_hairline (cairo_t *cr);
2100 
2101 cairo_public cairo_line_cap_t
2102 cairo_get_line_cap (cairo_t *cr);
2103 
2104 cairo_public cairo_line_join_t
2105 cairo_get_line_join (cairo_t *cr);
2106 
2107 cairo_public double
2108 cairo_get_miter_limit (cairo_t *cr);
2109 
2110 cairo_public int
2111 cairo_get_dash_count (cairo_t *cr);
2112 
2113 cairo_public void
2114 cairo_get_dash (cairo_t *cr, double *dashes, double *offset);
2115 
2116 cairo_public void
2117 cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
2118 
2119 cairo_public cairo_surface_t *
2120 cairo_get_target (cairo_t *cr);
2121 
2122 cairo_public cairo_surface_t *
2123 cairo_get_group_target (cairo_t *cr);
2124 
2125 /**
2126  * cairo_path_data_type_t:
2127  * @CAIRO_PATH_MOVE_TO: A move-to operation, since 1.0
2128  * @CAIRO_PATH_LINE_TO: A line-to operation, since 1.0
2129  * @CAIRO_PATH_CURVE_TO: A curve-to operation, since 1.0
2130  * @CAIRO_PATH_CLOSE_PATH: A close-path operation, since 1.0
2131  *
2132  * #cairo_path_data_t is used to describe the type of one portion
2133  * of a path when represented as a #cairo_path_t.
2134  * See #cairo_path_data_t for details.
2135  *
2136  * Since: 1.0
2137  **/
2138 typedef enum _cairo_path_data_type {
2139     CAIRO_PATH_MOVE_TO,
2140     CAIRO_PATH_LINE_TO,
2141     CAIRO_PATH_CURVE_TO,
2142     CAIRO_PATH_CLOSE_PATH
2143 } cairo_path_data_type_t;
2144 
2145 /**
2146  * cairo_path_data_t:
2147  *
2148  * #cairo_path_data_t is used to represent the path data inside a
2149  * #cairo_path_t.
2150  *
2151  * The data structure is designed to try to balance the demands of
2152  * efficiency and ease-of-use. A path is represented as an array of
2153  * #cairo_path_data_t, which is a union of headers and points.
2154  *
2155  * Each portion of the path is represented by one or more elements in
2156  * the array, (one header followed by 0 or more points). The length
2157  * value of the header is the number of array elements for the current
2158  * portion including the header, (ie. length == 1 + # of points), and
2159  * where the number of points for each element type is as follows:
2160  *
2161  * <programlisting>
2162  *     %CAIRO_PATH_MOVE_TO:     1 point
2163  *     %CAIRO_PATH_LINE_TO:     1 point
2164  *     %CAIRO_PATH_CURVE_TO:    3 points
2165  *     %CAIRO_PATH_CLOSE_PATH:  0 points
2166  * </programlisting>
2167  *
2168  * The semantics and ordering of the coordinate values are consistent
2169  * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
2170  * cairo_close_path().
2171  *
2172  * Here is sample code for iterating through a #cairo_path_t:
2173  *
2174  * <informalexample><programlisting>
2175  *      int i;
2176  *      cairo_path_t *path;
2177  *      cairo_path_data_t *data;
2178  * &nbsp;
2179  *      path = cairo_copy_path (cr);
2180  * &nbsp;
2181  *      for (i=0; i < path->num_data; i += path->data[i].header.length) {
2182  *          data = &amp;path->data[i];
2183  *          switch (data->header.type) {
2184  *          case CAIRO_PATH_MOVE_TO:
2185  *              do_move_to_things (data[1].point.x, data[1].point.y);
2186  *              break;
2187  *          case CAIRO_PATH_LINE_TO:
2188  *              do_line_to_things (data[1].point.x, data[1].point.y);
2189  *              break;
2190  *          case CAIRO_PATH_CURVE_TO:
2191  *              do_curve_to_things (data[1].point.x, data[1].point.y,
2192  *                                  data[2].point.x, data[2].point.y,
2193  *                                  data[3].point.x, data[3].point.y);
2194  *              break;
2195  *          case CAIRO_PATH_CLOSE_PATH:
2196  *              do_close_path_things ();
2197  *              break;
2198  *          }
2199  *      }
2200  *      cairo_path_destroy (path);
2201  * </programlisting></informalexample>
2202  *
2203  * As of cairo 1.4, cairo does not mind if there are more elements in
2204  * a portion of the path than needed.  Such elements can be used by
2205  * users of the cairo API to hold extra values in the path data
2206  * structure.  For this reason, it is recommended that applications
2207  * always use <literal>data->header.length</literal> to
2208  * iterate over the path data, instead of hardcoding the number of
2209  * elements for each element type.
2210  *
2211  * Since: 1.0
2212  **/
2213 typedef union _cairo_path_data_t cairo_path_data_t;
2214 union _cairo_path_data_t {
2215     struct {
2216     cairo_path_data_type_t type;
2217     int length;
2218     } header;
2219     struct {
2220     double x, y;
2221     } point;
2222 };
2223 
2224 /**
2225  * cairo_path_t:
2226  * @status: the current error status
2227  * @data: the elements in the path
2228  * @num_data: the number of elements in the data array
2229  *
2230  * A data structure for holding a path. This data structure serves as
2231  * the return value for cairo_copy_path() and
2232  * cairo_copy_path_flat() as well the input value for
2233  * cairo_append_path().
2234  *
2235  * See #cairo_path_data_t for hints on how to iterate over the
2236  * actual data within the path.
2237  *
2238  * The num_data member gives the number of elements in the data
2239  * array. This number is larger than the number of independent path
2240  * portions (defined in #cairo_path_data_type_t), since the data
2241  * includes both headers and coordinates for each portion.
2242  *
2243  * Since: 1.0
2244  **/
2245 typedef struct cairo_path {
2246     cairo_status_t status;
2247     cairo_path_data_t *data;
2248     int num_data;
2249 } cairo_path_t;
2250 
2251 cairo_public cairo_path_t *
2252 cairo_copy_path (cairo_t *cr);
2253 
2254 cairo_public cairo_path_t *
2255 cairo_copy_path_flat (cairo_t *cr);
2256 
2257 cairo_public void
2258 cairo_append_path (cairo_t      *cr,
2259            const cairo_path_t   *path);
2260 
2261 cairo_public void
2262 cairo_path_destroy (cairo_path_t *path);
2263 
2264 /* Error status queries */
2265 
2266 cairo_public cairo_status_t
2267 cairo_status (cairo_t *cr);
2268 
2269 cairo_public const char *
2270 cairo_status_to_string (cairo_status_t status);
2271 
2272 /* Backend device manipulation */
2273 
2274 cairo_public cairo_device_t *
2275 cairo_device_reference (cairo_device_t *device);
2276 
2277 /**
2278  * cairo_device_type_t:
2279  * @CAIRO_DEVICE_TYPE_DRM: The device is of type Direct Render Manager, since 1.10
2280  * @CAIRO_DEVICE_TYPE_GL: The device is of type OpenGL, since 1.10
2281  * @CAIRO_DEVICE_TYPE_SCRIPT: The device is of type script, since 1.10
2282  * @CAIRO_DEVICE_TYPE_XCB: The device is of type xcb, since 1.10
2283  * @CAIRO_DEVICE_TYPE_XLIB: The device is of type xlib, since 1.10
2284  * @CAIRO_DEVICE_TYPE_XML: The device is of type XML, since 1.10
2285  * @CAIRO_DEVICE_TYPE_COGL: The device is of type cogl, since 1.12
2286  * @CAIRO_DEVICE_TYPE_WIN32: The device is of type win32, since 1.12
2287  * @CAIRO_DEVICE_TYPE_INVALID: The device is invalid, since 1.10
2288  *
2289  * #cairo_device_type_t is used to describe the type of a given
2290  * device. The devices types are also known as "backends" within cairo.
2291  *
2292  * The device type can be queried with cairo_device_get_type()
2293  *
2294  * The various #cairo_device_t functions can be used with devices of
2295  * any type, but some backends also provide type-specific functions
2296  * that must only be called with a device of the appropriate
2297  * type. These functions have names that begin with
2298  * <literal>cairo_<emphasis>type</emphasis>_device</literal> such as
2299  * cairo_xcb_device_debug_cap_xrender_version().
2300  *
2301  * The behavior of calling a type-specific function with a device of
2302  * the wrong type is undefined.
2303  *
2304  * New entries may be added in future versions.
2305  *
2306  * Since: 1.10
2307  **/
2308 typedef enum _cairo_device_type {
2309     CAIRO_DEVICE_TYPE_DRM,
2310     CAIRO_DEVICE_TYPE_GL,
2311     CAIRO_DEVICE_TYPE_SCRIPT,
2312     CAIRO_DEVICE_TYPE_XCB,
2313     CAIRO_DEVICE_TYPE_XLIB,
2314     CAIRO_DEVICE_TYPE_XML,
2315     CAIRO_DEVICE_TYPE_COGL,
2316     CAIRO_DEVICE_TYPE_WIN32,
2317 
2318     CAIRO_DEVICE_TYPE_INVALID = -1
2319 } cairo_device_type_t;
2320 
2321 cairo_public cairo_device_type_t
2322 cairo_device_get_type (cairo_device_t *device);
2323 
2324 cairo_public cairo_status_t
2325 cairo_device_status (cairo_device_t *device);
2326 
2327 cairo_public cairo_status_t
2328 cairo_device_acquire (cairo_device_t *device);
2329 
2330 cairo_public void
2331 cairo_device_release (cairo_device_t *device);
2332 
2333 cairo_public void
2334 cairo_device_flush (cairo_device_t *device);
2335 
2336 cairo_public void
2337 cairo_device_finish (cairo_device_t *device);
2338 
2339 cairo_public void
2340 cairo_device_destroy (cairo_device_t *device);
2341 
2342 cairo_public unsigned int
2343 cairo_device_get_reference_count (cairo_device_t *device);
2344 
2345 cairo_public void *
2346 cairo_device_get_user_data (cairo_device_t       *device,
2347                 const cairo_user_data_key_t *key);
2348 
2349 cairo_public cairo_status_t
2350 cairo_device_set_user_data (cairo_device_t       *device,
2351                 const cairo_user_data_key_t *key,
2352                 void             *user_data,
2353                 cairo_destroy_func_t      destroy);
2354 
2355 
2356 /* Surface manipulation */
2357 
2358 cairo_public cairo_surface_t *
2359 cairo_surface_create_similar (cairo_surface_t  *other,
2360                   cairo_content_t   content,
2361                   int       width,
2362                   int       height);
2363 
2364 cairo_public cairo_surface_t *
2365 cairo_surface_create_similar_image (cairo_surface_t  *other,
2366                     cairo_format_t    format,
2367                     int     width,
2368                     int     height);
2369 
2370 cairo_public cairo_surface_t *
2371 cairo_surface_map_to_image (cairo_surface_t  *surface,
2372                 const cairo_rectangle_int_t *extents);
2373 
2374 cairo_public void
2375 cairo_surface_unmap_image (cairo_surface_t *surface,
2376                cairo_surface_t *image);
2377 
2378 cairo_public cairo_surface_t *
2379 cairo_surface_create_for_rectangle (cairo_surface_t *target,
2380                                     double       x,
2381                                     double       y,
2382                                     double       width,
2383                                     double       height);
2384 
2385 /**
2386  * cairo_surface_observer_mode_t:
2387  * @CAIRO_SURFACE_OBSERVER_NORMAL: no recording is done
2388  * @CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS: operations are recorded
2389  *
2390  * Whether operations should be recorded.
2391  *
2392  * Since: 1.12
2393  **/
2394 typedef enum {
2395     CAIRO_SURFACE_OBSERVER_NORMAL = 0,
2396     CAIRO_SURFACE_OBSERVER_RECORD_OPERATIONS = 0x1
2397 } cairo_surface_observer_mode_t;
2398 
2399 cairo_public cairo_surface_t *
2400 cairo_surface_create_observer (cairo_surface_t *target,
2401                    cairo_surface_observer_mode_t mode);
2402 
2403 /**
2404  * cairo_surface_observer_callback_t:
2405  * @observer: the #cairo_surface_observer_t
2406  * @target: the observed surface
2407  * @data: closure used when adding the callback
2408  *
2409  * A generic callback function for surface operations.
2410  *
2411  * Since: 1.12
2412  **/
2413 typedef void (*cairo_surface_observer_callback_t) (cairo_surface_t *observer,
2414                            cairo_surface_t *target,
2415                            void *data);
2416 
2417 cairo_public cairo_status_t
2418 cairo_surface_observer_add_paint_callback (cairo_surface_t *abstract_surface,
2419                        cairo_surface_observer_callback_t func,
2420                        void *data);
2421 
2422 cairo_public cairo_status_t
2423 cairo_surface_observer_add_mask_callback (cairo_surface_t *abstract_surface,
2424                       cairo_surface_observer_callback_t func,
2425                       void *data);
2426 
2427 cairo_public cairo_status_t
2428 cairo_surface_observer_add_fill_callback (cairo_surface_t *abstract_surface,
2429                       cairo_surface_observer_callback_t func,
2430                       void *data);
2431 
2432 cairo_public cairo_status_t
2433 cairo_surface_observer_add_stroke_callback (cairo_surface_t *abstract_surface,
2434                         cairo_surface_observer_callback_t func,
2435                         void *data);
2436 
2437 cairo_public cairo_status_t
2438 cairo_surface_observer_add_glyphs_callback (cairo_surface_t *abstract_surface,
2439                         cairo_surface_observer_callback_t func,
2440                         void *data);
2441 
2442 cairo_public cairo_status_t
2443 cairo_surface_observer_add_flush_callback (cairo_surface_t *abstract_surface,
2444                        cairo_surface_observer_callback_t func,
2445                        void *data);
2446 
2447 cairo_public cairo_status_t
2448 cairo_surface_observer_add_finish_callback (cairo_surface_t *abstract_surface,
2449                         cairo_surface_observer_callback_t func,
2450                         void *data);
2451 
2452 cairo_public cairo_status_t
2453 cairo_surface_observer_print (cairo_surface_t *abstract_surface,
2454                   cairo_write_func_t write_func,
2455                   void *closure);
2456 cairo_public double
2457 cairo_surface_observer_elapsed (cairo_surface_t *abstract_surface);
2458 
2459 cairo_public cairo_status_t
2460 cairo_device_observer_print (cairo_device_t *abstract_device,
2461                  cairo_write_func_t write_func,
2462                  void *closure);
2463 
2464 cairo_public double
2465 cairo_device_observer_elapsed (cairo_device_t *abstract_device);
2466 
2467 cairo_public double
2468 cairo_device_observer_paint_elapsed (cairo_device_t *abstract_device);
2469 
2470 cairo_public double
2471 cairo_device_observer_mask_elapsed (cairo_device_t *abstract_device);
2472 
2473 cairo_public double
2474 cairo_device_observer_fill_elapsed (cairo_device_t *abstract_device);
2475 
2476 cairo_public double
2477 cairo_device_observer_stroke_elapsed (cairo_device_t *abstract_device);
2478 
2479 cairo_public double
2480 cairo_device_observer_glyphs_elapsed (cairo_device_t *abstract_device);
2481 
2482 cairo_public cairo_surface_t *
2483 cairo_surface_reference (cairo_surface_t *surface);
2484 
2485 cairo_public void
2486 cairo_surface_finish (cairo_surface_t *surface);
2487 
2488 cairo_public void
2489 cairo_surface_destroy (cairo_surface_t *surface);
2490 
2491 cairo_public cairo_device_t *
2492 cairo_surface_get_device (cairo_surface_t *surface);
2493 
2494 cairo_public unsigned int
2495 cairo_surface_get_reference_count (cairo_surface_t *surface);
2496 
2497 cairo_public cairo_status_t
2498 cairo_surface_status (cairo_surface_t *surface);
2499 
2500 /**
2501  * cairo_surface_type_t:
2502  * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image, since 1.2
2503  * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf, since 1.2
2504  * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps, since 1.2
2505  * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib, since 1.2
2506  * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb, since 1.2
2507  * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz, since 1.2, deprecated 1.18
2508  *   (glitz support have been removed, this surface type will never be set by cairo)
2509  * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz, since 1.2
2510  * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32, since 1.2
2511  * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos, since 1.2, deprecated 1.18
2512  *   (beos support have been removed, this surface type will never be set by cairo)
2513  * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb, since 1.2, deprecated 1.18
2514  *   (directfb support have been removed, this surface type will never be set by cairo)
2515  * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg, since 1.2
2516  * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2, since 1.4, deprecated 1.18
2517  *   (os2 support have been removed, this surface type will never be set by cairo)
2518  * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface, since 1.6
2519  * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image, since 1.6
2520  * @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10
2521  * @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10, deprecated 1.18
2522  *   (Ot support have been removed, this surface type will never be set by cairo)
2523  * @CAIRO_SURFACE_TYPE_RECORDING: The surface is of type recording, since 1.10
2524  * @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10, deprecated 1.18
2525  *   (OpenVG support have been removed, this surface type will never be set by cairo)
2526  * @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10, deprecated 1.18
2527  *   (OpenGL support have been removed, this surface type will never be set by cairo)
2528  * @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10, deprecated 1.18
2529  *   (DRM support have been removed, this surface type will never be set by cairo)
2530  * @CAIRO_SURFACE_TYPE_TEE: The surface is of type 'tee' (a multiplexing surface), since 1.10
2531  * @CAIRO_SURFACE_TYPE_XML: The surface is of type XML (for debugging), since 1.10
2532  * @CAIRO_SURFACE_TYPE_SKIA: The surface is of type Skia, since 1.10, deprecated 1.18
2533  *   (Skia support have been removed, this surface type will never be set by cairo)
2534  * @CAIRO_SURFACE_TYPE_SUBSURFACE: The surface is a subsurface created with
2535  *   cairo_surface_create_for_rectangle(), since 1.10
2536  * @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12, deprecated 1.18
2537  *   (Cogl support have been removed, this surface type will never be set by cairo)
2538  *
2539  * #cairo_surface_type_t is used to describe the type of a given
2540  * surface. The surface types are also known as "backends" or "surface
2541  * backends" within cairo.
2542  *
2543  * The type of a surface is determined by the function used to create
2544  * it, which will generally be of the form
2545  * <function>cairo_<emphasis>type</emphasis>_surface_create(<!-- -->)</function>,
2546  * (though see cairo_surface_create_similar() as well).
2547  *
2548  * The surface type can be queried with cairo_surface_get_type()
2549  *
2550  * The various #cairo_surface_t functions can be used with surfaces of
2551  * any type, but some backends also provide type-specific functions
2552  * that must only be called with a surface of the appropriate
2553  * type. These functions have names that begin with
2554  * <literal>cairo_<emphasis>type</emphasis>_surface</literal> such as cairo_image_surface_get_width().
2555  *
2556  * The behavior of calling a type-specific function with a surface of
2557  * the wrong type is undefined.
2558  *
2559  * New entries may be added in future versions.
2560  *
2561  * Since: 1.2
2562  **/
2563 typedef enum _cairo_surface_type {
2564     CAIRO_SURFACE_TYPE_IMAGE,
2565     CAIRO_SURFACE_TYPE_PDF,
2566     CAIRO_SURFACE_TYPE_PS,
2567     CAIRO_SURFACE_TYPE_XLIB,
2568     CAIRO_SURFACE_TYPE_XCB,
2569     CAIRO_SURFACE_TYPE_GLITZ,
2570     CAIRO_SURFACE_TYPE_QUARTZ,
2571     CAIRO_SURFACE_TYPE_WIN32,
2572     CAIRO_SURFACE_TYPE_BEOS,
2573     CAIRO_SURFACE_TYPE_DIRECTFB,
2574     CAIRO_SURFACE_TYPE_SVG,
2575     CAIRO_SURFACE_TYPE_OS2,
2576     CAIRO_SURFACE_TYPE_WIN32_PRINTING,
2577     CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
2578     CAIRO_SURFACE_TYPE_SCRIPT,
2579     CAIRO_SURFACE_TYPE_QT,
2580     CAIRO_SURFACE_TYPE_RECORDING,
2581     CAIRO_SURFACE_TYPE_VG,
2582     CAIRO_SURFACE_TYPE_GL,
2583     CAIRO_SURFACE_TYPE_DRM,
2584     CAIRO_SURFACE_TYPE_TEE,
2585     CAIRO_SURFACE_TYPE_XML,
2586     CAIRO_SURFACE_TYPE_SKIA,
2587     CAIRO_SURFACE_TYPE_SUBSURFACE,
2588     CAIRO_SURFACE_TYPE_COGL
2589 } cairo_surface_type_t;
2590 
2591 cairo_public cairo_surface_type_t
2592 cairo_surface_get_type (cairo_surface_t *surface);
2593 
2594 cairo_public cairo_content_t
2595 cairo_surface_get_content (cairo_surface_t *surface);
2596 
2597 #if CAIRO_HAS_PNG_FUNCTIONS
2598 
2599 cairo_public cairo_status_t
2600 cairo_surface_write_to_png (cairo_surface_t *surface,
2601                 const char      *filename);
2602 
2603 cairo_public cairo_status_t
2604 cairo_surface_write_to_png_stream (cairo_surface_t  *surface,
2605                    cairo_write_func_t   write_func,
2606                    void         *closure);
2607 
2608 #endif
2609 
2610 cairo_public void *
2611 cairo_surface_get_user_data (cairo_surface_t         *surface,
2612                  const cairo_user_data_key_t *key);
2613 
2614 cairo_public cairo_status_t
2615 cairo_surface_set_user_data (cairo_surface_t         *surface,
2616                  const cairo_user_data_key_t *key,
2617                  void            *user_data,
2618                  cairo_destroy_func_t    destroy);
2619 
2620 #define CAIRO_MIME_TYPE_JPEG "image/jpeg"
2621 #define CAIRO_MIME_TYPE_PNG "image/png"
2622 #define CAIRO_MIME_TYPE_JP2 "image/jp2"
2623 #define CAIRO_MIME_TYPE_URI "text/x-uri"
2624 #define CAIRO_MIME_TYPE_UNIQUE_ID "application/x-cairo.uuid"
2625 #define CAIRO_MIME_TYPE_JBIG2 "application/x-cairo.jbig2"
2626 #define CAIRO_MIME_TYPE_JBIG2_GLOBAL "application/x-cairo.jbig2-global"
2627 #define CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID "application/x-cairo.jbig2-global-id"
2628 #define CAIRO_MIME_TYPE_CCITT_FAX "image/g3fax"
2629 #define CAIRO_MIME_TYPE_CCITT_FAX_PARAMS "application/x-cairo.ccitt.params"
2630 #define CAIRO_MIME_TYPE_EPS "application/postscript"
2631 #define CAIRO_MIME_TYPE_EPS_PARAMS "application/x-cairo.eps.params"
2632 
2633 cairo_public void
2634 cairo_surface_get_mime_data (cairo_surface_t        *surface,
2635                              const char         *mime_type,
2636                              const unsigned char       **data,
2637                              unsigned long      *length);
2638 
2639 cairo_public cairo_status_t
2640 cairo_surface_set_mime_data (cairo_surface_t        *surface,
2641                              const char         *mime_type,
2642                              const unsigned char    *data,
2643                              unsigned long       length,
2644                  cairo_destroy_func_t    destroy,
2645                  void           *closure);
2646 
2647 cairo_public cairo_bool_t
2648 cairo_surface_supports_mime_type (cairo_surface_t       *surface,
2649                   const char                *mime_type);
2650 
2651 cairo_public void
2652 cairo_surface_get_font_options (cairo_surface_t      *surface,
2653                 cairo_font_options_t *options);
2654 
2655 cairo_public void
2656 cairo_surface_flush (cairo_surface_t *surface);
2657 
2658 cairo_public void
2659 cairo_surface_mark_dirty (cairo_surface_t *surface);
2660 
2661 cairo_public void
2662 cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
2663                     int              x,
2664                     int              y,
2665                     int              width,
2666                     int              height);
2667 
2668 cairo_public void
2669 cairo_surface_set_device_scale (cairo_surface_t *surface,
2670                 double           x_scale,
2671                 double           y_scale);
2672 
2673 cairo_public void
2674 cairo_surface_get_device_scale (cairo_surface_t *surface,
2675                 double          *x_scale,
2676                 double          *y_scale);
2677 
2678 cairo_public void
2679 cairo_surface_set_device_offset (cairo_surface_t *surface,
2680                  double           x_offset,
2681                  double           y_offset);
2682 
2683 cairo_public void
2684 cairo_surface_get_device_offset (cairo_surface_t *surface,
2685                  double          *x_offset,
2686                  double          *y_offset);
2687 
2688 cairo_public void
2689 cairo_surface_set_fallback_resolution (cairo_surface_t  *surface,
2690                        double        x_pixels_per_inch,
2691                        double        y_pixels_per_inch);
2692 
2693 cairo_public void
2694 cairo_surface_get_fallback_resolution (cairo_surface_t  *surface,
2695                        double       *x_pixels_per_inch,
2696                        double       *y_pixels_per_inch);
2697 
2698 cairo_public void
2699 cairo_surface_copy_page (cairo_surface_t *surface);
2700 
2701 cairo_public void
2702 cairo_surface_show_page (cairo_surface_t *surface);
2703 
2704 cairo_public cairo_bool_t
2705 cairo_surface_has_show_text_glyphs (cairo_surface_t *surface);
2706 
2707 /* Image-surface functions */
2708 
2709 cairo_public cairo_surface_t *
2710 cairo_image_surface_create (cairo_format_t  format,
2711                 int         width,
2712                 int         height);
2713 
2714 cairo_public int
2715 cairo_format_stride_for_width (cairo_format_t   format,
2716                    int      width);
2717 
2718 cairo_public cairo_surface_t *
2719 cairo_image_surface_create_for_data (unsigned char         *data,
2720                      cairo_format_t     format,
2721                      int            width,
2722                      int            height,
2723                      int            stride);
2724 
2725 cairo_public unsigned char *
2726 cairo_image_surface_get_data (cairo_surface_t *surface);
2727 
2728 cairo_public cairo_format_t
2729 cairo_image_surface_get_format (cairo_surface_t *surface);
2730 
2731 cairo_public int
2732 cairo_image_surface_get_width (cairo_surface_t *surface);
2733 
2734 cairo_public int
2735 cairo_image_surface_get_height (cairo_surface_t *surface);
2736 
2737 cairo_public int
2738 cairo_image_surface_get_stride (cairo_surface_t *surface);
2739 
2740 #if CAIRO_HAS_PNG_FUNCTIONS
2741 
2742 cairo_public cairo_surface_t *
2743 cairo_image_surface_create_from_png (const char *filename);
2744 
2745 cairo_public cairo_surface_t *
2746 cairo_image_surface_create_from_png_stream (cairo_read_func_t   read_func,
2747                         void        *closure);
2748 
2749 #endif
2750 
2751 /* Recording-surface functions */
2752 
2753 cairo_public cairo_surface_t *
2754 cairo_recording_surface_create (cairo_content_t      content,
2755                                 const cairo_rectangle_t *extents);
2756 
2757 cairo_public void
2758 cairo_recording_surface_ink_extents (cairo_surface_t *surface,
2759                                      double *x0,
2760                                      double *y0,
2761                                      double *width,
2762                                      double *height);
2763 
2764 cairo_public cairo_bool_t
2765 cairo_recording_surface_get_extents (cairo_surface_t *surface,
2766                      cairo_rectangle_t *extents);
2767 
2768 /* raster-source pattern (callback) functions */
2769 
2770 /**
2771  * cairo_raster_source_acquire_func_t:
2772  * @pattern: the pattern being rendered from
2773  * @callback_data: the user data supplied during creation
2774  * @target: the rendering target surface
2775  * @extents: rectangular region of interest in pixels in sample space
2776  *
2777  * #cairo_raster_source_acquire_func_t is the type of function which is
2778  * called when a pattern is being rendered from. It should create a surface
2779  * that provides the pixel data for the region of interest as defined by
2780  * extents, though the surface itself does not have to be limited to that
2781  * area. For convenience the surface should probably be of image type,
2782  * created with cairo_surface_create_similar_image() for the target (which
2783  * enables the number of copies to be reduced during transfer to the
2784  * device). Another option, might be to return a similar surface to the
2785  * target for explicit handling by the application of a set of cached sources
2786  * on the device. The region of sample data provided should be defined using
2787  * cairo_surface_set_device_offset() to specify the top-left corner of the
2788  * sample data (along with width and height of the surface).
2789  *
2790  * Returns: a #cairo_surface_t
2791  *
2792  * Since: 1.12
2793  **/
2794 typedef cairo_surface_t *
2795 (*cairo_raster_source_acquire_func_t) (cairo_pattern_t *pattern,
2796                        void *callback_data,
2797                        cairo_surface_t *target,
2798                        const cairo_rectangle_int_t *extents);
2799 
2800 /**
2801  * cairo_raster_source_release_func_t:
2802  * @pattern: the pattern being rendered from
2803  * @callback_data: the user data supplied during creation
2804  * @surface: the surface created during acquire
2805  *
2806  * #cairo_raster_source_release_func_t is the type of function which is
2807  * called when the pixel data is no longer being access by the pattern
2808  * for the rendering operation. Typically this function will simply
2809  * destroy the surface created during acquire.
2810  *
2811  * Since: 1.12
2812  **/
2813 typedef void
2814 (*cairo_raster_source_release_func_t) (cairo_pattern_t *pattern,
2815                        void *callback_data,
2816                        cairo_surface_t *surface);
2817 
2818 /**
2819  * cairo_raster_source_snapshot_func_t:
2820  * @pattern: the pattern being rendered from
2821  * @callback_data: the user data supplied during creation
2822  *
2823  * #cairo_raster_source_snapshot_func_t is the type of function which is
2824  * called when the pixel data needs to be preserved for later use
2825  * during printing. This pattern will be accessed again later, and it
2826  * is expected to provide the pixel data that was current at the time
2827  * of snapshotting.
2828  *
2829  * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
2830  * #cairo_status_t error codes for failure.
2831  *
2832  * Since: 1.12
2833  **/
2834 typedef cairo_status_t
2835 (*cairo_raster_source_snapshot_func_t) (cairo_pattern_t *pattern,
2836                     void *callback_data);
2837 
2838 /**
2839  * cairo_raster_source_copy_func_t:
2840  * @pattern: the #cairo_pattern_t that was copied to
2841  * @callback_data: the user data supplied during creation
2842  * @other: the #cairo_pattern_t being used as the source for the copy
2843  *
2844  * #cairo_raster_source_copy_func_t is the type of function which is
2845  * called when the pattern gets copied as a normal part of rendering.
2846  *
2847  * Return value: CAIRO_STATUS_SUCCESS on success, or one of the
2848  * #cairo_status_t error codes for failure.
2849  *
2850  * Since: 1.12
2851  **/
2852 typedef cairo_status_t
2853 (*cairo_raster_source_copy_func_t) (cairo_pattern_t *pattern,
2854                     void *callback_data,
2855                     const cairo_pattern_t *other);
2856 
2857 /**
2858  * cairo_raster_source_finish_func_t:
2859  * @pattern: the pattern being rendered from
2860  * @callback_data: the user data supplied during creation
2861  *
2862  * #cairo_raster_source_finish_func_t is the type of function which is
2863  * called when the pattern (or a copy thereof) is no longer required.
2864  *
2865  * Since: 1.12
2866  **/
2867 typedef void
2868 (*cairo_raster_source_finish_func_t) (cairo_pattern_t *pattern,
2869                       void *callback_data);
2870 
2871 cairo_public cairo_pattern_t *
2872 cairo_pattern_create_raster_source (void *user_data,
2873                     cairo_content_t content,
2874                     int width, int height);
2875 
2876 cairo_public void
2877 cairo_raster_source_pattern_set_callback_data (cairo_pattern_t *pattern,
2878                            void *data);
2879 
2880 cairo_public void *
2881 cairo_raster_source_pattern_get_callback_data (cairo_pattern_t *pattern);
2882 
2883 cairo_public void
2884 cairo_raster_source_pattern_set_acquire (cairo_pattern_t *pattern,
2885                      cairo_raster_source_acquire_func_t acquire,
2886                      cairo_raster_source_release_func_t release);
2887 
2888 cairo_public void
2889 cairo_raster_source_pattern_get_acquire (cairo_pattern_t *pattern,
2890                      cairo_raster_source_acquire_func_t *acquire,
2891                      cairo_raster_source_release_func_t *release);
2892 cairo_public void
2893 cairo_raster_source_pattern_set_snapshot (cairo_pattern_t *pattern,
2894                       cairo_raster_source_snapshot_func_t snapshot);
2895 
2896 cairo_public cairo_raster_source_snapshot_func_t
2897 cairo_raster_source_pattern_get_snapshot (cairo_pattern_t *pattern);
2898 
2899 cairo_public void
2900 cairo_raster_source_pattern_set_copy (cairo_pattern_t *pattern,
2901                       cairo_raster_source_copy_func_t copy);
2902 
2903 cairo_public cairo_raster_source_copy_func_t
2904 cairo_raster_source_pattern_get_copy (cairo_pattern_t *pattern);
2905 
2906 cairo_public void
2907 cairo_raster_source_pattern_set_finish (cairo_pattern_t *pattern,
2908                     cairo_raster_source_finish_func_t finish);
2909 
2910 cairo_public cairo_raster_source_finish_func_t
2911 cairo_raster_source_pattern_get_finish (cairo_pattern_t *pattern);
2912 
2913 /* Pattern creation functions */
2914 
2915 cairo_public cairo_pattern_t *
2916 cairo_pattern_create_rgb (double red, double green, double blue);
2917 
2918 cairo_public cairo_pattern_t *
2919 cairo_pattern_create_rgba (double red, double green, double blue,
2920                double alpha);
2921 
2922 cairo_public cairo_pattern_t *
2923 cairo_pattern_create_for_surface (cairo_surface_t *surface);
2924 
2925 cairo_public cairo_pattern_t *
2926 cairo_pattern_create_linear (double x0, double y0,
2927                  double x1, double y1);
2928 
2929 cairo_public cairo_pattern_t *
2930 cairo_pattern_create_radial (double cx0, double cy0, double radius0,
2931                  double cx1, double cy1, double radius1);
2932 
2933 cairo_public cairo_pattern_t *
2934 cairo_pattern_create_mesh (void);
2935 
2936 cairo_public cairo_pattern_t *
2937 cairo_pattern_reference (cairo_pattern_t *pattern);
2938 
2939 cairo_public void
2940 cairo_pattern_destroy (cairo_pattern_t *pattern);
2941 
2942 cairo_public unsigned int
2943 cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
2944 
2945 cairo_public cairo_status_t
2946 cairo_pattern_status (cairo_pattern_t *pattern);
2947 
2948 cairo_public void *
2949 cairo_pattern_get_user_data (cairo_pattern_t         *pattern,
2950                  const cairo_user_data_key_t *key);
2951 
2952 cairo_public cairo_status_t
2953 cairo_pattern_set_user_data (cairo_pattern_t         *pattern,
2954                  const cairo_user_data_key_t *key,
2955                  void            *user_data,
2956                  cairo_destroy_func_t     destroy);
2957 
2958 /**
2959  * cairo_pattern_type_t:
2960  * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
2961  * color. It may be opaque or translucent, since 1.2.
2962  * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image), since 1.2.
2963  * @CAIRO_PATTERN_TYPE_LINEAR: The pattern is a linear gradient, since 1.2.
2964  * @CAIRO_PATTERN_TYPE_RADIAL: The pattern is a radial gradient, since 1.2.
2965  * @CAIRO_PATTERN_TYPE_MESH: The pattern is a mesh, since 1.12.
2966  * @CAIRO_PATTERN_TYPE_RASTER_SOURCE: The pattern is a user pattern providing raster data, since 1.12.
2967  *
2968  * #cairo_pattern_type_t is used to describe the type of a given pattern.
2969  *
2970  * The type of a pattern is determined by the function used to create
2971  * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
2972  * functions create SOLID patterns. The remaining
2973  * cairo_pattern_create<!-- --> functions map to pattern types in obvious
2974  * ways.
2975  *
2976  * The pattern type can be queried with cairo_pattern_get_type()
2977  *
2978  * Most #cairo_pattern_t functions can be called with a pattern of any
2979  * type, (though trying to change the extend or filter for a solid
2980  * pattern will have no effect). A notable exception is
2981  * cairo_pattern_add_color_stop_rgb() and
2982  * cairo_pattern_add_color_stop_rgba() which must only be called with
2983  * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
2984  * will be shutdown and put into an error state.
2985  *
2986  * New entries may be added in future versions.
2987  *
2988  * Since: 1.2
2989  **/
2990 typedef enum _cairo_pattern_type {
2991     CAIRO_PATTERN_TYPE_SOLID,
2992     CAIRO_PATTERN_TYPE_SURFACE,
2993     CAIRO_PATTERN_TYPE_LINEAR,
2994     CAIRO_PATTERN_TYPE_RADIAL,
2995     CAIRO_PATTERN_TYPE_MESH,
2996     CAIRO_PATTERN_TYPE_RASTER_SOURCE
2997 } cairo_pattern_type_t;
2998 
2999 cairo_public cairo_pattern_type_t
3000 cairo_pattern_get_type (cairo_pattern_t *pattern);
3001 
3002 cairo_public void
3003 cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
3004                   double offset,
3005                   double red, double green, double blue);
3006 
3007 cairo_public void
3008 cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
3009                    double offset,
3010                    double red, double green, double blue,
3011                    double alpha);
3012 
3013 cairo_public void
3014 cairo_mesh_pattern_begin_patch (cairo_pattern_t *pattern);
3015 
3016 cairo_public void
3017 cairo_mesh_pattern_end_patch (cairo_pattern_t *pattern);
3018 
3019 cairo_public void
3020 cairo_mesh_pattern_curve_to (cairo_pattern_t *pattern,
3021                  double x1, double y1,
3022                  double x2, double y2,
3023                  double x3, double y3);
3024 
3025 cairo_public void
3026 cairo_mesh_pattern_line_to (cairo_pattern_t *pattern,
3027                 double x, double y);
3028 
3029 cairo_public void
3030 cairo_mesh_pattern_move_to (cairo_pattern_t *pattern,
3031                 double x, double y);
3032 
3033 cairo_public void
3034 cairo_mesh_pattern_set_control_point (cairo_pattern_t *pattern,
3035                       unsigned int point_num,
3036                       double x, double y);
3037 
3038 cairo_public void
3039 cairo_mesh_pattern_set_corner_color_rgb (cairo_pattern_t *pattern,
3040                      unsigned int corner_num,
3041                      double red, double green, double blue);
3042 
3043 cairo_public void
3044 cairo_mesh_pattern_set_corner_color_rgba (cairo_pattern_t *pattern,
3045                       unsigned int corner_num,
3046                       double red, double green, double blue,
3047                       double alpha);
3048 
3049 cairo_public void
3050 cairo_pattern_set_matrix (cairo_pattern_t      *pattern,
3051               const cairo_matrix_t *matrix);
3052 
3053 cairo_public void
3054 cairo_pattern_get_matrix (cairo_pattern_t *pattern,
3055               cairo_matrix_t  *matrix);
3056 
3057 /**
3058  * cairo_extend_t:
3059  * @CAIRO_EXTEND_NONE: pixels outside of the source pattern
3060  *   are fully transparent (Since 1.0)
3061  * @CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating (Since 1.0)
3062  * @CAIRO_EXTEND_REFLECT: the pattern is tiled by reflecting
3063  *   at the edges (Since 1.0; but only implemented for surface patterns since 1.6)
3064  * @CAIRO_EXTEND_PAD: pixels outside of the pattern copy
3065  *   the closest pixel from the source (Since 1.2; but only
3066  *   implemented for surface patterns since 1.6)
3067  *
3068  * #cairo_extend_t is used to describe how pattern color/alpha will be
3069  * determined for areas "outside" the pattern's natural area, (for
3070  * example, outside the surface bounds or outside the gradient
3071  * geometry).
3072  *
3073  * Mesh patterns are not affected by the extend mode.
3074  *
3075  * The default extend mode is %CAIRO_EXTEND_NONE for surface patterns
3076  * and %CAIRO_EXTEND_PAD for gradient patterns.
3077  *
3078  * New entries may be added in future versions.
3079  *
3080  * Since: 1.0
3081  **/
3082 typedef enum _cairo_extend {
3083     CAIRO_EXTEND_NONE,
3084     CAIRO_EXTEND_REPEAT,
3085     CAIRO_EXTEND_REFLECT,
3086     CAIRO_EXTEND_PAD
3087 } cairo_extend_t;
3088 
3089 cairo_public void
3090 cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
3091 
3092 cairo_public cairo_extend_t
3093 cairo_pattern_get_extend (cairo_pattern_t *pattern);
3094 
3095 /**
3096  * cairo_filter_t:
3097  * @CAIRO_FILTER_FAST: A high-performance filter, with quality similar
3098  *     to %CAIRO_FILTER_NEAREST (Since 1.0)
3099  * @CAIRO_FILTER_GOOD: A reasonable-performance filter, with quality
3100  *     similar to %CAIRO_FILTER_BILINEAR (Since 1.0)
3101  * @CAIRO_FILTER_BEST: The highest-quality available, performance may
3102  *     not be suitable for interactive use. (Since 1.0)
3103  * @CAIRO_FILTER_NEAREST: Nearest-neighbor filtering (Since 1.0)
3104  * @CAIRO_FILTER_BILINEAR: Linear interpolation in two dimensions (Since 1.0)
3105  * @CAIRO_FILTER_GAUSSIAN: This filter value is currently
3106  *     unimplemented, and should not be used in current code. (Since 1.0)
3107  *
3108  * #cairo_filter_t is used to indicate what filtering should be
3109  * applied when reading pixel values from patterns. See
3110  * cairo_pattern_set_filter() for indicating the desired filter to be
3111  * used with a particular pattern.
3112  *
3113  * Since: 1.0
3114  **/
3115 typedef enum _cairo_filter {
3116     CAIRO_FILTER_FAST,
3117     CAIRO_FILTER_GOOD,
3118     CAIRO_FILTER_BEST,
3119     CAIRO_FILTER_NEAREST,
3120     CAIRO_FILTER_BILINEAR,
3121     CAIRO_FILTER_GAUSSIAN
3122 } cairo_filter_t;
3123 
3124 cairo_public void
3125 cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
3126 
3127 cairo_public cairo_filter_t
3128 cairo_pattern_get_filter (cairo_pattern_t *pattern);
3129 
3130 cairo_public cairo_status_t
3131 cairo_pattern_get_rgba (cairo_pattern_t *pattern,
3132             double *red, double *green,
3133             double *blue, double *alpha);
3134 
3135 cairo_public cairo_status_t
3136 cairo_pattern_get_surface (cairo_pattern_t *pattern,
3137                cairo_surface_t **surface);
3138 
3139 
3140 cairo_public cairo_status_t
3141 cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,
3142                    int index, double *offset,
3143                    double *red, double *green,
3144                    double *blue, double *alpha);
3145 
3146 cairo_public cairo_status_t
3147 cairo_pattern_get_color_stop_count (cairo_pattern_t *pattern,
3148                     int *count);
3149 
3150 cairo_public cairo_status_t
3151 cairo_pattern_get_linear_points (cairo_pattern_t *pattern,
3152                  double *x0, double *y0,
3153                  double *x1, double *y1);
3154 
3155 cairo_public cairo_status_t
3156 cairo_pattern_get_radial_circles (cairo_pattern_t *pattern,
3157                   double *x0, double *y0, double *r0,
3158                   double *x1, double *y1, double *r1);
3159 
3160 cairo_public cairo_status_t
3161 cairo_mesh_pattern_get_patch_count (cairo_pattern_t *pattern,
3162                     unsigned int *count);
3163 
3164 cairo_public cairo_path_t *
3165 cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,
3166                  unsigned int patch_num);
3167 
3168 cairo_public cairo_status_t
3169 cairo_mesh_pattern_get_corner_color_rgba (cairo_pattern_t *pattern,
3170                       unsigned int patch_num,
3171                       unsigned int corner_num,
3172                       double *red, double *green,
3173                       double *blue, double *alpha);
3174 
3175 cairo_public cairo_status_t
3176 cairo_mesh_pattern_get_control_point (cairo_pattern_t *pattern,
3177                       unsigned int patch_num,
3178                       unsigned int point_num,
3179                       double *x, double *y);
3180 
3181 /* Matrix functions */
3182 
3183 cairo_public void
3184 cairo_matrix_init (cairo_matrix_t *matrix,
3185            double  xx, double  yx,
3186            double  xy, double  yy,
3187            double  x0, double  y0);
3188 
3189 cairo_public void
3190 cairo_matrix_init_identity (cairo_matrix_t *matrix);
3191 
3192 cairo_public void
3193 cairo_matrix_init_translate (cairo_matrix_t *matrix,
3194                  double tx, double ty);
3195 
3196 cairo_public void
3197 cairo_matrix_init_scale (cairo_matrix_t *matrix,
3198              double sx, double sy);
3199 
3200 cairo_public void
3201 cairo_matrix_init_rotate (cairo_matrix_t *matrix,
3202               double radians);
3203 
3204 cairo_public void
3205 cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
3206 
3207 cairo_public void
3208 cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
3209 
3210 cairo_public void
3211 cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
3212 
3213 cairo_public cairo_status_t
3214 cairo_matrix_invert (cairo_matrix_t *matrix);
3215 
3216 cairo_public void
3217 cairo_matrix_multiply (cairo_matrix_t       *result,
3218                const cairo_matrix_t *a,
3219                const cairo_matrix_t *b);
3220 
3221 cairo_public void
3222 cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
3223                  double *dx, double *dy);
3224 
3225 cairo_public void
3226 cairo_matrix_transform_point (const cairo_matrix_t *matrix,
3227                   double *x, double *y);
3228 
3229 /* Region functions */
3230 
3231 /**
3232  * cairo_region_t:
3233  *
3234  * A #cairo_region_t represents a set of integer-aligned rectangles.
3235  *
3236  * It allows set-theoretical operations like cairo_region_union() and
3237  * cairo_region_intersect() to be performed on them.
3238  *
3239  * Memory management of #cairo_region_t is done with
3240  * cairo_region_reference() and cairo_region_destroy().
3241  *
3242  * Since: 1.10
3243  **/
3244 typedef struct _cairo_region cairo_region_t;
3245 
3246 /**
3247  * cairo_region_overlap_t:
3248  * @CAIRO_REGION_OVERLAP_IN: The contents are entirely inside the region. (Since 1.10)
3249  * @CAIRO_REGION_OVERLAP_OUT: The contents are entirely outside the region. (Since 1.10)
3250  * @CAIRO_REGION_OVERLAP_PART: The contents are partially inside and
3251  *     partially outside the region. (Since 1.10)
3252  *
3253  * Used as the return value for cairo_region_contains_rectangle().
3254  *
3255  * Since: 1.10
3256  **/
3257 typedef enum _cairo_region_overlap {
3258     CAIRO_REGION_OVERLAP_IN,        /* completely inside region */
3259     CAIRO_REGION_OVERLAP_OUT,       /* completely outside region */
3260     CAIRO_REGION_OVERLAP_PART       /* partly inside region */
3261 } cairo_region_overlap_t;
3262 
3263 cairo_public cairo_region_t *
3264 cairo_region_create (void);
3265 
3266 cairo_public cairo_region_t *
3267 cairo_region_create_rectangle (const cairo_rectangle_int_t *rectangle);
3268 
3269 cairo_public cairo_region_t *
3270 cairo_region_create_rectangles (const cairo_rectangle_int_t *rects,
3271                 int count);
3272 
3273 cairo_public cairo_region_t *
3274 cairo_region_copy (const cairo_region_t *original);
3275 
3276 cairo_public cairo_region_t *
3277 cairo_region_reference (cairo_region_t *region);
3278 
3279 cairo_public void
3280 cairo_region_destroy (cairo_region_t *region);
3281 
3282 cairo_public cairo_bool_t
3283 cairo_region_equal (const cairo_region_t *a, const cairo_region_t *b);
3284 
3285 cairo_public cairo_status_t
3286 cairo_region_status (const cairo_region_t *region);
3287 
3288 cairo_public void
3289 cairo_region_get_extents (const cairo_region_t        *region,
3290               cairo_rectangle_int_t *extents);
3291 
3292 cairo_public int
3293 cairo_region_num_rectangles (const cairo_region_t *region);
3294 
3295 cairo_public void
3296 cairo_region_get_rectangle (const cairo_region_t  *region,
3297                 int                    nth,
3298                 cairo_rectangle_int_t *rectangle);
3299 
3300 cairo_public cairo_bool_t
3301 cairo_region_is_empty (const cairo_region_t *region);
3302 
3303 cairo_public cairo_region_overlap_t
3304 cairo_region_contains_rectangle (const cairo_region_t *region,
3305                  const cairo_rectangle_int_t *rectangle);
3306 
3307 cairo_public cairo_bool_t
3308 cairo_region_contains_point (const cairo_region_t *region, int x, int y);
3309 
3310 cairo_public void
3311 cairo_region_translate (cairo_region_t *region, int dx, int dy);
3312 
3313 cairo_public cairo_status_t
3314 cairo_region_subtract (cairo_region_t *dst, const cairo_region_t *other);
3315 
3316 cairo_public cairo_status_t
3317 cairo_region_subtract_rectangle (cairo_region_t *dst,
3318                  const cairo_rectangle_int_t *rectangle);
3319 
3320 cairo_public cairo_status_t
3321 cairo_region_intersect (cairo_region_t *dst, const cairo_region_t *other);
3322 
3323 cairo_public cairo_status_t
3324 cairo_region_intersect_rectangle (cairo_region_t *dst,
3325                   const cairo_rectangle_int_t *rectangle);
3326 
3327 cairo_public cairo_status_t
3328 cairo_region_union (cairo_region_t *dst, const cairo_region_t *other);
3329 
3330 cairo_public cairo_status_t
3331 cairo_region_union_rectangle (cairo_region_t *dst,
3332                   const cairo_rectangle_int_t *rectangle);
3333 
3334 cairo_public cairo_status_t
3335 cairo_region_xor (cairo_region_t *dst, const cairo_region_t *other);
3336 
3337 cairo_public cairo_status_t
3338 cairo_region_xor_rectangle (cairo_region_t *dst,
3339                 const cairo_rectangle_int_t *rectangle);
3340 
3341 /* Functions to be used while debugging (not intended for use in production code) */
3342 cairo_public void
3343 cairo_debug_reset_static_data (void);
3344 
3345 
3346 CAIRO_END_DECLS
3347 
3348 #endif /* CAIRO_H */