home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / cairo / cairo.h < prev   
Encoding:
C/C++ Source or Header  |  2008-09-18  |  62.3 KB  |  1,946 lines

  1. /* cairo - a vector graphics library with display and print output
  2.  *
  3.  * Copyright ┬⌐ 2002 University of Southern California
  4.  * Copyright ┬⌐ 2005 Red Hat, Inc.
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it either under the terms of the GNU Lesser General Public
  8.  * License version 2.1 as published by the Free Software Foundation
  9.  * (the "LGPL") or, at your option, under the terms of the Mozilla
  10.  * Public License Version 1.1 (the "MPL"). If you do not alter this
  11.  * notice, a recipient may use your version of this file under either
  12.  * the MPL or the LGPL.
  13.  *
  14.  * You should have received a copy of the LGPL along with this library
  15.  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17.  * You should have received a copy of the MPL along with this library
  18.  * in the file COPYING-MPL-1.1
  19.  *
  20.  * The contents of this file are subject to the Mozilla Public License
  21.  * Version 1.1 (the "License"); you may not use this file except in
  22.  * compliance with the License. You may obtain a copy of the License at
  23.  * http://www.mozilla.org/MPL/
  24.  *
  25.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
  26.  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
  27.  * the specific language governing rights and limitations.
  28.  *
  29.  * The Original Code is the cairo graphics library.
  30.  *
  31.  * The Initial Developer of the Original Code is University of Southern
  32.  * California.
  33.  *
  34.  * Contributor(s):
  35.  *    Carl D. Worth <cworth@cworth.org>
  36.  */
  37.  
  38. #ifndef CAIRO_H
  39. #define CAIRO_H
  40.  
  41. #include <cairo-features.h>
  42. #include <cairo-deprecated.h>
  43.  
  44. CAIRO_BEGIN_DECLS
  45.  
  46. #define CAIRO_VERSION_ENCODE(major, minor, micro) (     \
  47.       ((major) * 10000)                             \
  48.     + ((minor) *   100)                             \
  49.     + ((micro) *     1))
  50.  
  51. #define CAIRO_VERSION CAIRO_VERSION_ENCODE(     \
  52.     CAIRO_VERSION_MAJOR,                    \
  53.     CAIRO_VERSION_MINOR,                    \
  54.     CAIRO_VERSION_MICRO)
  55.  
  56. cairo_public int
  57. cairo_version (void);
  58.  
  59. cairo_public const char*
  60. cairo_version_string (void);
  61.  
  62. /**
  63.  * cairo_bool_t:
  64.  *
  65.  * #cairo_bool_t is used for boolean values. Returns of type
  66.  * #cairo_bool_t will always be either 0 or 1, but testing against
  67.  * these values explicitly is not encouraged; just use the
  68.  * value as a boolean condition.
  69.  *
  70.  * <informalexample><programlisting>
  71.  *  if (cairo_in_stroke (cr, x, y)) {
  72.  *      /<!-- -->* do something *<!-- -->/
  73.  *  }
  74.  * </programlisting></informalexample>
  75.  **/
  76. typedef int cairo_bool_t;
  77.  
  78. /**
  79.  * cairo_t:
  80.  *
  81.  * A #cairo_t contains the current state of the rendering device,
  82.  * including coordinates of yet to be drawn shapes.
  83.  *
  84.  * Cairo contexts, as #cairo_t objects are named, are central to
  85.  * cairo and all drawing with cairo is always done to a #cairo_t
  86.  * object.
  87.  *
  88.  * Memory management of #cairo_t is done with
  89.  * cairo_reference() and cairo_destroy().
  90.  **/
  91. typedef struct _cairo cairo_t;
  92.  
  93. /**
  94.  * cairo_surface_t:
  95.  *
  96.  * A #cairo_surface_t represents an image, either as the destination
  97.  * of a drawing operation or as source when drawing onto another
  98.  * surface.  To draw to a #cairo_surface_t, create a cairo context
  99.  * with the surface as the target, using cairo_create().
  100.  *
  101.  * There are different subtypes of #cairo_surface_t for
  102.  * different drawing backends; for example, cairo_image_surface_create()
  103.  * creates a bitmap image in memory.
  104.  * The type of a surface can be queried with cairo_surface_get_type().
  105.  *
  106.  * Memory management of #cairo_surface_t is done with
  107.  * cairo_surface_reference() and cairo_surface_destroy().
  108.  **/
  109. typedef struct _cairo_surface cairo_surface_t;
  110.  
  111. /**
  112.  * cairo_matrix_t:
  113.  * @xx: xx component of the affine transformation
  114.  * @yx: yx component of the affine transformation
  115.  * @xy: xy component of the affine transformation
  116.  * @yy: yy component of the affine transformation
  117.  * @x0: X translation component of the affine transformation
  118.  * @y0: Y translation component of the affine transformation
  119.  *
  120.  * A #cairo_matrix_t holds an affine transformation, such as a scale,
  121.  * rotation, shear, or a combination of those. The transformation of
  122.  * a point (x, y) is given by:
  123.  * <programlisting>
  124.  *     x_new = xx * x + xy * y + x0;
  125.  *     y_new = yx * x + yy * y + y0;
  126.  * </programlisting>
  127.  **/
  128. typedef struct _cairo_matrix {
  129.     double xx; double yx;
  130.     double xy; double yy;
  131.     double x0; double y0;
  132. } cairo_matrix_t;
  133.  
  134. /**
  135.  * cairo_pattern_t:
  136.  *
  137.  * A #cairo_pattern_t represents a source when drawing onto a
  138.  * surface. There are different subtypes of #cairo_pattern_t,
  139.  * for different types of sources; for example,
  140.  * cairo_pattern_create_rgb() creates a pattern for a solid
  141.  * opaque color.
  142.  *
  143.  * Other than various cairo_pattern_create_<emphasis>type</emphasis>()
  144.  * functions, some of the pattern types can be implicitly created
  145.  * using various cairo_set_source_<emphasis>type</emphasis>() functions;
  146.  * for example cairo_set_source_rgb().
  147.  *
  148.  * The type of a pattern can be queried with cairo_pattern_get_type().
  149.  *
  150.  * Memory management of #cairo_pattern_t is done with
  151.  * cairo_pattern_reference() and cairo_pattern_destroy().
  152.  **/
  153. typedef struct _cairo_pattern cairo_pattern_t;
  154.  
  155. /**
  156.  * cairo_destroy_func_t:
  157.  * @data: The data element being destroyed.
  158.  *
  159.  * #cairo_destroy_func_t the type of function which is called when a
  160.  * data element is destroyed. It is passed the pointer to the data
  161.  * element and should free any memory and resources allocated for it.
  162.  **/
  163. typedef void (*cairo_destroy_func_t) (void *data);
  164.  
  165. /**
  166.  * cairo_user_data_key_t:
  167.  * @unused: not used; ignore.
  168.  *
  169.  * #cairo_user_data_key_t is used for attaching user data to cairo
  170.  * data structures.  The actual contents of the struct is never used,
  171.  * and there is no need to initialize the object; only the unique
  172.  * address of a #cairo_data_key_t object is used.  Typically, you
  173.  * would just use the address of a static #cairo_data_key_t object.
  174.  **/
  175. typedef struct _cairo_user_data_key {
  176.     int unused;
  177. } cairo_user_data_key_t;
  178.  
  179. /**
  180.  * cairo_status_t:
  181.  * @CAIRO_STATUS_SUCCESS: no error has occurred
  182.  * @CAIRO_STATUS_NO_MEMORY: out of memory
  183.  * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore() called without matching cairo_save()
  184.  * @CAIRO_STATUS_INVALID_POP_GROUP: no saved group to pop
  185.  * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined
  186.  * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible)
  187.  * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input #cairo_status_t
  188.  * @CAIRO_STATUS_NULL_POINTER: %NULL pointer
  189.  * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8
  190.  * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid
  191.  * @CAIRO_STATUS_READ_ERROR: error while reading from input stream
  192.  * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream
  193.  * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished
  194.  * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation
  195.  * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation
  196.  * @CAIRO_STATUS_INVALID_CONTENT: invalid value for an input #cairo_content_t
  197.  * @CAIRO_STATUS_INVALID_FORMAT: invalid value for an input #cairo_format_t
  198.  * @CAIRO_STATUS_INVALID_VISUAL: invalid value for an input Visual*
  199.  * @CAIRO_STATUS_FILE_NOT_FOUND: file not found
  200.  * @CAIRO_STATUS_INVALID_DASH: invalid value for a dash setting
  201.  * @CAIRO_STATUS_INVALID_DSC_COMMENT: invalid value for a DSC comment (Since 1.2)
  202.  * @CAIRO_STATUS_INVALID_INDEX: invalid index passed to getter (Since 1.4)
  203.  * @CAIRO_STATUS_CLIP_NOT_REPRESENTABLE: clip region not representable in desired format (Since 1.4)
  204.  * @CAIRO_STATUS_TEMP_FILE_ERROR: error creating or writing to a temporary file (Since 1.6)
  205.  * @CAIRO_STATUS_INVALID_STRIDE: invalid value for stride (Since 1.6)
  206.  *
  207.  * #cairo_status_t is used to indicate errors that can occur when
  208.  * using Cairo. In some cases it is returned directly by functions.
  209.  * but when using #cairo_t, the last error, if any, is stored in
  210.  * the context and can be retrieved with cairo_status().
  211.  *
  212.  * New entries may be added in future versions.  Use cairo_status_to_string()
  213.  * to get a human-readable representation of an error message.
  214.  **/
  215. typedef enum _cairo_status {
  216.     CAIRO_STATUS_SUCCESS = 0,
  217.     CAIRO_STATUS_NO_MEMORY,
  218.     CAIRO_STATUS_INVALID_RESTORE,
  219.     CAIRO_STATUS_INVALID_POP_GROUP,
  220.     CAIRO_STATUS_NO_CURRENT_POINT,
  221.     CAIRO_STATUS_INVALID_MATRIX,
  222.     CAIRO_STATUS_INVALID_STATUS,
  223.     CAIRO_STATUS_NULL_POINTER,
  224.     CAIRO_STATUS_INVALID_STRING,
  225.     CAIRO_STATUS_INVALID_PATH_DATA,
  226.     CAIRO_STATUS_READ_ERROR,
  227.     CAIRO_STATUS_WRITE_ERROR,
  228.     CAIRO_STATUS_SURFACE_FINISHED,
  229.     CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
  230.     CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
  231.     CAIRO_STATUS_INVALID_CONTENT,
  232.     CAIRO_STATUS_INVALID_FORMAT,
  233.     CAIRO_STATUS_INVALID_VISUAL,
  234.     CAIRO_STATUS_FILE_NOT_FOUND,
  235.     CAIRO_STATUS_INVALID_DASH,
  236.     CAIRO_STATUS_INVALID_DSC_COMMENT,
  237.     CAIRO_STATUS_INVALID_INDEX,
  238.     CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
  239.     CAIRO_STATUS_TEMP_FILE_ERROR,
  240.     CAIRO_STATUS_INVALID_STRIDE
  241.     /* after adding a new error: update CAIRO_STATUS_LAST_STATUS in cairoint.h */
  242. } cairo_status_t;
  243.  
  244. /**
  245.  * cairo_content_t:
  246.  * @CAIRO_CONTENT_COLOR: The surface will hold color content only.
  247.  * @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only.
  248.  * @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content.
  249.  *
  250.  * #cairo_content_t is used to describe the content that a surface will
  251.  * contain, whether color information, alpha information (translucence
  252.  * vs. opacity), or both.
  253.  *
  254.  * Note: The large values here are designed to keep #cairo_content_t
  255.  * values distinct from #cairo_format_t values so that the
  256.  * implementation can detect the error if users confuse the two types.
  257.  **/
  258. typedef enum _cairo_content {
  259.     CAIRO_CONTENT_COLOR        = 0x1000,
  260.     CAIRO_CONTENT_ALPHA        = 0x2000,
  261.     CAIRO_CONTENT_COLOR_ALPHA    = 0x3000
  262. } cairo_content_t;
  263.  
  264. /**
  265.  * cairo_write_func_t:
  266.  * @closure: the output closure
  267.  * @data: the buffer containing the data to write
  268.  * @length: the amount of data to write
  269.  *
  270.  * #cairo_write_func_t is the type of function which is called when a
  271.  * backend needs to write data to an output stream.  It is passed the
  272.  * closure which was specified by the user at the time the write
  273.  * function was registered, the data to write and the length of the
  274.  * data in bytes.  The write function should return
  275.  * CAIRO_STATUS_SUCCESS if all the data was successfully written,
  276.  * CAIRO_STATUS_WRITE_ERROR otherwise.
  277.  *
  278.  * Returns: the status code of the write operation
  279.  **/
  280. typedef cairo_status_t (*cairo_write_func_t) (void          *closure,
  281.                           const unsigned char *data,
  282.                           unsigned int       length);
  283.  
  284. /**
  285.  * cairo_read_func_t:
  286.  * @closure: the input closure
  287.  * @data: the buffer into which to read the data
  288.  * @length: the amount of data to read
  289.  *
  290.  * #cairo_read_func_t is the type of function which is called when a
  291.  * backend needs to read data from an input stream.  It is passed the
  292.  * closure which was specified by the user at the time the read
  293.  * function was registered, the buffer to read the data into and the
  294.  * length of the data in bytes.  The read function should return
  295.  * CAIRO_STATUS_SUCCESS if all the data was successfully read,
  296.  * CAIRO_STATUS_READ_ERROR otherwise.
  297.  *
  298.  * Returns: the status code of the read operation
  299.  **/
  300. typedef cairo_status_t (*cairo_read_func_t) (void        *closure,
  301.                          unsigned char    *data,
  302.                          unsigned int    length);
  303.  
  304. /* Functions for manipulating state objects */
  305. cairo_public cairo_t *
  306. cairo_create (cairo_surface_t *target);
  307.  
  308. cairo_public cairo_t *
  309. cairo_reference (cairo_t *cr);
  310.  
  311. cairo_public void
  312. cairo_destroy (cairo_t *cr);
  313.  
  314. cairo_public unsigned int
  315. cairo_get_reference_count (cairo_t *cr);
  316.  
  317. cairo_public void *
  318. cairo_get_user_data (cairo_t             *cr,
  319.              const cairo_user_data_key_t *key);
  320.  
  321. cairo_public cairo_status_t
  322. cairo_set_user_data (cairo_t             *cr,
  323.              const cairo_user_data_key_t *key,
  324.              void             *user_data,
  325.              cairo_destroy_func_t      destroy);
  326.  
  327. cairo_public void
  328. cairo_save (cairo_t *cr);
  329.  
  330. cairo_public void
  331. cairo_restore (cairo_t *cr);
  332.  
  333. cairo_public void
  334. cairo_push_group (cairo_t *cr);
  335.  
  336. cairo_public void
  337. cairo_push_group_with_content (cairo_t *cr, cairo_content_t content);
  338.  
  339. cairo_public cairo_pattern_t *
  340. cairo_pop_group (cairo_t *cr);
  341.  
  342. cairo_public void
  343. cairo_pop_group_to_source (cairo_t *cr);
  344.  
  345. /* Modify state */
  346.  
  347. /**
  348.  * cairo_operator_t:
  349.  * @CAIRO_OPERATOR_CLEAR: clear destination layer (bounded)
  350.  * @CAIRO_OPERATOR_SOURCE: replace destination layer (bounded)
  351.  * @CAIRO_OPERATOR_OVER: draw source layer on top of destination layer
  352.  * (bounded)
  353.  * @CAIRO_OPERATOR_IN: draw source where there was destination content
  354.  * (unbounded)
  355.  * @CAIRO_OPERATOR_OUT: draw source where there was no destination
  356.  * content (unbounded)
  357.  * @CAIRO_OPERATOR_ATOP: draw source on top of destination content and
  358.  * only there
  359.  * @CAIRO_OPERATOR_DEST: ignore the source
  360.  * @CAIRO_OPERATOR_DEST_OVER: draw destination on top of source
  361.  * @CAIRO_OPERATOR_DEST_IN: leave destination only where there was
  362.  * source content (unbounded)
  363.  * @CAIRO_OPERATOR_DEST_OUT: leave destination only where there was no
  364.  * source content
  365.  * @CAIRO_OPERATOR_DEST_ATOP: leave destination on top of source content
  366.  * and only there (unbounded)
  367.  * @CAIRO_OPERATOR_XOR: source and destination are shown where there is only
  368.  * one of them
  369.  * @CAIRO_OPERATOR_ADD: source and destination layers are accumulated
  370.  * @CAIRO_OPERATOR_SATURATE: like over, but assuming source and dest are
  371.  * disjoint geometries
  372.  *
  373.  * #cairo_operator_t is used to set the compositing operator for all cairo
  374.  * drawing operations.
  375.  *
  376.  * The default operator is %CAIRO_OPERATOR_OVER.
  377.  *
  378.  * The operators marked as <firstterm>unbounded</firstterm> modify their
  379.  * destination even outside of the mask layer (that is, their effect is not
  380.  * bound by the mask layer).  However, their effect can still be limited by
  381.  * way of clipping.
  382.  *
  383.  * To keep things simple, the operator descriptions here
  384.  * document the behavior for when both source and destination are either fully
  385.  * transparent or fully opaque.  The actual implementation works for
  386.  * translucent layers too.
  387.  * For a more detailed explanation of the effects of each operator, including
  388.  * the mathematical definitions, see
  389.  * <ulink url="http://cairographics.org/operators/">http://cairographics.org/operators/</ulink>.
  390.  **/
  391. typedef enum _cairo_operator {
  392.     CAIRO_OPERATOR_CLEAR,
  393.  
  394.     CAIRO_OPERATOR_SOURCE,
  395.     CAIRO_OPERATOR_OVER,
  396.     CAIRO_OPERATOR_IN,
  397.     CAIRO_OPERATOR_OUT,
  398.     CAIRO_OPERATOR_ATOP,
  399.  
  400.     CAIRO_OPERATOR_DEST,
  401.     CAIRO_OPERATOR_DEST_OVER,
  402.     CAIRO_OPERATOR_DEST_IN,
  403.     CAIRO_OPERATOR_DEST_OUT,
  404.     CAIRO_OPERATOR_DEST_ATOP,
  405.  
  406.     CAIRO_OPERATOR_XOR,
  407.     CAIRO_OPERATOR_ADD,
  408.     CAIRO_OPERATOR_SATURATE
  409. } cairo_operator_t;
  410.  
  411. cairo_public void
  412. cairo_set_operator (cairo_t *cr, cairo_operator_t op);
  413.  
  414. cairo_public void
  415. cairo_set_source (cairo_t *cr, cairo_pattern_t *source);
  416.  
  417. cairo_public void
  418. cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue);
  419.  
  420. cairo_public void
  421. cairo_set_source_rgba (cairo_t *cr,
  422.                double red, double green, double blue,
  423.                double alpha);
  424.  
  425. cairo_public void
  426. cairo_set_source_surface (cairo_t      *cr,
  427.               cairo_surface_t *surface,
  428.               double       x,
  429.               double       y);
  430.  
  431. cairo_public void
  432. cairo_set_tolerance (cairo_t *cr, double tolerance);
  433.  
  434. /**
  435.  * cairo_antialias_t:
  436.  * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for
  437.  *   the subsystem and target device
  438.  * @CAIRO_ANTIALIAS_NONE: Use a bilevel alpha mask
  439.  * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using
  440.  *  shades of gray for black text on a white background, for example).
  441.  * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking
  442.  *  advantage of the order of subpixel elements on devices
  443.  *  such as LCD panels
  444.  *
  445.  * Specifies the type of antialiasing to do when rendering text or shapes.
  446.  **/
  447. typedef enum _cairo_antialias {
  448.     CAIRO_ANTIALIAS_DEFAULT,
  449.     CAIRO_ANTIALIAS_NONE,
  450.     CAIRO_ANTIALIAS_GRAY,
  451.     CAIRO_ANTIALIAS_SUBPIXEL
  452. } cairo_antialias_t;
  453.  
  454. cairo_public void
  455. cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias);
  456.  
  457. /**
  458.  * cairo_fill_rule_t:
  459.  * @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from
  460.  * left-to-right, counts +1. If the path crosses the ray
  461.  * from right to left, counts -1. (Left and right are determined
  462.  * from the perspective of looking along the ray from the starting
  463.  * point.) If the total count is non-zero, the point will be filled.
  464.  * @CAIRO_FILL_RULE_EVEN_ODD: Counts the total number of
  465.  * intersections, without regard to the orientation of the contour. If
  466.  * the total number of intersections is odd, the point will be
  467.  * filled.
  468.  *
  469.  * #cairo_fill_rule_t is used to select how paths are filled. For both
  470.  * fill rules, whether or not a point is included in the fill is
  471.  * determined by taking a ray from that point to infinity and looking
  472.  * at intersections with the path. The ray can be in any direction,
  473.  * as long as it doesn't pass through the end point of a segment
  474.  * or have a tricky intersection such as intersecting tangent to the path.
  475.  * (Note that filling is not actually implemented in this way. This
  476.  * is just a description of the rule that is applied.)
  477.  *
  478.  * The default fill rule is %CAIRO_FILL_RULE_WINDING.
  479.  *
  480.  * New entries may be added in future versions.
  481.  **/
  482. typedef enum _cairo_fill_rule {
  483.     CAIRO_FILL_RULE_WINDING,
  484.     CAIRO_FILL_RULE_EVEN_ODD
  485. } cairo_fill_rule_t;
  486.  
  487. cairo_public void
  488. cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule);
  489.  
  490. cairo_public void
  491. cairo_set_line_width (cairo_t *cr, double width);
  492.  
  493. /**
  494.  * cairo_line_cap_t:
  495.  * @CAIRO_LINE_CAP_BUTT: start(stop) the line exactly at the start(end) point
  496.  * @CAIRO_LINE_CAP_ROUND: use a round ending, the center of the circle is the end point
  497.  * @CAIRO_LINE_CAP_SQUARE: use squared ending, the center of the square is the end point
  498.  *
  499.  * Specifies how to render the endpoints of the path when stroking.
  500.  *
  501.  * The default line cap style is %CAIRO_LINE_CAP_BUTT.
  502.  **/
  503. typedef enum _cairo_line_cap {
  504.     CAIRO_LINE_CAP_BUTT,
  505.     CAIRO_LINE_CAP_ROUND,
  506.     CAIRO_LINE_CAP_SQUARE
  507. } cairo_line_cap_t;
  508.  
  509. cairo_public void
  510. cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap);
  511.  
  512. /**
  513.  * cairo_line_join_t:
  514.  * @CAIRO_LINE_JOIN_MITER: use a sharp (angled) corner, see
  515.  * cairo_set_miter_limit()
  516.  * @CAIRO_LINE_JOIN_ROUND: use a rounded join, the center of the circle is the
  517.  * joint point
  518.  * @CAIRO_LINE_JOIN_BEVEL: use a cut-off join, the join is cut off at half
  519.  * the line width from the joint point
  520.  *
  521.  * Specifies how to render the junction of two lines when stroking.
  522.  *
  523.  * The default line join style is %CAIRO_LINE_JOIN_MITER.
  524.  **/
  525. typedef enum _cairo_line_join {
  526.     CAIRO_LINE_JOIN_MITER,
  527.     CAIRO_LINE_JOIN_ROUND,
  528.     CAIRO_LINE_JOIN_BEVEL
  529. } cairo_line_join_t;
  530.  
  531. cairo_public void
  532. cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join);
  533.  
  534. cairo_public void
  535. cairo_set_dash (cairo_t      *cr,
  536.         const double *dashes,
  537.         int          num_dashes,
  538.         double          offset);
  539.  
  540. cairo_public void
  541. cairo_set_miter_limit (cairo_t *cr, double limit);
  542.  
  543. cairo_public void
  544. cairo_translate (cairo_t *cr, double tx, double ty);
  545.  
  546. cairo_public void
  547. cairo_scale (cairo_t *cr, double sx, double sy);
  548.  
  549. cairo_public void
  550. cairo_rotate (cairo_t *cr, double angle);
  551.  
  552. cairo_public void
  553. cairo_transform (cairo_t          *cr,
  554.          const cairo_matrix_t *matrix);
  555.  
  556. cairo_public void
  557. cairo_set_matrix (cairo_t           *cr,
  558.           const cairo_matrix_t *matrix);
  559.  
  560. cairo_public void
  561. cairo_identity_matrix (cairo_t *cr);
  562.  
  563. cairo_public void
  564. cairo_user_to_device (cairo_t *cr, double *x, double *y);
  565.  
  566. cairo_public void
  567. cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
  568.  
  569. cairo_public void
  570. cairo_device_to_user (cairo_t *cr, double *x, double *y);
  571.  
  572. cairo_public void
  573. cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
  574.  
  575. /* Path creation functions */
  576. cairo_public void
  577. cairo_new_path (cairo_t *cr);
  578.  
  579. cairo_public void
  580. cairo_move_to (cairo_t *cr, double x, double y);
  581.  
  582. cairo_public void
  583. cairo_new_sub_path (cairo_t *cr);
  584.  
  585. cairo_public void
  586. cairo_line_to (cairo_t *cr, double x, double y);
  587.  
  588. cairo_public void
  589. cairo_curve_to (cairo_t *cr,
  590.         double x1, double y1,
  591.         double x2, double y2,
  592.         double x3, double y3);
  593.  
  594. cairo_public void
  595. cairo_arc (cairo_t *cr,
  596.        double xc, double yc,
  597.        double radius,
  598.        double angle1, double angle2);
  599.  
  600. cairo_public void
  601. cairo_arc_negative (cairo_t *cr,
  602.             double xc, double yc,
  603.             double radius,
  604.             double angle1, double angle2);
  605.  
  606. /* XXX: NYI
  607. cairo_public void
  608. cairo_arc_to (cairo_t *cr,
  609.           double x1, double y1,
  610.           double x2, double y2,
  611.           double radius);
  612. */
  613.  
  614. cairo_public void
  615. cairo_rel_move_to (cairo_t *cr, double dx, double dy);
  616.  
  617. cairo_public void
  618. cairo_rel_line_to (cairo_t *cr, double dx, double dy);
  619.  
  620. cairo_public void
  621. cairo_rel_curve_to (cairo_t *cr,
  622.             double dx1, double dy1,
  623.             double dx2, double dy2,
  624.             double dx3, double dy3);
  625.  
  626. cairo_public void
  627. cairo_rectangle (cairo_t *cr,
  628.          double x, double y,
  629.          double width, double height);
  630.  
  631. /* XXX: NYI
  632. cairo_public void
  633. cairo_stroke_to_path (cairo_t *cr);
  634. */
  635.  
  636. cairo_public void
  637. cairo_close_path (cairo_t *cr);
  638.  
  639. cairo_public void
  640. cairo_path_extents (cairo_t *cr,
  641.             double *x1, double *y1,
  642.             double *x2, double *y2);
  643.  
  644. /* Painting functions */
  645. cairo_public void
  646. cairo_paint (cairo_t *cr);
  647.  
  648. cairo_public void
  649. cairo_paint_with_alpha (cairo_t *cr,
  650.             double   alpha);
  651.  
  652. cairo_public void
  653. cairo_mask (cairo_t         *cr,
  654.         cairo_pattern_t *pattern);
  655.  
  656. cairo_public void
  657. cairo_mask_surface (cairo_t         *cr,
  658.             cairo_surface_t *surface,
  659.             double           surface_x,
  660.             double           surface_y);
  661.  
  662. cairo_public void
  663. cairo_stroke (cairo_t *cr);
  664.  
  665. cairo_public void
  666. cairo_stroke_preserve (cairo_t *cr);
  667.  
  668. cairo_public void
  669. cairo_fill (cairo_t *cr);
  670.  
  671. cairo_public void
  672. cairo_fill_preserve (cairo_t *cr);
  673.  
  674. cairo_public void
  675. cairo_copy_page (cairo_t *cr);
  676.  
  677. cairo_public void
  678. cairo_show_page (cairo_t *cr);
  679.  
  680. /* Insideness testing */
  681. cairo_public cairo_bool_t
  682. cairo_in_stroke (cairo_t *cr, double x, double y);
  683.  
  684. cairo_public cairo_bool_t
  685. cairo_in_fill (cairo_t *cr, double x, double y);
  686.  
  687. /* Rectangular extents */
  688. cairo_public void
  689. cairo_stroke_extents (cairo_t *cr,
  690.               double *x1, double *y1,
  691.               double *x2, double *y2);
  692.  
  693. cairo_public void
  694. cairo_fill_extents (cairo_t *cr,
  695.             double *x1, double *y1,
  696.             double *x2, double *y2);
  697.  
  698. /* Clipping */
  699. cairo_public void
  700. cairo_reset_clip (cairo_t *cr);
  701.  
  702. cairo_public void
  703. cairo_clip (cairo_t *cr);
  704.  
  705. cairo_public void
  706. cairo_clip_preserve (cairo_t *cr);
  707.  
  708. cairo_public void
  709. cairo_clip_extents (cairo_t *cr,
  710.             double *x1, double *y1,
  711.             double *x2, double *y2);
  712.  
  713. /**
  714.  * cairo_rectangle_t:
  715.  * @x: X coordinate of the left side of the rectangle
  716.  * @y: Y coordinate of the the top side of the rectangle
  717.  * @width: width of the rectangle
  718.  * @height: height of the rectangle
  719.  *
  720.  * A data structure for holding a rectangle.
  721.  *
  722.  * Since: 1.4
  723.  **/
  724. typedef struct _cairo_rectangle {
  725.     double x, y, width, height;
  726. } cairo_rectangle_t;
  727.  
  728. /**
  729.  * cairo_rectangle_list_t:
  730.  * @status: Error status of the rectangle list
  731.  * @rectangles: Array containing the rectangles
  732.  * @num_rectangles: Number of rectangles in this list
  733.  * 
  734.  * A data structure for holding a dynamically allocated
  735.  * array of rectangles.
  736.  *
  737.  * Since: 1.4
  738.  **/
  739. typedef struct _cairo_rectangle_list {
  740.     cairo_status_t     status;
  741.     cairo_rectangle_t *rectangles;
  742.     int                num_rectangles;
  743. } cairo_rectangle_list_t;
  744.  
  745. cairo_public cairo_rectangle_list_t *
  746. cairo_copy_clip_rectangle_list (cairo_t *cr);
  747.  
  748. cairo_public void
  749. cairo_rectangle_list_destroy (cairo_rectangle_list_t *rectangle_list);
  750.  
  751. /* Font/Text functions */
  752.  
  753. /**
  754.  * cairo_scaled_font_t:
  755.  *
  756.  * A #cairo_scaled_font_t is a font scaled to a particular size and device
  757.  * resolution. A #cairo_scaled_font_t is most useful for low-level font
  758.  * usage where a library or application wants to cache a reference
  759.  * to a scaled font to speed up the computation of metrics.
  760.  *
  761.  * There are various types of scaled fonts, depending on the
  762.  * <firstterm>font backend</firstterm> they use. The type of a
  763.  * scaled font can be queried using cairo_scaled_font_get_type().
  764.  *
  765.  * Memory management of #cairo_scaled_font_t is done with
  766.  * cairo_scaled_font_reference() and cairo_scaled_font_destroy().
  767.  **/
  768. typedef struct _cairo_scaled_font cairo_scaled_font_t;
  769.  
  770. /**
  771.  * cairo_font_face_t:
  772.  *
  773.  * A #cairo_font_face_t specifies all aspects of a font other
  774.  * than the size or font matrix (a font matrix is used to distort
  775.  * a font by sheering it or scaling it unequally in the two
  776.  * directions) . A font face can be set on a #cairo_t by using
  777.  * cairo_set_font_face(); the size and font matrix are set with
  778.  * cairo_set_font_size() and cairo_set_font_matrix().
  779.  *
  780.  * There are various types of font faces, depending on the
  781.  * <firstterm>font backend</firstterm> they use. The type of a
  782.  * font face can be queried using cairo_font_face_get_type().
  783.  *
  784.  * Memory management of #cairo_font_face_t is done with
  785.  * cairo_font_face_reference() and cairo_font_face_destroy().
  786.  **/
  787. typedef struct _cairo_font_face cairo_font_face_t;
  788.  
  789. /**
  790.  * cairo_glyph_t:
  791.  * @index: glyph index in the font. The exact interpretation of the
  792.  *      glyph index depends on the font technology being used.
  793.  * @x: the offset in the X direction between the origin used for
  794.  *     drawing or measuring the string and the origin of this glyph.
  795.  * @y: the offset in the Y direction between the origin used for
  796.  *     drawing or measuring the string and the origin of this glyph.
  797.  *
  798.  * The #cairo_glyph_t structure holds information about a single glyph
  799.  * when drawing or measuring text. A font is (in simple terms) a
  800.  * collection of shapes used to draw text. A glyph is one of these
  801.  * shapes. There can be multiple glyphs for a single character
  802.  * (alternates to be used in different contexts, for example), or a
  803.  * glyph can be a <firstterm>ligature</firstterm> of multiple
  804.  * characters. Cairo doesn't expose any way of converting input text
  805.  * into glyphs, so in order to use the Cairo interfaces that take
  806.  * arrays of glyphs, you must directly access the appropriate
  807.  * underlying font system.
  808.  *
  809.  * Note that the offsets given by @x and @y are not cumulative. When
  810.  * drawing or measuring text, each glyph is individually positioned
  811.  * with respect to the overall origin
  812.  **/
  813. typedef struct {
  814.   unsigned long        index;
  815.   double               x;
  816.   double               y;
  817. } cairo_glyph_t;
  818.  
  819. /**
  820.  * cairo_text_extents_t:
  821.  * @x_bearing: the horizontal distance from the origin to the
  822.  *   leftmost part of the glyphs as drawn. Positive if the
  823.  *   glyphs lie entirely to the right of the origin.
  824.  * @y_bearing: the vertical distance from the origin to the
  825.  *   topmost part of the glyphs as drawn. Positive only if the
  826.  *   glyphs lie completely below the origin; will usually be
  827.  *   negative.
  828.  * @width: width of the glyphs as drawn
  829.  * @height: height of the glyphs as drawn
  830.  * @x_advance:distance to advance in the X direction
  831.  *    after drawing these glyphs
  832.  * @y_advance: distance to advance in the Y direction
  833.  *   after drawing these glyphs. Will typically be zero except
  834.  *   for vertical text layout as found in East-Asian languages.
  835.  *
  836.  * The #cairo_text_extents_t structure stores the extents of a single
  837.  * glyph or a string of glyphs in user-space coordinates. Because text
  838.  * extents are in user-space coordinates, they are mostly, but not
  839.  * entirely, independent of the current transformation matrix. If you call
  840.  * <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
  841.  * be drawn twice as big, but the reported text extents will not be
  842.  * doubled. They will change slightly due to hinting (so you can't
  843.  * assume that metrics are independent of the transformation matrix),
  844.  * but otherwise will remain unchanged.
  845.  **/
  846. typedef struct {
  847.     double x_bearing;
  848.     double y_bearing;
  849.     double width;
  850.     double height;
  851.     double x_advance;
  852.     double y_advance;
  853. } cairo_text_extents_t;
  854.  
  855. /**
  856.  * cairo_font_extents_t:
  857.  * @ascent: the distance that the font extends above the baseline.
  858.  *          Note that this is not always exactly equal to the maximum
  859.  *          of the extents of all the glyphs in the font, but rather
  860.  *          is picked to express the font designer's intent as to
  861.  *          how the font should align with elements above it.
  862.  * @descent: the distance that the font extends below the baseline.
  863.  *           This value is positive for typical fonts that include
  864.  *           portions below the baseline. Note that this is not always
  865.  *           exactly equal to the maximum of the extents of all the
  866.  *           glyphs in the font, but rather is picked to express the
  867.  *           font designer's intent as to how the the font should
  868.  *           align with elements below it.
  869.  * @height: the recommended vertical distance between baselines when
  870.  *          setting consecutive lines of text with the font. This
  871.  *          is greater than @ascent+@descent by a
  872.  *          quantity known as the <firstterm>line spacing</firstterm>
  873.  *          or <firstterm>external leading</firstterm>. When space
  874.  *          is at a premium, most fonts can be set with only
  875.  *          a distance of @ascent+@descent between lines.
  876.  * @max_x_advance: the maximum distance in the X direction that
  877.  *         the the origin is advanced for any glyph in the font.
  878.  * @max_y_advance: the maximum distance in the Y direction that
  879.  *         the the origin is advanced for any glyph in the font.
  880.  *         this will be zero for normal fonts used for horizontal
  881.  *         writing. (The scripts of East Asia are sometimes written
  882.  *         vertically.)
  883.  *
  884.  * The #cairo_font_extents_t structure stores metric information for
  885.  * a font. Values are given in the current user-space coordinate
  886.  * system.
  887.  *
  888.  * Because font metrics are in user-space coordinates, they are
  889.  * mostly, but not entirely, independent of the current transformation
  890.  * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
  891.  * text will be drawn twice as big, but the reported text extents will
  892.  * not be doubled. They will change slightly due to hinting (so you
  893.  * can't assume that metrics are independent of the transformation
  894.  * matrix), but otherwise will remain unchanged.
  895.  **/
  896. typedef struct {
  897.     double ascent;
  898.     double descent;
  899.     double height;
  900.     double max_x_advance;
  901.     double max_y_advance;
  902. } cairo_font_extents_t;
  903.  
  904. /**
  905.  * cairo_font_slant_t:
  906.  * @CAIRO_FONT_SLANT_NORMAL: Upright font style
  907.  * @CAIRO_FONT_SLANT_ITALIC: Italic font style
  908.  * @CAIRO_FONT_SLANT_OBLIQUE: Oblique font style
  909.  *
  910.  * Specifies variants of a font face based on their slant.
  911.  **/
  912. typedef enum _cairo_font_slant {
  913.   CAIRO_FONT_SLANT_NORMAL,
  914.   CAIRO_FONT_SLANT_ITALIC,
  915.   CAIRO_FONT_SLANT_OBLIQUE
  916. } cairo_font_slant_t;
  917.  
  918. /**
  919.  * cairo_font_weight_t:
  920.  * @CAIRO_FONT_WEIGHT_NORMAL: Normal font weight
  921.  * @CAIRO_FONT_WEIGHT_BOLD: Bold font weight
  922.  *
  923.  * Specifies variants of a font face based on their weight.
  924.  **/
  925. typedef enum _cairo_font_weight {
  926.   CAIRO_FONT_WEIGHT_NORMAL,
  927.   CAIRO_FONT_WEIGHT_BOLD
  928. } cairo_font_weight_t;
  929.  
  930. /**
  931.  * cairo_subpixel_order_t:
  932.  * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for
  933.  *   for the target device
  934.  * @CAIRO_SUBPIXEL_ORDER_RGB: Subpixel elements are arranged horizontally
  935.  *   with red at the left
  936.  * @CAIRO_SUBPIXEL_ORDER_BGR:  Subpixel elements are arranged horizontally
  937.  *   with blue at the left
  938.  * @CAIRO_SUBPIXEL_ORDER_VRGB: Subpixel elements are arranged vertically
  939.  *   with red at the top
  940.  * @CAIRO_SUBPIXEL_ORDER_VBGR: Subpixel elements are arranged vertically
  941.  *   with blue at the top
  942.  *
  943.  * The subpixel order specifies the order of color elements within
  944.  * each pixel on the display device when rendering with an
  945.  * antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
  946.  **/
  947. typedef enum _cairo_subpixel_order {
  948.     CAIRO_SUBPIXEL_ORDER_DEFAULT,
  949.     CAIRO_SUBPIXEL_ORDER_RGB,
  950.     CAIRO_SUBPIXEL_ORDER_BGR,
  951.     CAIRO_SUBPIXEL_ORDER_VRGB,
  952.     CAIRO_SUBPIXEL_ORDER_VBGR
  953. } cairo_subpixel_order_t;
  954.  
  955. /**
  956.  * cairo_hint_style_t:
  957.  * @CAIRO_HINT_STYLE_DEFAULT: Use the default hint style for
  958.  *   font backend and target device
  959.  * @CAIRO_HINT_STYLE_NONE: Do not hint outlines
  960.  * @CAIRO_HINT_STYLE_SLIGHT: Hint outlines slightly to improve
  961.  *   contrast while retaining good fidelity to the original
  962.  *   shapes.
  963.  * @CAIRO_HINT_STYLE_MEDIUM: Hint outlines with medium strength
  964.  *   giving a compromise between fidelity to the original shapes
  965.  *   and contrast
  966.  * @CAIRO_HINT_STYLE_FULL: Hint outlines to maximize contrast
  967.  *
  968.  * Specifies the type of hinting to do on font outlines. Hinting
  969.  * is the process of fitting outlines to the pixel grid in order
  970.  * to improve the appearance of the result. Since hinting outlines
  971.  * involves distorting them, it also reduces the faithfulness
  972.  * to the original outline shapes. Not all of the outline hinting
  973.  * styles are supported by all font backends.
  974.  *
  975.  * New entries may be added in future versions.
  976.  **/
  977. typedef enum _cairo_hint_style {
  978.     CAIRO_HINT_STYLE_DEFAULT,
  979.     CAIRO_HINT_STYLE_NONE,
  980.     CAIRO_HINT_STYLE_SLIGHT,
  981.     CAIRO_HINT_STYLE_MEDIUM,
  982.     CAIRO_HINT_STYLE_FULL
  983. } cairo_hint_style_t;
  984.  
  985. /**
  986.  * cairo_hint_metrics_t:
  987.  * @CAIRO_HINT_METRICS_DEFAULT: Hint metrics in the default
  988.  *  manner for the font backend and target device
  989.  * @CAIRO_HINT_METRICS_OFF: Do not hint font metrics
  990.  * @CAIRO_HINT_METRICS_ON: Hint font metrics
  991.  *
  992.  * Specifies whether to hint font metrics; hinting font metrics
  993.  * means quantizing them so that they are integer values in
  994.  * device space. Doing this improves the consistency of
  995.  * letter and line spacing, however it also means that text
  996.  * will be laid out differently at different zoom factors.
  997.  **/
  998. typedef enum _cairo_hint_metrics {
  999.     CAIRO_HINT_METRICS_DEFAULT,
  1000.     CAIRO_HINT_METRICS_OFF,
  1001.     CAIRO_HINT_METRICS_ON
  1002. } cairo_hint_metrics_t;
  1003.  
  1004. /**
  1005.  * cairo_font_options_t:
  1006.  *
  1007.  * An opaque structure holding all options that are used when
  1008.  * rendering fonts.
  1009.  *
  1010.  * Individual features of a #cairo_font_options_t can be set or
  1011.  * accessed using functions named
  1012.  * cairo_font_options_set_<emphasis>feature_name</emphasis> and
  1013.  * cairo_font_options_get_<emphasis>feature_name</emphasis>, like
  1014.  * cairo_font_options_set_antialias() and
  1015.  * cairo_font_options_get_antialias().
  1016.  *
  1017.  * New features may be added to a #cairo_font_options_t in the
  1018.  * future.  For this reason, cairo_font_options_copy(),
  1019.  * cairo_font_options_equal(), cairo_font_options_merge(), and
  1020.  * cairo_font_options_hash() should be used to copy, check
  1021.  * for equality, merge, or compute a hash value of
  1022.  * #cairo_font_options_t objects.
  1023.  **/
  1024. typedef struct _cairo_font_options cairo_font_options_t;
  1025.  
  1026. cairo_public cairo_font_options_t *
  1027. cairo_font_options_create (void);
  1028.  
  1029. cairo_public cairo_font_options_t *
  1030. cairo_font_options_copy (const cairo_font_options_t *original);
  1031.  
  1032. cairo_public void
  1033. cairo_font_options_destroy (cairo_font_options_t *options);
  1034.  
  1035. cairo_public cairo_status_t
  1036. cairo_font_options_status (cairo_font_options_t *options);
  1037.  
  1038. cairo_public void
  1039. cairo_font_options_merge (cairo_font_options_t       *options,
  1040.               const cairo_font_options_t *other);
  1041. cairo_public cairo_bool_t
  1042. cairo_font_options_equal (const cairo_font_options_t *options,
  1043.               const cairo_font_options_t *other);
  1044.  
  1045. cairo_public unsigned long
  1046. cairo_font_options_hash (const cairo_font_options_t *options);
  1047.  
  1048. cairo_public void
  1049. cairo_font_options_set_antialias (cairo_font_options_t *options,
  1050.                   cairo_antialias_t     antialias);
  1051. cairo_public cairo_antialias_t
  1052. cairo_font_options_get_antialias (const cairo_font_options_t *options);
  1053.  
  1054. cairo_public void
  1055. cairo_font_options_set_subpixel_order (cairo_font_options_t   *options,
  1056.                        cairo_subpixel_order_t  subpixel_order);
  1057. cairo_public cairo_subpixel_order_t
  1058. cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
  1059.  
  1060. cairo_public void
  1061. cairo_font_options_set_hint_style (cairo_font_options_t *options,
  1062.                    cairo_hint_style_t     hint_style);
  1063. cairo_public cairo_hint_style_t
  1064. cairo_font_options_get_hint_style (const cairo_font_options_t *options);
  1065.  
  1066. cairo_public void
  1067. cairo_font_options_set_hint_metrics (cairo_font_options_t *options,
  1068.                      cairo_hint_metrics_t  hint_metrics);
  1069. cairo_public cairo_hint_metrics_t
  1070. cairo_font_options_get_hint_metrics (const cairo_font_options_t *options);
  1071.  
  1072. /* This interface is for dealing with text as text, not caring about the
  1073.    font object inside the the cairo_t. */
  1074.  
  1075. cairo_public void
  1076. cairo_select_font_face (cairo_t              *cr,
  1077.             const char           *family,
  1078.             cairo_font_slant_t   slant,
  1079.             cairo_font_weight_t  weight);
  1080.  
  1081. cairo_public void
  1082. cairo_set_font_size (cairo_t *cr, double size);
  1083.  
  1084. cairo_public void
  1085. cairo_set_font_matrix (cairo_t            *cr,
  1086.                const cairo_matrix_t *matrix);
  1087.  
  1088. cairo_public void
  1089. cairo_get_font_matrix (cairo_t *cr,
  1090.                cairo_matrix_t *matrix);
  1091.  
  1092. cairo_public void
  1093. cairo_set_font_options (cairo_t                    *cr,
  1094.             const cairo_font_options_t *options);
  1095.  
  1096. cairo_public void
  1097. cairo_get_font_options (cairo_t              *cr,
  1098.             cairo_font_options_t *options);
  1099.  
  1100. cairo_public void
  1101. cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face);
  1102.  
  1103. cairo_public cairo_font_face_t *
  1104. cairo_get_font_face (cairo_t *cr);
  1105.  
  1106. cairo_public void
  1107. cairo_set_scaled_font (cairo_t                   *cr,
  1108.                const cairo_scaled_font_t *scaled_font);
  1109.  
  1110. cairo_public cairo_scaled_font_t *
  1111. cairo_get_scaled_font (cairo_t *cr);
  1112.  
  1113. cairo_public void
  1114. cairo_show_text (cairo_t *cr, const char *utf8);
  1115.  
  1116. cairo_public void
  1117. cairo_show_glyphs (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
  1118.  
  1119. cairo_public void
  1120. cairo_text_path  (cairo_t *cr, const char *utf8);
  1121.  
  1122. cairo_public void
  1123. cairo_glyph_path (cairo_t *cr, const cairo_glyph_t *glyphs, int num_glyphs);
  1124.  
  1125. cairo_public void
  1126. cairo_text_extents (cairo_t              *cr,
  1127.             const char         *utf8,
  1128.             cairo_text_extents_t *extents);
  1129.  
  1130. cairo_public void
  1131. cairo_glyph_extents (cairo_t               *cr,
  1132.              const cairo_glyph_t   *glyphs,
  1133.              int                   num_glyphs,
  1134.              cairo_text_extents_t  *extents);
  1135.  
  1136. cairo_public void
  1137. cairo_font_extents (cairo_t              *cr,
  1138.             cairo_font_extents_t *extents);
  1139.  
  1140. /* Generic identifier for a font style */
  1141.  
  1142. cairo_public cairo_font_face_t *
  1143. cairo_font_face_reference (cairo_font_face_t *font_face);
  1144.  
  1145. cairo_public void
  1146. cairo_font_face_destroy (cairo_font_face_t *font_face);
  1147.  
  1148. cairo_public unsigned int
  1149. cairo_font_face_get_reference_count (cairo_font_face_t *font_face);
  1150.  
  1151. cairo_public cairo_status_t
  1152. cairo_font_face_status (cairo_font_face_t *font_face);
  1153.  
  1154. /**
  1155.  * cairo_font_type_t:
  1156.  * @CAIRO_FONT_TYPE_TOY: The font was created using cairo's toy font api
  1157.  * @CAIRO_FONT_TYPE_FT: The font is of type FreeType
  1158.  * @CAIRO_FONT_TYPE_WIN32: The font is of type Win32
  1159.  * @CAIRO_FONT_TYPE_QUARTZ: The font is of type Quartz (Since: 1.6)
  1160.  *
  1161.  * #cairo_font_type_t is used to describe the type of a given font
  1162.  * face or scaled font. The font types are also known as "font
  1163.  * backends" within cairo.
  1164.  *
  1165.  * The type of a font face is determined by the function used to
  1166.  * create it, which will generally be of the form
  1167.  * cairo_<emphasis>type</emphasis>_font_face_create. The font face type can be queried
  1168.  * with cairo_font_face_get_type()
  1169.  *
  1170.  * The various #cairo_font_face_t functions can be used with a font face
  1171.  * of any type.
  1172.  *
  1173.  * The type of a scaled font is determined by the type of the font
  1174.  * face passed to cairo_scaled_font_create(). The scaled font type can
  1175.  * be queried with cairo_scaled_font_get_type()
  1176.  *
  1177.  * The various #cairo_scaled_font_t functions can be used with scaled
  1178.  * fonts of any type, but some font backends also provide
  1179.  * type-specific functions that must only be called with a scaled font
  1180.  * of the appropriate type. These functions have names that begin with
  1181.  * cairo_<emphasis>type</emphasis>_scaled_font such as cairo_ft_scaled_font_lock_face().
  1182.  *
  1183.  * The behavior of calling a type-specific function with a scaled font
  1184.  * of the wrong type is undefined.
  1185.  *
  1186.  * New entries may be added in future versions.
  1187.  *
  1188.  * Since: 1.2
  1189.  **/
  1190. typedef enum _cairo_font_type {
  1191.     CAIRO_FONT_TYPE_TOY,
  1192.     CAIRO_FONT_TYPE_FT,
  1193.     CAIRO_FONT_TYPE_WIN32,
  1194.     CAIRO_FONT_TYPE_QUARTZ
  1195. } cairo_font_type_t;
  1196.  
  1197. cairo_public cairo_font_type_t
  1198. cairo_font_face_get_type (cairo_font_face_t *font_face);
  1199.  
  1200. cairo_public void *
  1201. cairo_font_face_get_user_data (cairo_font_face_t       *font_face,
  1202.                    const cairo_user_data_key_t *key);
  1203.  
  1204. cairo_public cairo_status_t
  1205. cairo_font_face_set_user_data (cairo_font_face_t       *font_face,
  1206.                    const cairo_user_data_key_t *key,
  1207.                    void               *user_data,
  1208.                    cairo_destroy_func_t        destroy);
  1209.  
  1210. /* Portable interface to general font features. */
  1211.  
  1212. cairo_public cairo_scaled_font_t *
  1213. cairo_scaled_font_create (cairo_font_face_t          *font_face,
  1214.               const cairo_matrix_t       *font_matrix,
  1215.               const cairo_matrix_t       *ctm,
  1216.               const cairo_font_options_t *options);
  1217.  
  1218. cairo_public cairo_scaled_font_t *
  1219. cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
  1220.  
  1221. cairo_public void
  1222. cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font);
  1223.  
  1224. cairo_public unsigned int
  1225. cairo_scaled_font_get_reference_count (cairo_scaled_font_t *scaled_font);
  1226.  
  1227. cairo_public cairo_status_t
  1228. cairo_scaled_font_status (cairo_scaled_font_t *scaled_font);
  1229.  
  1230. cairo_public cairo_font_type_t
  1231. cairo_scaled_font_get_type (cairo_scaled_font_t *scaled_font);
  1232.  
  1233. cairo_public void *
  1234. cairo_scaled_font_get_user_data (cairo_scaled_font_t         *scaled_font,
  1235.                  const cairo_user_data_key_t *key);
  1236.  
  1237. cairo_public cairo_status_t
  1238. cairo_scaled_font_set_user_data (cairo_scaled_font_t         *scaled_font,
  1239.                  const cairo_user_data_key_t *key,
  1240.                  void                        *user_data,
  1241.                  cairo_destroy_func_t          destroy);
  1242.  
  1243. cairo_public void
  1244. cairo_scaled_font_extents (cairo_scaled_font_t  *scaled_font,
  1245.                cairo_font_extents_t *extents);
  1246.  
  1247. cairo_public void
  1248. cairo_scaled_font_text_extents (cairo_scaled_font_t  *scaled_font,
  1249.                 const char           *utf8,
  1250.                 cairo_text_extents_t *extents);
  1251.  
  1252. cairo_public void
  1253. cairo_scaled_font_glyph_extents (cairo_scaled_font_t   *scaled_font,
  1254.                  const cairo_glyph_t   *glyphs,
  1255.                  int                   num_glyphs,
  1256.                  cairo_text_extents_t  *extents);
  1257.  
  1258. cairo_public cairo_font_face_t *
  1259. cairo_scaled_font_get_font_face (cairo_scaled_font_t *scaled_font);
  1260.  
  1261. cairo_public void
  1262. cairo_scaled_font_get_font_matrix (cairo_scaled_font_t    *scaled_font,
  1263.                    cairo_matrix_t    *font_matrix);
  1264.  
  1265. cairo_public void
  1266. cairo_scaled_font_get_ctm (cairo_scaled_font_t    *scaled_font,
  1267.                cairo_matrix_t    *ctm);
  1268.  
  1269. cairo_public void
  1270. cairo_scaled_font_get_font_options (cairo_scaled_font_t        *scaled_font,
  1271.                     cairo_font_options_t    *options);
  1272.  
  1273. /* Query functions */
  1274.  
  1275. cairo_public cairo_operator_t
  1276. cairo_get_operator (cairo_t *cr);
  1277.  
  1278. cairo_public cairo_pattern_t *
  1279. cairo_get_source (cairo_t *cr);
  1280.  
  1281. cairo_public double
  1282. cairo_get_tolerance (cairo_t *cr);
  1283.  
  1284. cairo_public cairo_antialias_t
  1285. cairo_get_antialias (cairo_t *cr);
  1286.  
  1287. cairo_public cairo_bool_t
  1288. cairo_has_current_point (cairo_t *cr);
  1289.  
  1290. cairo_public void
  1291. cairo_get_current_point (cairo_t *cr, double *x, double *y);
  1292.  
  1293. cairo_public cairo_fill_rule_t
  1294. cairo_get_fill_rule (cairo_t *cr);
  1295.  
  1296. cairo_public double
  1297. cairo_get_line_width (cairo_t *cr);
  1298.  
  1299. cairo_public cairo_line_cap_t
  1300. cairo_get_line_cap (cairo_t *cr);
  1301.  
  1302. cairo_public cairo_line_join_t
  1303. cairo_get_line_join (cairo_t *cr);
  1304.  
  1305. cairo_public double
  1306. cairo_get_miter_limit (cairo_t *cr);
  1307.  
  1308. cairo_public int
  1309. cairo_get_dash_count (cairo_t *cr);
  1310.  
  1311. cairo_public void
  1312. cairo_get_dash (cairo_t *cr, double *dashes, double *offset);
  1313.  
  1314. cairo_public void
  1315. cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix);
  1316.  
  1317. cairo_public cairo_surface_t *
  1318. cairo_get_target (cairo_t *cr);
  1319.  
  1320. cairo_public cairo_surface_t *
  1321. cairo_get_group_target (cairo_t *cr);
  1322.  
  1323. /**
  1324.  * cairo_path_data_type_t:
  1325.  * @CAIRO_PATH_MOVE_TO: A move-to operation
  1326.  * @CAIRO_PATH_LINE_TO: A line-to operation
  1327.  * @CAIRO_PATH_CURVE_TO: A curve-to operation
  1328.  * @CAIRO_PATH_CLOSE_PATH: A close-path operation
  1329.  *
  1330.  * #cairo_path_data_t is used to describe the type of one portion
  1331.  * of a path when represented as a #cairo_path_t.
  1332.  * See #cairo_path_data_t for details.
  1333.  **/
  1334. typedef enum _cairo_path_data_type {
  1335.     CAIRO_PATH_MOVE_TO,
  1336.     CAIRO_PATH_LINE_TO,
  1337.     CAIRO_PATH_CURVE_TO,
  1338.     CAIRO_PATH_CLOSE_PATH
  1339. } cairo_path_data_type_t;
  1340.  
  1341. /**
  1342.  * cairo_path_data_t:
  1343.  *
  1344.  * #cairo_path_data_t is used to represent the path data inside a
  1345.  * #cairo_path_t.
  1346.  *
  1347.  * The data structure is designed to try to balance the demands of
  1348.  * efficiency and ease-of-use. A path is represented as an array of
  1349.  * #cairo_path_data_t, which is a union of headers and points.
  1350.  *
  1351.  * Each portion of the path is represented by one or more elements in
  1352.  * the array, (one header followed by 0 or more points). The length
  1353.  * value of the header is the number of array elements for the current
  1354.  * portion including the header, (ie. length == 1 + # of points), and
  1355.  * where the number of points for each element type is as follows:
  1356.  *
  1357.  * <programlisting>
  1358.  *     %CAIRO_PATH_MOVE_TO:     1 point
  1359.  *     %CAIRO_PATH_LINE_TO:     1 point
  1360.  *     %CAIRO_PATH_CURVE_TO:    3 points
  1361.  *     %CAIRO_PATH_CLOSE_PATH:  0 points
  1362.  * </programlisting>
  1363.  *
  1364.  * The semantics and ordering of the coordinate values are consistent
  1365.  * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
  1366.  * cairo_close_path().
  1367.  *
  1368.  * Here is sample code for iterating through a #cairo_path_t:
  1369.  *
  1370.  * <informalexample><programlisting>
  1371.  *      int i;
  1372.  *      #cairo_path_t *path;
  1373.  *      #cairo_path_data_t *data;
  1374.  *  
  1375.  *      path = cairo_copy_path (cr);
  1376.  *  
  1377.  *      for (i=0; i < path->num_data; i += path->data[i].header.length) {
  1378.  *          data = &path->data[i];
  1379.  *          switch (data->header.type) {
  1380.  *          case %CAIRO_PATH_MOVE_TO:
  1381.  *              do_move_to_things (data[1].point.x, data[1].point.y);
  1382.  *              break;
  1383.  *          case %CAIRO_PATH_LINE_TO:
  1384.  *              do_line_to_things (data[1].point.x, data[1].point.y);
  1385.  *              break;
  1386.  *          case %CAIRO_PATH_CURVE_TO:
  1387.  *              do_curve_to_things (data[1].point.x, data[1].point.y,
  1388.  *                                  data[2].point.x, data[2].point.y,
  1389.  *                                  data[3].point.x, data[3].point.y);
  1390.  *              break;
  1391.  *          case %CAIRO_PATH_CLOSE_PATH:
  1392.  *              do_close_path_things ();
  1393.  *              break;
  1394.  *          }
  1395.  *      }
  1396.  *      cairo_path_destroy (path);
  1397.  * </programlisting></informalexample>
  1398.  *
  1399.  * As of cairo 1.4, cairo does not mind if there are more elements in
  1400.  * a portion of the path than needed.  Such elements can be used by
  1401.  * users of the cairo API to hold extra values in the path data
  1402.  * structure.  For this reason, it is recommended that applications
  1403.  * always use <literal>data->header.length</literal> to
  1404.  * iterate over the path data, instead of hardcoding the number of
  1405.  * elements for each element type.
  1406.  **/
  1407. typedef union _cairo_path_data_t cairo_path_data_t;
  1408. union _cairo_path_data_t {
  1409.     struct {
  1410.     cairo_path_data_type_t type;
  1411.     int length;
  1412.     } header;
  1413.     struct {
  1414.     double x, y;
  1415.     } point;
  1416. };
  1417.  
  1418. /**
  1419.  * cairo_path_t:
  1420.  * @status: the current error status
  1421.  * @data: the elements in the path
  1422.  * @num_data: the number of elements in the data array
  1423.  *
  1424.  * A data structure for holding a path. This data structure serves as
  1425.  * the return value for cairo_copy_path() and
  1426.  * cairo_copy_path_flat() as well the input value for
  1427.  * cairo_append_path().
  1428.  *
  1429.  * See #cairo_path_data_t for hints on how to iterate over the
  1430.  * actual data within the path.
  1431.  *
  1432.  * The num_data member gives the number of elements in the data
  1433.  * array. This number is larger than the number of independent path
  1434.  * portions (defined in #cairo_path_data_type_t), since the data
  1435.  * includes both headers and coordinates for each portion.
  1436.  **/
  1437. typedef struct cairo_path {
  1438.     cairo_status_t status;
  1439.     cairo_path_data_t *data;
  1440.     int num_data;
  1441. } cairo_path_t;
  1442.  
  1443. cairo_public cairo_path_t *
  1444. cairo_copy_path (cairo_t *cr);
  1445.  
  1446. cairo_public cairo_path_t *
  1447. cairo_copy_path_flat (cairo_t *cr);
  1448.  
  1449. cairo_public void
  1450. cairo_append_path (cairo_t        *cr,
  1451.            const cairo_path_t    *path);
  1452.  
  1453. cairo_public void
  1454. cairo_path_destroy (cairo_path_t *path);
  1455.  
  1456. /* Error status queries */
  1457.  
  1458. cairo_public cairo_status_t
  1459. cairo_status (cairo_t *cr);
  1460.  
  1461. cairo_public const char *
  1462. cairo_status_to_string (cairo_status_t status);
  1463.  
  1464. /* Surface manipulation */
  1465.  
  1466. cairo_public cairo_surface_t *
  1467. cairo_surface_create_similar (cairo_surface_t  *other,
  1468.                   cairo_content_t    content,
  1469.                   int        width,
  1470.                   int        height);
  1471.  
  1472. cairo_public cairo_surface_t *
  1473. cairo_surface_reference (cairo_surface_t *surface);
  1474.  
  1475. cairo_public void
  1476. cairo_surface_finish (cairo_surface_t *surface);
  1477.  
  1478. cairo_public void
  1479. cairo_surface_destroy (cairo_surface_t *surface);
  1480.  
  1481. cairo_public unsigned int
  1482. cairo_surface_get_reference_count (cairo_surface_t *surface);
  1483.  
  1484. cairo_public cairo_status_t
  1485. cairo_surface_status (cairo_surface_t *surface);
  1486.  
  1487. /**
  1488.  * cairo_surface_type_t:
  1489.  * @CAIRO_SURFACE_TYPE_IMAGE: The surface is of type image
  1490.  * @CAIRO_SURFACE_TYPE_PDF: The surface is of type pdf
  1491.  * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps
  1492.  * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib
  1493.  * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb
  1494.  * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz
  1495.  * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz
  1496.  * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32
  1497.  * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos
  1498.  * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb
  1499.  * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg
  1500.  * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2
  1501.  * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface
  1502.  * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image
  1503.  *
  1504.  * #cairo_surface_type_t is used to describe the type of a given
  1505.  * surface. The surface types are also known as "backends" or "surface
  1506.  * backends" within cairo.
  1507.  *
  1508.  * The type of a surface is determined by the function used to create
  1509.  * it, which will generally be of the form cairo_<emphasis>type</emphasis>_surface_create(),
  1510.  * (though see cairo_surface_create_similar() as well).
  1511.  *
  1512.  * The surface type can be queried with cairo_surface_get_type()
  1513.  *
  1514.  * The various #cairo_surface_t functions can be used with surfaces of
  1515.  * any type, but some backends also provide type-specific functions
  1516.  * that must only be called with a surface of the appropriate
  1517.  * type. These functions have names that begin with
  1518.  * cairo_<emphasis>type</emphasis>_surface such as cairo_image_surface_get_width().
  1519.  *
  1520.  * The behavior of calling a type-specific function with a surface of
  1521.  * the wrong type is undefined.
  1522.  *
  1523.  * New entries may be added in future versions.
  1524.  *
  1525.  * Since: 1.2
  1526.  **/
  1527. typedef enum _cairo_surface_type {
  1528.     CAIRO_SURFACE_TYPE_IMAGE,
  1529.     CAIRO_SURFACE_TYPE_PDF,
  1530.     CAIRO_SURFACE_TYPE_PS,
  1531.     CAIRO_SURFACE_TYPE_XLIB,
  1532.     CAIRO_SURFACE_TYPE_XCB,
  1533.     CAIRO_SURFACE_TYPE_GLITZ,
  1534.     CAIRO_SURFACE_TYPE_QUARTZ,
  1535.     CAIRO_SURFACE_TYPE_WIN32,
  1536.     CAIRO_SURFACE_TYPE_BEOS,
  1537.     CAIRO_SURFACE_TYPE_DIRECTFB,
  1538.     CAIRO_SURFACE_TYPE_SVG,
  1539.     CAIRO_SURFACE_TYPE_OS2,
  1540.     CAIRO_SURFACE_TYPE_WIN32_PRINTING,
  1541.     CAIRO_SURFACE_TYPE_QUARTZ_IMAGE
  1542. } cairo_surface_type_t;
  1543.  
  1544. cairo_public cairo_surface_type_t
  1545. cairo_surface_get_type (cairo_surface_t *surface);
  1546.  
  1547. cairo_public cairo_content_t
  1548. cairo_surface_get_content (cairo_surface_t *surface);
  1549.  
  1550. #if CAIRO_HAS_PNG_FUNCTIONS
  1551.  
  1552. cairo_public cairo_status_t
  1553. cairo_surface_write_to_png (cairo_surface_t    *surface,
  1554.                 const char        *filename);
  1555.  
  1556. cairo_public cairo_status_t
  1557. cairo_surface_write_to_png_stream (cairo_surface_t    *surface,
  1558.                    cairo_write_func_t    write_func,
  1559.                    void            *closure);
  1560.  
  1561. #endif
  1562.  
  1563. cairo_public void *
  1564. cairo_surface_get_user_data (cairo_surface_t         *surface,
  1565.                  const cairo_user_data_key_t *key);
  1566.  
  1567. cairo_public cairo_status_t
  1568. cairo_surface_set_user_data (cairo_surface_t         *surface,
  1569.                  const cairo_user_data_key_t *key,
  1570.                  void             *user_data,
  1571.                  cairo_destroy_func_t     destroy);
  1572.  
  1573. cairo_public void
  1574. cairo_surface_get_font_options (cairo_surface_t      *surface,
  1575.                 cairo_font_options_t *options);
  1576.  
  1577. cairo_public void
  1578. cairo_surface_flush (cairo_surface_t *surface);
  1579.  
  1580. cairo_public void
  1581. cairo_surface_mark_dirty (cairo_surface_t *surface);
  1582.  
  1583. cairo_public void
  1584. cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
  1585.                     int              x,
  1586.                     int              y,
  1587.                     int              width,
  1588.                     int              height);
  1589.  
  1590. cairo_public void
  1591. cairo_surface_set_device_offset (cairo_surface_t *surface,
  1592.                  double           x_offset,
  1593.                  double           y_offset);
  1594.  
  1595. cairo_public void
  1596. cairo_surface_get_device_offset (cairo_surface_t *surface,
  1597.                  double          *x_offset,
  1598.                  double          *y_offset);
  1599.  
  1600. cairo_public void
  1601. cairo_surface_set_fallback_resolution (cairo_surface_t    *surface,
  1602.                        double         x_pixels_per_inch,
  1603.                        double         y_pixels_per_inch);
  1604.  
  1605. cairo_public void
  1606. cairo_surface_copy_page (cairo_surface_t *surface);
  1607.  
  1608. cairo_public void
  1609. cairo_surface_show_page (cairo_surface_t *surface);
  1610.  
  1611. /* Image-surface functions */
  1612.  
  1613. /**
  1614.  * cairo_format_t:
  1615.  * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
  1616.  *   alpha in the upper 8 bits, then red, then green, then blue.
  1617.  *   The 32-bit quantities are stored native-endian. Pre-multiplied
  1618.  *   alpha is used. (That is, 50% transparent red is 0x80800000,
  1619.  *   not 0x80ff0000.)
  1620.  * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with
  1621.  *   the upper 8 bits unused. Red, Green, and Blue are stored
  1622.  *   in the remaining 24 bits in that order.
  1623.  * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding
  1624.  *   an alpha value.
  1625.  * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding
  1626.  *   an alpha value. Pixels are packed together into 32-bit
  1627.  *   quantities. The ordering of the bits matches the
  1628.  *   endianess of the platform. On a big-endian machine, the
  1629.  *   first pixel is in the uppermost bit, on a little-endian
  1630.  *   machine the first pixel is in the least-significant bit.
  1631.  * @CAIRO_FORMAT_RGB16_565: This format value is deprecated. It has
  1632.  *   never been properly implemented in cairo and should not be used
  1633.  *   by applications. (since 1.2)
  1634.  *
  1635.  * #cairo_format_t is used to identify the memory format of
  1636.  * image data.
  1637.  *
  1638.  * New entries may be added in future versions.
  1639.  **/
  1640. typedef enum _cairo_format {
  1641.     CAIRO_FORMAT_ARGB32,
  1642.     CAIRO_FORMAT_RGB24,
  1643.     CAIRO_FORMAT_A8,
  1644.     CAIRO_FORMAT_A1
  1645.     /* The value of 4 is reserved by a deprecated enum value.
  1646.      * The next format added must have an explicit value of 5.
  1647.     CAIRO_FORMAT_RGB16_565 = 4,
  1648.     */
  1649. } cairo_format_t;
  1650.  
  1651. cairo_public cairo_surface_t *
  1652. cairo_image_surface_create (cairo_format_t    format,
  1653.                 int            width,
  1654.                 int            height);
  1655.  
  1656. cairo_public int
  1657. cairo_format_stride_for_width (cairo_format_t    format,
  1658.                    int        width);
  1659.  
  1660. cairo_public cairo_surface_t *
  1661. cairo_image_surface_create_for_data (unsigned char           *data,
  1662.                      cairo_format_t        format,
  1663.                      int            width,
  1664.                      int            height,
  1665.                      int            stride);
  1666.  
  1667. cairo_public unsigned char *
  1668. cairo_image_surface_get_data (cairo_surface_t *surface);
  1669.  
  1670. cairo_public cairo_format_t
  1671. cairo_image_surface_get_format (cairo_surface_t *surface);
  1672.  
  1673. cairo_public int
  1674. cairo_image_surface_get_width (cairo_surface_t *surface);
  1675.  
  1676. cairo_public int
  1677. cairo_image_surface_get_height (cairo_surface_t *surface);
  1678.  
  1679. cairo_public int
  1680. cairo_image_surface_get_stride (cairo_surface_t *surface);
  1681.  
  1682. #if CAIRO_HAS_PNG_FUNCTIONS
  1683.  
  1684. cairo_public cairo_surface_t *
  1685. cairo_image_surface_create_from_png (const char    *filename);
  1686.  
  1687. cairo_public cairo_surface_t *
  1688. cairo_image_surface_create_from_png_stream (cairo_read_func_t    read_func,
  1689.                         void        *closure);
  1690.  
  1691. #endif
  1692.  
  1693. /* Pattern creation functions */
  1694.  
  1695. cairo_public cairo_pattern_t *
  1696. cairo_pattern_create_rgb (double red, double green, double blue);
  1697.  
  1698. cairo_public cairo_pattern_t *
  1699. cairo_pattern_create_rgba (double red, double green, double blue,
  1700.                double alpha);
  1701.  
  1702. cairo_public cairo_pattern_t *
  1703. cairo_pattern_create_for_surface (cairo_surface_t *surface);
  1704.  
  1705. cairo_public cairo_pattern_t *
  1706. cairo_pattern_create_linear (double x0, double y0,
  1707.                  double x1, double y1);
  1708.  
  1709. cairo_public cairo_pattern_t *
  1710. cairo_pattern_create_radial (double cx0, double cy0, double radius0,
  1711.                  double cx1, double cy1, double radius1);
  1712.  
  1713. cairo_public cairo_pattern_t *
  1714. cairo_pattern_reference (cairo_pattern_t *pattern);
  1715.  
  1716. cairo_public void
  1717. cairo_pattern_destroy (cairo_pattern_t *pattern);
  1718.  
  1719. cairo_public unsigned int
  1720. cairo_pattern_get_reference_count (cairo_pattern_t *pattern);
  1721.  
  1722. cairo_public cairo_status_t
  1723. cairo_pattern_status (cairo_pattern_t *pattern);
  1724.  
  1725. cairo_public void *
  1726. cairo_pattern_get_user_data (cairo_pattern_t         *pattern,
  1727.                  const cairo_user_data_key_t *key);
  1728.  
  1729. cairo_public cairo_status_t
  1730. cairo_pattern_set_user_data (cairo_pattern_t         *pattern,
  1731.                  const cairo_user_data_key_t *key,
  1732.                  void             *user_data,
  1733.                  cairo_destroy_func_t      destroy);
  1734.  
  1735. /**
  1736.  * cairo_pattern_type_t:
  1737.  * @CAIRO_PATTERN_TYPE_SOLID: The pattern is a solid (uniform)
  1738.  * color. It may be opaque or translucent.
  1739.  * @CAIRO_PATTERN_TYPE_SURFACE: The pattern is a based on a surface (an image).
  1740.  * @CAIRO_PATTERN_TYPE_LINEAR: The pattern is a linear gradient.
  1741.  * @CAIRO_PATTERN_TYPE_RADIAL: The pattern is a radial gradient.
  1742.  *
  1743.  * #cairo_pattern_type_t is used to describe the type of a given pattern.
  1744.  *
  1745.  * The type of a pattern is determined by the function used to create
  1746.  * it. The cairo_pattern_create_rgb() and cairo_pattern_create_rgba()
  1747.  * functions create SOLID patterns. The remaining
  1748.  * cairo_pattern_create functions map to pattern types in obvious
  1749.  * ways.
  1750.  *
  1751.  * The pattern type can be queried with cairo_pattern_get_type()
  1752.  *
  1753.  * Most #cairo_pattern_t functions can be called with a pattern of any
  1754.  * type, (though trying to change the extend or filter for a solid
  1755.  * pattern will have no effect). A notable exception is
  1756.  * cairo_pattern_add_color_stop_rgb() and
  1757.  * cairo_pattern_add_color_stop_rgba() which must only be called with
  1758.  * gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
  1759.  * will be shutdown and put into an error state.
  1760.  *
  1761.  * New entries may be added in future versions.
  1762.  *
  1763.  * Since: 1.2
  1764.  **/
  1765. typedef enum _cairo_pattern_type {
  1766.     CAIRO_PATTERN_TYPE_SOLID,
  1767.     CAIRO_PATTERN_TYPE_SURFACE,
  1768.     CAIRO_PATTERN_TYPE_LINEAR,
  1769.     CAIRO_PATTERN_TYPE_RADIAL
  1770. } cairo_pattern_type_t;
  1771.  
  1772. cairo_public cairo_pattern_type_t
  1773. cairo_pattern_get_type (cairo_pattern_t *pattern);
  1774.  
  1775. cairo_public void
  1776. cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern,
  1777.                   double offset,
  1778.                   double red, double green, double blue);
  1779.  
  1780. cairo_public void
  1781. cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern,
  1782.                    double offset,
  1783.                    double red, double green, double blue,
  1784.                    double alpha);
  1785.  
  1786. cairo_public void
  1787. cairo_pattern_set_matrix (cairo_pattern_t      *pattern,
  1788.               const cairo_matrix_t *matrix);
  1789.  
  1790. cairo_public void
  1791. cairo_pattern_get_matrix (cairo_pattern_t *pattern,
  1792.               cairo_matrix_t  *matrix);
  1793.  
  1794. /**
  1795.  * cairo_extend_t:
  1796.  * @CAIRO_EXTEND_NONE: pixels outside of the source pattern
  1797.  *   are fully transparent
  1798.  * @CAIRO_EXTEND_REPEAT: the pattern is tiled by repeating
  1799.  * @CAIRO_EXTEND_REFLECT: the pattern is tiled by reflecting
  1800.  *   at the edges (Implemented for surface patterns since 1.6)
  1801.  * @CAIRO_EXTEND_PAD: pixels outside of the pattern copy
  1802.  *   the closest pixel from the source (Since 1.2; but only
  1803.  *   implemented for surface patterns since 1.6)
  1804.  *
  1805.  * #cairo_extend_t is used to describe how pattern color/alpha will be
  1806.  * determined for areas "outside" the pattern's natural area, (for
  1807.  * example, outside the surface bounds or outside the gradient
  1808.  * geometry).
  1809.  *
  1810.  * The default extend mode is %CAIRO_EXTEND_NONE for surface patterns
  1811.  * and %CAIRO_EXTEND_PAD for gradient patterns.
  1812.  *
  1813.  * New entries may be added in future versions.
  1814.  **/
  1815. typedef enum _cairo_extend {
  1816.     CAIRO_EXTEND_NONE,
  1817.     CAIRO_EXTEND_REPEAT,
  1818.     CAIRO_EXTEND_REFLECT,
  1819.     CAIRO_EXTEND_PAD
  1820. } cairo_extend_t;
  1821.  
  1822. cairo_public void
  1823. cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend);
  1824.  
  1825. cairo_public cairo_extend_t
  1826. cairo_pattern_get_extend (cairo_pattern_t *pattern);
  1827.  
  1828. /**
  1829.  * cairo_filter_t:
  1830.  * @CAIRO_FILTER_FAST: A high-performance filter, with quality similar
  1831.  *     to %CAIRO_FILTER_NEAREST
  1832.  * @CAIRO_FILTER_GOOD: A reasonable-performance filter, with quality
  1833.  *     similar to %CAIRO_FILTER_BILINEAR
  1834.  * @CAIRO_FILTER_BEST: The highest-quality available, performance may
  1835.  *     not be suitable for interactive use.
  1836.  * @CAIRO_FILTER_NEAREST: Nearest-neighbor filtering
  1837.  * @CAIRO_FILTER_BILINEAR: Linear interpolation in two dimensions
  1838.  * @CAIRO_FILTER_GAUSSIAN: This filter value is currently
  1839.  *     unimplemented, and should not be used in current code.
  1840.  *
  1841.  * #cairo_filter_t is used to indicate what filtering should be
  1842.  * applied when reading pixel values from patterns. See
  1843.  * cairo_pattern_set_source() for indicating the desired filter to be
  1844.  * used with a particular pattern.
  1845.  */
  1846. typedef enum _cairo_filter {
  1847.     CAIRO_FILTER_FAST,
  1848.     CAIRO_FILTER_GOOD,
  1849.     CAIRO_FILTER_BEST,
  1850.     CAIRO_FILTER_NEAREST,
  1851.     CAIRO_FILTER_BILINEAR,
  1852.     CAIRO_FILTER_GAUSSIAN
  1853. } cairo_filter_t;
  1854.  
  1855. cairo_public void
  1856. cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);
  1857.  
  1858. cairo_public cairo_filter_t
  1859. cairo_pattern_get_filter (cairo_pattern_t *pattern);
  1860.  
  1861. cairo_public cairo_status_t
  1862. cairo_pattern_get_rgba (cairo_pattern_t *pattern,
  1863.             double *red, double *green,
  1864.             double *blue, double *alpha);
  1865.  
  1866. cairo_public cairo_status_t
  1867. cairo_pattern_get_surface (cairo_pattern_t *pattern,
  1868.                cairo_surface_t **surface);
  1869.  
  1870.  
  1871. cairo_public cairo_status_t
  1872. cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,
  1873.                    int index, double *offset,
  1874.                    double *red, double *green,
  1875.                    double *blue, double *alpha);
  1876.  
  1877. cairo_public cairo_status_t
  1878. cairo_pattern_get_color_stop_count (cairo_pattern_t *pattern,
  1879.                     int *count);
  1880.  
  1881. cairo_public cairo_status_t
  1882. cairo_pattern_get_linear_points (cairo_pattern_t *pattern,
  1883.                  double *x0, double *y0,
  1884.                  double *x1, double *y1);
  1885.  
  1886. cairo_public cairo_status_t
  1887. cairo_pattern_get_radial_circles (cairo_pattern_t *pattern,
  1888.                   double *x0, double *y0, double *r0,
  1889.                   double *x1, double *y1, double *r1);
  1890.  
  1891. /* Matrix functions */
  1892.  
  1893. cairo_public void
  1894. cairo_matrix_init (cairo_matrix_t *matrix,
  1895.            double  xx, double  yx,
  1896.            double  xy, double  yy,
  1897.            double  x0, double  y0);
  1898.  
  1899. cairo_public void
  1900. cairo_matrix_init_identity (cairo_matrix_t *matrix);
  1901.  
  1902. cairo_public void
  1903. cairo_matrix_init_translate (cairo_matrix_t *matrix,
  1904.                  double tx, double ty);
  1905.  
  1906. cairo_public void
  1907. cairo_matrix_init_scale (cairo_matrix_t *matrix,
  1908.              double sx, double sy);
  1909.  
  1910. cairo_public void
  1911. cairo_matrix_init_rotate (cairo_matrix_t *matrix,
  1912.               double radians);
  1913.  
  1914. cairo_public void
  1915. cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty);
  1916.  
  1917. cairo_public void
  1918. cairo_matrix_scale (cairo_matrix_t *matrix, double sx, double sy);
  1919.  
  1920. cairo_public void
  1921. cairo_matrix_rotate (cairo_matrix_t *matrix, double radians);
  1922.  
  1923. cairo_public cairo_status_t
  1924. cairo_matrix_invert (cairo_matrix_t *matrix);
  1925.  
  1926. cairo_public void
  1927. cairo_matrix_multiply (cairo_matrix_t        *result,
  1928.                const cairo_matrix_t *a,
  1929.                const cairo_matrix_t *b);
  1930.  
  1931. cairo_public void
  1932. cairo_matrix_transform_distance (const cairo_matrix_t *matrix,
  1933.                  double *dx, double *dy);
  1934.  
  1935. cairo_public void
  1936. cairo_matrix_transform_point (const cairo_matrix_t *matrix,
  1937.                   double *x, double *y);
  1938.  
  1939. /* Functions to be used while debugging (not intended for use in production code) */
  1940. cairo_public void
  1941. cairo_debug_reset_static_data (void);
  1942.  
  1943. CAIRO_END_DECLS
  1944.  
  1945. #endif /* CAIRO_H */
  1946.