Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
cairo.c File Reference
#include "cairoint.h"
#include "cairo-private.h"
#include "cairo-arc-private.h"
#include "cairo-path-data-private.h"
#include <assert.h>

Go to the source code of this file.

Defines

#define CAIRO_TOLERANCE_MINIMUM   0.0002 /* We're limited by 16 bits of sub-pixel precision */
#define CAIRO_STATUS_LAST_STATUS   CAIRO_STATUS_INVALID_DASH

Functions

void _cairo_error (cairo_status_t status)
 _cairo_error: : a status value indicating an error, (eg.
static void _cairo_set_error (cairo_t *cr, cairo_status_t status)
 _cairo_set_error: : a cairo context : a status value indicating an error, (eg.
int cairo_version (void)
 cairo_version:
const char * cairo_version_string (void)
 cairo_version_string:
cairo_t * cairo_create (cairo_surface_t *target)
 cairo_create: : target surface for the context
cairo_t * cairo_reference (cairo_t *cr)
 cairo_reference: : a #cairo_t
void cairo_destroy (cairo_t *cr)
 cairo_destroy: : a #cairo_t
void cairo_save (cairo_t *cr)
 cairo_save: : a #cairo_t
 slim_hidden_def (cairo_save)
void cairo_restore (cairo_t *cr)
 cairo_restore: : a #cairo_t
 slim_hidden_def (cairo_restore)
void cairo_set_operator (cairo_t *cr, cairo_operator_t op)
 cairo_set_operator: : a #cairo_t : a compositing operator, specified as a cairo_operator_t
void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue)
 cairo_set_source_rgb : a cairo context : red component of color : green component of color : blue component of color
void cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha)
 cairo_set_source_rgba: : a cairo context : red component of color : green component of color : blue component of color : alpha component of color
void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y)
 cairo_set_source_surface: : a cairo context : a surface to be used to set the source pattern : User-space X coordinate for surface origin : User-space Y coordinate for surface origin
void cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
 cairo_set_source : a cairo context : a #cairo_pattern_t to be used as the source for subsequent drawing operations.
cairo_pattern_t * cairo_get_source (cairo_t *cr)
 cairo_get_source: : a cairo context
void cairo_set_tolerance (cairo_t *cr, double tolerance)
 cairo_set_tolerance: : a #cairo_t : the tolerance, in device units (typically pixels)
void cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias)
 cairo_set_antialias: : a #cairo_t : the new antialiasing mode
void cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule)
 cairo_set_fill_rule: : a #cairo_t : a fill rule, specified as a cairo_fill_rule_t
void cairo_set_line_width (cairo_t *cr, double width)
 cairo_set_line_width: : a #cairo_t : a line width, as a user-space value
void cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap)
 cairo_set_line_cap: : a cairo context, as a #cairo_t : a line cap style, as a cairo_line_cap_t
void cairo_set_line_join (cairo_t *cr, cairo_line_join_t line_join)
 cairo_set_line_join: : a cairo context, as a #cairo_t : a line joint style, as a cairo_line_join_t
void cairo_set_dash (cairo_t *cr, double *dashes, int num_dashes, double offset)
 cairo_set_dash: : a cairo context : an array specifying alternate lengths of on and off po : the length of the dashes array : an offset into the dash pattern at which the stroke should start
void cairo_set_miter_limit (cairo_t *cr, double limit)
void cairo_translate (cairo_t *cr, double tx, double ty)
 cairo_translate: : a cairo context : amount to translate in the X direction : amount to translate in the Y direction
void cairo_scale (cairo_t *cr, double sx, double sy)
 cairo_scale: : a cairo context : scale factor for the X dimension : scale factor for the Y dimension
void cairo_rotate (cairo_t *cr, double angle)
 cairo_rotate: : a cairo context : angle (in radians) by which the user-space axes will be rotated
void cairo_transform (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_transform: : a cairo context : a transformation to be applied to the user-space axes
void cairo_set_matrix (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_set_matrix: : a cairo context : a transformation matrix from user space to device space
void cairo_identity_matrix (cairo_t *cr)
 cairo_identity_matrix: : a cairo context
void cairo_user_to_device (cairo_t *cr, double *x, double *y)
 cairo_user_to_device: : a cairo context : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)
void cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
 cairo_user_to_device_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)
void cairo_device_to_user (cairo_t *cr, double *x, double *y)
 cairo_device_to_user: : a cairo : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)
void cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy)
 cairo_device_to_user_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)
void cairo_new_path (cairo_t *cr)
 cairo_new_path: : a cairo context
 slim_hidden_def (cairo_new_path)
void cairo_move_to (cairo_t *cr, double x, double y)
 cairo_move_to: : a cairo context : the X coordinate of the new position : the Y coordinate of the new position
 slim_hidden_def (cairo_move_to)
void cairo_line_to (cairo_t *cr, double x, double y)
 cairo_line_to: : a cairo context : the X coordinate of the end of the new line : the Y coordinate of the end of the new line
void cairo_curve_to (cairo_t *cr, double x1, double y1, double x2, double y2, double x3, double y3)
 cairo_curve_to: : a cairo context : the X coordinate of the first control point : the Y coordinate of the first control point : the X coordinate of the second control point : the Y coordinate of the second control point : the X coordinate of the end of the curve : the Y coordinate of the end of the curve
void cairo_arc (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2)
 cairo_arc: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians
void cairo_arc_negative (cairo_t *cr, double xc, double yc, double radius, double angle1, double angle2)
 cairo_arc_negative: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians
void cairo_rel_move_to (cairo_t *cr, double dx, double dy)
 cairo_rel_move_to: : a cairo context : the X offset : the Y offset
void cairo_rel_line_to (cairo_t *cr, double dx, double dy)
 cairo_rel_line_to: : a cairo context : the X offset to the end of the new line : the Y offset to the end of the new line
 slim_hidden_def (cairo_rel_line_to)
void cairo_rel_curve_to (cairo_t *cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
 cairo_rel_curve_to: : a cairo context : the X offset to the first control point : the Y offset to the first control point : the X offset to the second control point : the Y offset to the second control point : the X offset to the end of the curve : the Y offset to the end of the curve
void cairo_rectangle (cairo_t *cr, double x, double y, double width, double height)
 cairo_rectangle: : a cairo context : the X coordinate of the top left corner of the rectangle : the Y coordinate to the top left corner of the rectangle : the width of the rectangle : the height of the rectangle
void cairo_close_path (cairo_t *cr)
 cairo_close_path: : a cairo context
 slim_hidden_def (cairo_close_path)
void cairo_paint (cairo_t *cr)
 cairo_paint: : a cairo context
void cairo_paint_with_alpha (cairo_t *cr, double alpha)
 cairo_paint_with_alpha: : a cairo context : alpha value, between 0 (transparent) and 1 (opaque)
void cairo_mask (cairo_t *cr, cairo_pattern_t *pattern)
 cairo_mask: : a cairo context : a #cairo_pattern_t
void cairo_mask_surface (cairo_t *cr, cairo_surface_t *surface, double surface_x, double surface_y)
 cairo_mask_surface: : a cairo context : a #cairo_surface_t : X coordinate at which to place the origin of : Y coordinate at which to place the origin of
void cairo_stroke (cairo_t *cr)
 cairo_stroke: : a cairo context
void cairo_stroke_preserve (cairo_t *cr)
 cairo_stroke_preserve: : a cairo context
 slim_hidden_def (cairo_stroke_preserve)
void cairo_fill (cairo_t *cr)
 cairo_fill: : a cairo context
void cairo_fill_preserve (cairo_t *cr)
 cairo_fill_preserve: : a cairo context
 slim_hidden_def (cairo_fill_preserve)
void cairo_copy_page (cairo_t *cr)
void cairo_show_page (cairo_t *cr)
cairo_bool_t cairo_in_stroke (cairo_t *cr, double x, double y)
cairo_bool_t cairo_in_fill (cairo_t *cr, double x, double y)
void cairo_stroke_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2)
void cairo_fill_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2)
void cairo_clip (cairo_t *cr)
 cairo_clip: : a cairo context
void cairo_clip_preserve (cairo_t *cr)
 cairo_clip_preserve: : a cairo context
 slim_hidden_def (cairo_clip_preserve)
void cairo_reset_clip (cairo_t *cr)
 cairo_reset_clip: : a cairo context
void cairo_select_font_face (cairo_t *cr, const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight)
 cairo_select_font_face: : a #cairo_t : a font family name, encoded in UTF-8 : the slant for the font : the weight for the font
cairo_font_face_t * cairo_get_font_face (cairo_t *cr)
 cairo_get_font_face: : a #cairo_t
void cairo_font_extents (cairo_t *cr, cairo_font_extents_t *extents)
 cairo_font_extents: : a #cairo_t : a cairo_font_extents_t object into which the results will be stored.
void cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face)
 cairo_set_font_face: : a #cairo_t : a #cairo_font_face_t, or NULL to restore to the default font
void cairo_set_font_size (cairo_t *cr, double size)
 cairo_set_font_size: : a #cairo_t : the new font size, in user space units
void cairo_set_font_matrix (cairo_t *cr, const cairo_matrix_t *matrix)
 cairo_set_font_matrix : a #cairo_t : a cairo_matrix_t describing a transform to be applied to the current font.
void cairo_get_font_matrix (cairo_t *cr, cairo_matrix_t *matrix)
 cairo_get_font_matrix : a #cairo_t : return value for the matrix
void cairo_set_font_options (cairo_t *cr, const cairo_font_options_t *options)
 cairo_set_font_options: : a #cairo_t : font options to use
void cairo_get_font_options (cairo_t *cr, cairo_font_options_t *options)
 cairo_get_font_options: : a #cairo_t : a #cairo_font_options_t object into which to store the retrieved options.
void cairo_text_extents (cairo_t *cr, const char *utf8, cairo_text_extents_t *extents)
 cairo_text_extents: : a #cairo_t : a string of text, encoded in UTF-8 : a cairo_text_extents_t object into which the results will be stored
void cairo_glyph_extents (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs, cairo_text_extents_t *extents)
 cairo_glyph_extents: : a #cairo_t : an array of cairo_glyph_t objects : the number of elements in : a cairo_text_extents_t object into which the results will be stored
void cairo_show_text (cairo_t *cr, const char *utf8)
 cairo_show_text: : a cairo context : a string of text encoded in UTF-8
void cairo_show_glyphs (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
void cairo_text_path (cairo_t *cr, const char *utf8)
void cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs)
cairo_operator_t cairo_get_operator (cairo_t *cr)
 cairo_get_operator: : a cairo context
double cairo_get_tolerance (cairo_t *cr)
 cairo_get_tolerance: : a cairo context
cairo_antialias_t cairo_get_antialias (cairo_t *cr)
 cairo_get_antialias: : a cairo context
void cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)
 cairo_get_current_point: : a cairo context : return value for X coordinate of the current point : return value for Y coordinate of the current point
 slim_hidden_def (cairo_get_current_point)
cairo_fill_rule_t cairo_get_fill_rule (cairo_t *cr)
 cairo_get_fill_rule: : a cairo context
double cairo_get_line_width (cairo_t *cr)
 cairo_get_line_width: : a cairo context
cairo_line_cap_t cairo_get_line_cap (cairo_t *cr)
 cairo_get_line_cap: : a cairo context
cairo_line_join_t cairo_get_line_join (cairo_t *cr)
 cairo_get_line_join: : a cairo context
double cairo_get_miter_limit (cairo_t *cr)
 cairo_get_miter_limit: : a cairo context
void cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix)
 cairo_get_matrix: : a cairo context : return value for the matrix
cairo_surface_t * cairo_get_target (cairo_t *cr)
 cairo_get_target: : a cairo context
cairo_path_tcairo_copy_path (cairo_t *cr)
 cairo_copy_path: : a cairo context
cairo_path_tcairo_copy_path_flat (cairo_t *cr)
 cairo_copy_path_flat: : a cairo context
void cairo_append_path (cairo_t *cr, cairo_path_t *path)
 cairo_append_path: : a cairo context : path to be appended
cairo_status_t cairo_status (cairo_t *cr)
 cairo_status: : a cairo context
const char * cairo_status_to_string (cairo_status_t status)
 cairo_status_to_string: : a cairo status
void _cairo_restrict_value (double *value, double min, double max)

Variables

static const cairo_t cairo_nil

Define Documentation

Definition at line 65 of file cairo.c.

#define CAIRO_TOLERANCE_MINIMUM   0.0002 /* We're limited by 16 bits of sub-pixel precision */

Definition at line 44 of file cairo.c.


Function Documentation

_cairo_error: : a status value indicating an error, (eg.

not CAIRO_STATUS_SUCCESS)

Checks that status is an error status, but does nothing else.

All assignments of an error status to any user-visible object within the cairo application should result in a call to _cairo_error().

The purpose of this function is to allow the user to set a breakpoint in _cairo_error() to generate a stack trace for when the user causes cairo to detect an error.

Definition at line 83 of file cairo.c.

void _cairo_restrict_value ( double *  value,
double  min,
double  max 
)

Definition at line 2599 of file cairo.c.

{
    if (*value < min)
       *value = min;
    else if (*value > max)
       *value = max;
}

Here is the caller graph for this function:

static void _cairo_set_error ( cairo_t *  cr,
cairo_status_t  status 
) [static]

_cairo_set_error: : a cairo context : a status value indicating an error, (eg.

not CAIRO_STATUS_SUCCESS)

Sets cr->status to and calls _cairo_error;

All assignments of an error status to cr->status should happen through _cairo_set_error() or else _cairo_error() should be called immediately after the assignment.

The purpose of this function is to allow the user to set a breakpoint in _cairo_error() to generate a stack trace for when the user causes cairo to detect an error.

Definition at line 106 of file cairo.c.

{
    /* Don't overwrite an existing error. This preserves the first
     * error, which is the most significant. It also avoids attempting
     * to write to read-only data (eg. from a nil cairo_t). */
    if (cr->status == CAIRO_STATUS_SUCCESS)
       cr->status = status;

    _cairo_error (status);
}

Here is the call graph for this function:

void cairo_append_path ( cairo_t *  cr,
cairo_path_t path 
)

cairo_append_path: : a cairo context : path to be appended

Append the onto the current path. The may be either the return value from one of cairo_copy_path() or cairo_copy_path_flat() or it may be constructed manually. See

cairo_path_t for details on how the path data structure should be

initialized, and note that <literal>path->status</literal> must be initialized to CAIRO_STATUS_SUCCESS.

Definition at line 2498 of file cairo.c.

{
    if (cr->status)
       return;

    if (path == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    if (path->status) {
       if (path->status <= CAIRO_STATUS_LAST_STATUS)
           _cairo_set_error (cr, path->status);
       else
           _cairo_set_error (cr, CAIRO_STATUS_INVALID_STATUS);
       return;
    }

    if (path->data == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    cr->status = _cairo_path_data_append_to_context (path, cr);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_arc ( cairo_t *  cr,
double  xc,
double  yc,
double  radius,
double  angle1,
double  angle2 
)

cairo_arc: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians

Adds a circular arc of the given to the current path. The arc is centered at (, ), begins at and proceeds in the direction of increasing angles to end at . If is less than it will be progressively increased by 2*M_PI until it is greater than .

If there is a current point, an initial line segment will be added to the path to connect the current point to the beginning of the arc.

Angles are measured in radians. An angle of 0 is in the direction of the positive X axis (in user-space). An angle of M_PI radians (90 degrees) is in the direction of the positive Y axis (in user-space). Angles increase in the direction from the positive X axis toward the positive Y axis. So with the default transformation matrix, angles increase in a clockwise direction.

(To convert from degrees to radians, use <literal>degrees * (M_PI / 180.)</literal>.)

This function gives the arc in the direction of increasing angles; see cairo_arc_negative() to get the arc in the direction of decreasing angles.

The arc is circular in user-space. To achieve an elliptical arc, you can scale the current transformation matrix by different amounts in the X and Y directions. For example, to draw an ellipse in the box given by , , , :

<informalexample><programlisting> cairo_save (cr); cairo_translate (x + width / 2., y + height / 2.); cairo_scale (1. / (height / 2.), 1. / (width / 2.)); cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI); cairo_restore (cr); </programlisting></informalexample>

Definition at line 1123 of file cairo.c.

{
    if (cr->status)
       return;

    /* Do nothing, successfully, if radius is <= 0 */
    if (radius <= 0.0)
       return;

    while (angle2 < angle1)
       angle2 += 2 * M_PI;

    cairo_line_to (cr,
                 xc + radius * cos (angle1),
                 yc + radius * sin (angle1));

    _cairo_arc_path (cr, xc, yc, radius,
                   angle1, angle2);
}

Here is the call graph for this function:

void cairo_arc_negative ( cairo_t *  cr,
double  xc,
double  yc,
double  radius,
double  angle1,
double  angle2 
)

cairo_arc_negative: : a cairo context : X position of the center of the arc : Y position of the center of the arc : the radius of the arc : the start angle, in radians : the end angle, in radians

Adds a circular arc of the given to the current path. The arc is centered at (, ), begins at and proceeds in the direction of decreasing angles to end at . If is greater than it will be progressively decreased by 2*M_PI until it is greater than .

See cairo_arc() for more details. This function differs only in the direction of the arc between the two angles.

Definition at line 1165 of file cairo.c.

{
    if (cr->status)
       return;

    /* Do nothing, successfully, if radius is <= 0 */
    if (radius <= 0.0)
       return;

    while (angle2 > angle1)
       angle2 -= 2 * M_PI;

    cairo_line_to (cr,
                 xc + radius * cos (angle1),
                 yc + radius * sin (angle1));

     _cairo_arc_path_negative (cr, xc, yc, radius,
                            angle1, angle2);
}

Here is the call graph for this function:

void cairo_clip ( cairo_t *  cr)

cairo_clip: : a cairo context

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by cairo_fill() and according to the current fill rule (see cairo_set_fill_rule()).

After cairo_clip, the current path will be cleared from the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling cairo_clip() can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling cairo_clip() within a cairo_save()/cairo_restore() pair. The only other means of increasing the size of the clip region is cairo_reset_clip().

Definition at line 1713 of file cairo.c.

void cairo_clip_preserve ( cairo_t *  cr)

cairo_clip_preserve: : a cairo context

Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by cairo_fill() and according to the current fill rule (see cairo_set_fill_rule()).

Unlike cairo_clip(), cairo_clip_preserve preserves the path within the cairo context.

The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region.

Calling cairo_clip() can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling cairo_clip() within a cairo_save()/cairo_restore() pair. The only other means of increasing the size of the clip region is cairo_reset_clip().

Definition at line 1743 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_clip (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_close_path ( cairo_t *  cr)

cairo_close_path: : a cairo context

Adds a line segment to the path from the current point to the beginning of the current subpath, (the most recent point passed to cairo_move_to()), and closes this subpath.

The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() with the equivalent coordinate in the case of stroking. When a closed subpath is stroked, there are no caps on the ends of the subpath. Instead, their is a line join connecting the final and initial segments of the subpath.

Definition at line 1385 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_path_fixed_close_path (&cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_copy_page ( cairo_t *  cr)

Definition at line 1605 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_copy_page (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_path_t* cairo_copy_path ( cairo_t *  cr)

cairo_copy_path: : a cairo context

Creates a copy of the current path and returns it to the user as a

cairo_path_t. See #cairo_path_data_t for hints on how to iterate

over the returned data structure.

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

This function will always return a valid pointer, but the result will have no data (<literal>data==NULL</literal> and <literal>num_data==0</literal>), if either of the following conditions hold:

<orderedlist> <listitem>If there is insufficient memory to copy the path.</listitem> <listitem>If is already in an error state.</listitem> </orderedlist>

In either case, <literal>path->status</literal> will be set to CAIRO_STATUS_NO_MEMORY (regardless of what the error status in might have been).

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

Definition at line 2435 of file cairo.c.

{
    if (cr->status)
       return (cairo_path_t*) &_cairo_path_nil;

    return _cairo_path_data_create (&cr->path, cr->gstate);
}

Here is the call graph for this function:

cairo_path_t* cairo_copy_path_flat ( cairo_t *  cr)

cairo_copy_path_flat: : a cairo context

Gets a flattened copy of the current path and returns it to the user as a cairo_path_t. See #cairo_path_data_t for hints on how to iterate over the returned data structure.

This function is like cairo_copy_path() except that any curves in the path will be approximated with piecewise-linear approximations, (accurate to within the current tolerance value). That is, the result is guaranteed to not have any elements of type CAIRO_PATH_CURVE_TO which will instead be replaced by a series of CAIRO_PATH_LINE_TO elements.

This function will always return a valid pointer, but the result will have no data (<literal>data==NULL</literal> and <literal>num_data==0</literal>), if either of the following conditions hold:

<orderedlist> <listitem>If there is insufficient memory to copy the path. In this case <literal>path->status</literal> will be set to CAIRO_STATUS_NO_MEMORY.</listitem> <listitem>If is already in an error state. In this case <literal>path->status</literal> will contain the same status that would be returned by cairo_status().</listitem> </orderedlist>

Return value: the copy of the current path. The caller owns the returned object and should call cairo_path_destroy() when finished with it.

Definition at line 2477 of file cairo.c.

{
    if (cr->status)
       return (cairo_path_t*) &_cairo_path_nil;
    else
       return _cairo_path_data_create_flat (&cr->path, cr->gstate);
}

Here is the call graph for this function:

cairo_t* cairo_create ( cairo_surface_t *  target)

cairo_create: : target surface for the context

Creates a new #cairo_t with all graphics state parameters set to default values and with as a target surface. The target surface should be constructed with a backend-specific function such as cairo_image_surface_create() (or any other <literal>cairo_<backend>_surface_create</literal> variant).

This function references , so you can immediately call cairo_surface_destroy() on it if you don't need to maintain a separate reference to it.

Return value: a newly allocated #cairo_t with a reference count of 1. The initial reference count should be released with cairo_destroy() when you are done using the #cairo_t. This function never returns NULL. If memory cannot be allocated, a special #cairo_t object will be returned on which cairo_status() returns CAIRO_STATUS_NO_MEMORY. You can use this object normally, but no drawing will be done.

Definition at line 183 of file cairo.c.

{
    cairo_t *cr;

    cr = malloc (sizeof (cairo_t));
    if (cr == NULL)
       return (cairo_t *) &cairo_nil;

    cr->ref_count = 1;

    cr->status = CAIRO_STATUS_SUCCESS;

    _cairo_path_fixed_init (&cr->path);

    if (target == NULL) {
       cr->gstate = NULL;
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return cr;
    }

    cr->gstate = _cairo_gstate_create (target);
    if (cr->gstate == NULL)
       _cairo_set_error (cr, CAIRO_STATUS_NO_MEMORY);

    return cr;
}

Here is the call graph for this function:

void cairo_curve_to ( cairo_t *  cr,
double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3 
)

cairo_curve_to: : a cairo context : the X coordinate of the first control point : the Y coordinate of the first control point : the X coordinate of the second control point : the Y coordinate of the second control point : the X coordinate of the end of the curve : the Y coordinate of the end of the curve

Adds a cubic Bézier spline to the path from the current point to position (, ) in user-space coordinates, using (, ) and (, ) as the control points. After this call the current point will be (, ).

Definition at line 1043 of file cairo.c.

{
    cairo_fixed_t x1_fixed, y1_fixed;
    cairo_fixed_t x2_fixed, y2_fixed;
    cairo_fixed_t x3_fixed, y3_fixed;
       
    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x1, &y1);
    _cairo_gstate_user_to_backend (cr->gstate, &x2, &y2);
    _cairo_gstate_user_to_backend (cr->gstate, &x3, &y3);

    x1_fixed = _cairo_fixed_from_double (x1);
    y1_fixed = _cairo_fixed_from_double (y1);

    x2_fixed = _cairo_fixed_from_double (x2);
    y2_fixed = _cairo_fixed_from_double (y2);

    x3_fixed = _cairo_fixed_from_double (x3);
    y3_fixed = _cairo_fixed_from_double (y3);

    cr->status = _cairo_path_fixed_curve_to (&cr->path,
                                        x1_fixed, y1_fixed,
                                        x2_fixed, y2_fixed,
                                        x3_fixed, y3_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_destroy ( cairo_t *  cr)

cairo_destroy: : a #cairo_t

Decreases the reference count on by one. If the result is zero, then and all associated resources are freed. See cairo_reference().

Definition at line 242 of file cairo.c.

{
    if (cr->ref_count == (unsigned int)-1)
       return;

    assert (cr->ref_count > 0);
    
    cr->ref_count--;
    if (cr->ref_count)
       return;

    while (cr->gstate) {
       cairo_gstate_t *tmp = cr->gstate;
       cr->gstate = tmp->next;

       _cairo_gstate_destroy (tmp);
    }

    _cairo_path_fixed_fini (&cr->path);

    free (cr);
}

Here is the call graph for this function:

void cairo_device_to_user ( cairo_t *  cr,
double *  x,
double *  y 
)

cairo_device_to_user: : a cairo : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)

Transform a coordinate from device space to user space by multiplying the given point by the inverse of the current transformation matrix (CTM).

Definition at line 924 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_device_to_user (cr->gstate, x, y);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_device_to_user_distance ( cairo_t *  cr,
double *  dx,
double *  dy 
)

cairo_device_to_user_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)

Transform a distance vector from device space to user space. This function is similar to cairo_device_to_user() except that the translation components of the inverse CTM will be ignored when transforming (,).

Definition at line 946 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_device_to_user_distance (cr->gstate, dx, dy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_fill ( cairo_t *  cr)

cairo_fill: : a cairo context

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). After cairo_fill, the current path will be cleared from the cairo context. See cairo_set_fill_rule() and cairo_fill_preserve().

Definition at line 1574 of file cairo.c.

void cairo_fill_extents ( cairo_t *  cr,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1677 of file cairo.c.

{
    if (cr->status)
       return;
    
    cr->status = _cairo_gstate_fill_extents (cr->gstate,
                                        &cr->path,
                                        x1, y1, x2, y2);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_fill_preserve ( cairo_t *  cr)

cairo_fill_preserve: : a cairo context

A drawing operator that fills the current path according to the current fill rule, (each sub-path is implicitly closed before being filled). Unlike cairo_fill(), cairo_fill_preserve preserves the path within the cairo context.

See cairo_set_fill_rule() and cairo_fill().

Definition at line 1593 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_fill (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_font_extents ( cairo_t *  cr,
cairo_font_extents_t extents 
)

cairo_font_extents: : a #cairo_t : a cairo_font_extents_t object into which the results will be stored.

Gets the font extents for the currently selected font.

Definition at line 1847 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_get_antialias: : a cairo context

Gets the current shape antialiasing mode, as set by cairo_set_shape_antialias().

Return value: the current shape antialiasing mode.

Definition at line 2246 of file cairo.c.

{
    return _cairo_gstate_get_antialias (cr->gstate);
}

Here is the call graph for this function:

void cairo_get_current_point ( cairo_t *  cr,
double *  x_ret,
double *  y_ret 
)

cairo_get_current_point: : a cairo context : return value for X coordinate of the current point : return value for Y coordinate of the current point

Gets the current point of the current path, which is conceptually the final point reached by the path so far.

The current point is returned in the user-space coordinate system. If there is no defined current point then and will both be set to 0.0.

Most path construction functions alter the current point. See the following for details on how they affect the current point:

cairo_new_path(), cairo_move_to(), cairo_line_to(), cairo_curve_to(), cairo_arc(), cairo_rel_move_to(), cairo_rel_line_to(), cairo_rel_curve_to(), cairo_arc(), cairo_text_path(), cairo_stroke_to_path()

Definition at line 2273 of file cairo.c.

{
    cairo_status_t status;
    cairo_fixed_t x_fixed, y_fixed;
    double x, y;

    status = _cairo_path_fixed_get_current_point (&cr->path, &x_fixed, &y_fixed);
    if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
       x = 0.0;
       y = 0.0;
    } else {
       x = _cairo_fixed_to_double (x_fixed);
       y = _cairo_fixed_to_double (y_fixed);
       _cairo_gstate_backend_to_user (cr->gstate, &x, &y);
    }

    if (x_ret)
       *x_ret = x;
    if (y_ret)
       *y_ret = y;
}

Here is the call graph for this function:

cairo_get_fill_rule: : a cairo context

Gets the current fill rule, as set by cairo_set_fill_rule().

Return value: the current fill rule.

Definition at line 2305 of file cairo.c.

{
    return _cairo_gstate_get_fill_rule (cr->gstate);
}

Here is the call graph for this function:

cairo_font_face_t* cairo_get_font_face ( cairo_t *  cr)

cairo_get_font_face: : a #cairo_t

Gets the current font face for a #cairo_t.

Return value: the current font object. Can return NULL on out-of-memory or if the context is already in an error state. This object is owned by cairo. To keep a reference to it, you must call cairo_font_face_reference().

Definition at line 1822 of file cairo.c.

{
    cairo_font_face_t *font_face;

    if (cr->status)
       return (cairo_font_face_t*) &_cairo_font_face_nil;

    cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face);
    if (cr->status) {
       _cairo_set_error (cr, cr->status);
       return (cairo_font_face_t*) &_cairo_font_face_nil;
    }

    return font_face;
}

Here is the call graph for this function:

void cairo_get_font_matrix ( cairo_t *  cr,
cairo_matrix_t matrix 
)

cairo_get_font_matrix : a #cairo_t : return value for the matrix

Stores the current font matrix into . See cairo_set_font_matrix().

Definition at line 1935 of file cairo.c.

{
    _cairo_gstate_get_font_matrix (cr->gstate, matrix);
}

Here is the call graph for this function:

void cairo_get_font_options ( cairo_t *  cr,
cairo_font_options_t *  options 
)

cairo_get_font_options: : a #cairo_t : a #cairo_font_options_t object into which to store the retrieved options.

All existing values are overwritten

Retrieves font rendering options set via cairo_set_font_options. Note that the returned options do not include any options derived from the underlying surface; they are literally the options passed to cairo_set_font_options().

Definition at line 1975 of file cairo.c.

Here is the call graph for this function:

cairo_get_line_cap: : a cairo context

Gets the current line cap style, as set by cairo_set_line_cap().

Return value: the current line cap style.

Definition at line 2333 of file cairo.c.

{
    return _cairo_gstate_get_line_cap (cr->gstate);
}

Here is the call graph for this function:

cairo_get_line_join: : a cairo context

Gets the current line join style, as set by cairo_set_line_join().

Return value: the current line join style.

Definition at line 2347 of file cairo.c.

{
    return _cairo_gstate_get_line_join (cr->gstate);
}

Here is the call graph for this function:

double cairo_get_line_width ( cairo_t *  cr)

cairo_get_line_width: : a cairo context

Gets the current line width, as set by cairo_set_line_width().

Return value: the current line width, in user-space units.

Definition at line 2319 of file cairo.c.

{
    return _cairo_gstate_get_line_width (cr->gstate);
}

Here is the call graph for this function:

void cairo_get_matrix ( cairo_t *  cr,
cairo_matrix_t matrix 
)

cairo_get_matrix: : a cairo context : return value for the matrix

Stores the current transformation matrix (CTM) into .

Definition at line 2374 of file cairo.c.

{
    _cairo_gstate_get_matrix (cr->gstate, matrix);
}

Here is the call graph for this function:

double cairo_get_miter_limit ( cairo_t *  cr)

cairo_get_miter_limit: : a cairo context

Gets the current miter limit, as set by cairo_set_miter_limit().

Return value: the current miter limit.

Definition at line 2361 of file cairo.c.

{
    return _cairo_gstate_get_miter_limit (cr->gstate);
}

Here is the call graph for this function:

cairo_get_operator: : a cairo context

Gets the current compositing operator for a cairo context.

Return value: the current compositing operator.

Definition at line 2218 of file cairo.c.

{
    return _cairo_gstate_get_operator (cr->gstate);
}

Here is the call graph for this function:

cairo_pattern_t* cairo_get_source ( cairo_t *  cr)

cairo_get_source: : a cairo context

Gets the current source pattern for .

Return value: the current source pattern. This object is owned by cairo. To keep a reference to it, you must call cairo_pattern_reference().

Definition at line 533 of file cairo.c.

{
    if (cr->status)
       return (cairo_pattern_t*) &cairo_pattern_nil.base;

    return _cairo_gstate_get_source (cr->gstate);
}

Here is the call graph for this function:

cairo_surface_t* cairo_get_target ( cairo_t *  cr)

cairo_get_target: : a cairo context

Gets the target surface for the cairo context as passed to cairo_create().

This function will always return a valid pointer, but the result can be a "nil" surface if is already in an error state, (ie. cairo_status() <literal>!=</literal> CAIRO_STATUS_SUCCESS). A nil surface is indicated by cairo_surface_status() <literal>!=</literal> CAIRO_STATUS_SUCCESS.

Return value: the target surface. This object is owned by cairo. To keep a reference to it, you must call cairo_surface_reference().

Definition at line 2396 of file cairo.c.

{
    if (cr->status)
       return (cairo_surface_t*) &_cairo_surface_nil;

    return _cairo_gstate_get_target (cr->gstate);
}

Here is the call graph for this function:

double cairo_get_tolerance ( cairo_t *  cr)

cairo_get_tolerance: : a cairo context

Gets the current tolerance value, as set by cairo_set_tolerance().

Return value: the current tolerance value.

Definition at line 2232 of file cairo.c.

{
    return _cairo_gstate_get_tolerance (cr->gstate);
}

Here is the call graph for this function:

void cairo_glyph_extents ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs,
cairo_text_extents_t extents 
)

cairo_glyph_extents: : a #cairo_t : an array of cairo_glyph_t objects : the number of elements in : a cairo_text_extents_t object into which the results will be stored

Gets the extents for an array of glyphs. The extents describe a user-space rectangle that encloses the "inked" portion of the glyphs, (as they would be drawn by cairo_show_glyphs()). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo_show_glyphs.

Note that whitespace glyphs do not contribute to the size of the rectangle (extents.width and extents.height).

Definition at line 2063 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs,
                                         extents);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_glyph_path ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs 
)

Definition at line 2197 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_glyph_path (cr->gstate,
                                      glyphs, num_glyphs,
                                      &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_identity_matrix ( cairo_t *  cr)

cairo_identity_matrix: : a cairo context

Resets the current transformation matrix (CTM) by setting it equal to the identity matrix. That is, the user-space and device-space axes will be aligned and one user-space unit will transform to one device-space unit.

Definition at line 860 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_identity_matrix (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_bool_t cairo_in_fill ( cairo_t *  cr,
double  x,
double  y 
)

Definition at line 1644 of file cairo.c.

{
    int inside;

    if (cr->status)
       return 0;

    cr->status = _cairo_gstate_in_fill (cr->gstate,
                                   &cr->path,
                                   x, y, &inside);
    if (cr->status) {
       _cairo_set_error (cr, cr->status);
       return 0;
    }

    return inside;
}

Here is the call graph for this function:

cairo_bool_t cairo_in_stroke ( cairo_t *  cr,
double  x,
double  y 
)

Definition at line 1627 of file cairo.c.

{
    int inside;

    if (cr->status)
       return 0;

    cr->status = _cairo_gstate_in_stroke (cr->gstate,
                                     &cr->path,
                                     x, y, &inside);
    if (cr->status)
       return 0;

    return inside;
}

Here is the call graph for this function:

void cairo_line_to ( cairo_t *  cr,
double  x,
double  y 
)

cairo_line_to: : a cairo context : the X coordinate of the end of the new line : the Y coordinate of the end of the new line

Adds a line to the path from the current point to position (, ) in user-space coordinates. After this call the current point will be (, ).

Definition at line 1011 of file cairo.c.

{
    cairo_fixed_t x_fixed, y_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
    x_fixed = _cairo_fixed_from_double (x);
    y_fixed = _cairo_fixed_from_double (y);

    cr->status = _cairo_path_fixed_line_to (&cr->path, x_fixed, y_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_mask ( cairo_t *  cr,
cairo_pattern_t *  pattern 
)

cairo_mask: : a cairo context : a #cairo_pattern_t

A drawing operator that paints the current source using the alpha channel of as a mask. (Opaque areas of are painted with the source, transparent areas are not painted.)

Definition at line 1464 of file cairo.c.

{
    if (cr->status)
       return;

    if (pattern == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }
    
    if (pattern->status) {
       _cairo_set_error (cr, pattern->status);
       return;
    }

    cr->status = _cairo_gstate_mask (cr->gstate, pattern);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_mask_surface ( cairo_t *  cr,
cairo_surface_t *  surface,
double  surface_x,
double  surface_y 
)

cairo_mask_surface: : a cairo context : a #cairo_surface_t : X coordinate at which to place the origin of : Y coordinate at which to place the origin of

A drawing operator that paints the current source using the alpha channel of as a mask. (Opaque areas of are painted with the source, transparent areas are not painted.)

Definition at line 1498 of file cairo.c.

{
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_for_surface (surface);

    cairo_matrix_init_translate (&matrix, - surface_x, - surface_y);
    cairo_pattern_set_matrix (pattern, &matrix);

    cairo_mask (cr, pattern);
    
    cairo_pattern_destroy (pattern);
}
void cairo_move_to ( cairo_t *  cr,
double  x,
double  y 
)

cairo_move_to: : a cairo context : the X coordinate of the new position : the Y coordinate of the new position

If the current subpath is not empty, begin a new subpath. After this call the current point will be (, ).

Definition at line 983 of file cairo.c.

{
    cairo_fixed_t x_fixed, y_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_backend (cr->gstate, &x, &y);
    x_fixed = _cairo_fixed_from_double (x);
    y_fixed = _cairo_fixed_from_double (y);

    cr->status = _cairo_path_fixed_move_to (&cr->path, x_fixed, y_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_new_path ( cairo_t *  cr)

cairo_new_path: : a cairo context

Clears the current path. After this call there will be no current point.

Definition at line 964 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_path_fixed_fini (&cr->path);
}

Here is the call graph for this function:

void cairo_paint ( cairo_t *  cr)

cairo_paint: : a cairo context

A drawing operator that paints the current source everywhere within the current clip region.

Definition at line 1404 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_paint (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_paint_with_alpha ( cairo_t *  cr,
double  alpha 
)

cairo_paint_with_alpha: : a cairo context : alpha value, between 0 (transparent) and 1 (opaque)

A drawing operator that paints the current source everywhere within the current clip region using a mask of constant alpha value . The effect is similar to cairo_paint(), but the drawing is faded out using the alpha value.

Definition at line 1425 of file cairo.c.

{
    cairo_color_t color;
    cairo_pattern_union_t pattern;
  
    if (cr->status)
       return;

    if (CAIRO_ALPHA_IS_OPAQUE (alpha)) {
       cairo_paint (cr);
       return;
    }

    if (CAIRO_ALPHA_IS_ZERO (alpha)) {
       return;
    }

    _cairo_color_init_rgba (&color, 1., 1., 1., alpha);
    _cairo_pattern_init_solid (&pattern.solid, &color);

    cr->status = _cairo_gstate_mask (cr->gstate, &pattern.base);
    if (cr->status)
       _cairo_set_error (cr, cr->status);

    _cairo_pattern_fini (&pattern.base);
}

Here is the call graph for this function:

void cairo_rectangle ( cairo_t *  cr,
double  x,
double  y,
double  width,
double  height 
)

cairo_rectangle: : a cairo context : the X coordinate of the top left corner of the rectangle : the Y coordinate to the top left corner of the rectangle : the width of the rectangle : the height of the rectangle

Adds a closed-subpath rectangle of the given size to the current path at position (, ) in user-space coordinates.

This function is logically equivalent to: <informalexample><programlisting> cairo_move_to (cr, x, y); cairo_rel_line_to (cr, width, 0); cairo_rel_line_to (cr, 0, height); cairo_rel_line_to (cr, -width, 0); cairo_close_path (cr); </programlisting></informalexample>

Definition at line 1343 of file cairo.c.

cairo_t* cairo_reference ( cairo_t *  cr)

cairo_reference: : a #cairo_t

Increases the reference count on by one. This prevents from being destroyed until a matching call to cairo_destroy() is made.

Return value: the referenced #cairo_t.

Definition at line 221 of file cairo.c.

{
    if (cr->ref_count == (unsigned int)-1)
       return cr;

    assert (cr->ref_count > 0);
    
    cr->ref_count++;

    return cr;
}

Here is the call graph for this function:

void cairo_rel_curve_to ( cairo_t *  cr,
double  dx1,
double  dy1,
double  dx2,
double  dy2,
double  dx3,
double  dy3 
)

cairo_rel_curve_to: : a cairo context : the X offset to the first control point : the Y offset to the first control point : the X offset to the second control point : the Y offset to the second control point : the X offset to the end of the curve : the Y offset to the end of the curve

Relative-coordinate version of cairo_curve_to(). All offsets are relative to the current point. Adds a cubic Bézier spline to the path from the current point to a point offset from the current point by (, ), using points offset by (, ) and (, ) as the control points. After this call the current point will be offset by (, ).

Given a current point of (x, y), cairo_rel_curve_to (, , , , , , ) is logically equivalent to cairo_curve_to (, x + , y + , x + , y + , x + , y + ).

Definition at line 1289 of file cairo.c.

{
    cairo_fixed_t dx1_fixed, dy1_fixed;
    cairo_fixed_t dx2_fixed, dy2_fixed;
    cairo_fixed_t dx3_fixed, dy3_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx1, &dy1);
    _cairo_gstate_user_to_device_distance (cr->gstate, &dx2, &dy2);
    _cairo_gstate_user_to_device_distance (cr->gstate, &dx3, &dy3);

    dx1_fixed = _cairo_fixed_from_double (dx1);
    dy1_fixed = _cairo_fixed_from_double (dy1);

    dx2_fixed = _cairo_fixed_from_double (dx2);
    dy2_fixed = _cairo_fixed_from_double (dy2);

    dx3_fixed = _cairo_fixed_from_double (dx3);
    dy3_fixed = _cairo_fixed_from_double (dy3);

    cr->status = _cairo_path_fixed_rel_curve_to (&cr->path,
                                           dx1_fixed, dy1_fixed,
                                           dx2_fixed, dy2_fixed,
                                           dx3_fixed, dy3_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_rel_line_to ( cairo_t *  cr,
double  dx,
double  dy 
)

cairo_rel_line_to: : a cairo context : the X offset to the end of the new line : the Y offset to the end of the new line

Relative-coordinate version of cairo_line_to(). Adds a line to the path from the current point to a point that is offset from the current point by (, ) in user space. After this call the current point will be offset by (, ).

Given a current point of (x, y), cairo_rel_line_to(, , ) is logically equivalent to cairo_line_to (, x + , y + ).

Definition at line 1249 of file cairo.c.

{
    cairo_fixed_t dx_fixed, dy_fixed;

    if (cr->status)
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
    dx_fixed = _cairo_fixed_from_double (dx);
    dy_fixed = _cairo_fixed_from_double (dy);

    cr->status = _cairo_path_fixed_rel_line_to (&cr->path, dx_fixed, dy_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_rel_move_to ( cairo_t *  cr,
double  dx,
double  dy 
)

cairo_rel_move_to: : a cairo context : the X offset : the Y offset

If the current subpath is not empty, begin a new subpath. After this call the current point will offset by (, ).

Given a current point of (x, y), cairo_rel_move_to(, , ) is logically equivalent to cairo_move_to (, x + , y + ).

Definition at line 1218 of file cairo.c.

{
    cairo_fixed_t dx_fixed, dy_fixed;

    if (cr->status) 
       return;

    _cairo_gstate_user_to_device_distance (cr->gstate, &dx, &dy);
    dx_fixed = _cairo_fixed_from_double (dx);
    dy_fixed = _cairo_fixed_from_double (dy);

    cr->status = _cairo_path_fixed_rel_move_to (&cr->path, dx_fixed, dy_fixed);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_reset_clip ( cairo_t *  cr)

cairo_reset_clip: : a cairo context

Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape containing the target surface. Equivalently, if infinity is too hard to grasp, one can imagine the clip region being reset to the exact bounds of the target surface.

Note that code meant to be reusable should not call cairo_reset_clip() as it will cause results unexpected by higher-level code which calls cairo_clip(). Consider using cairo_save() and cairo_restore() around cairo_clip() as a more robust means of temporarily restricting the clip region.

Definition at line 1771 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_reset_clip (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_restore ( cairo_t *  cr)

cairo_restore: : a #cairo_t

Restores to the state saved by a preceding call to cairo_save() and removes that state from the stack of saved states.

Definition at line 310 of file cairo.c.

{
    cairo_gstate_t *top;

    if (cr->status)
       return;

    top = cr->gstate;
    cr->gstate = top->next;

    _cairo_gstate_destroy (top);

    if (cr->gstate == NULL)
       _cairo_set_error (cr, CAIRO_STATUS_INVALID_RESTORE);
}

Here is the call graph for this function:

void cairo_rotate ( cairo_t *  cr,
double  angle 
)

cairo_rotate: : a cairo context : angle (in radians) by which the user-space axes will be rotated

Modifies the current transformation matrix (CTM) by rotating the user-space axes by radians. The rotation of the axes takes places after any existing transformation of user space. The rotation direction for positive angles is from the positive X axis toward the positive Y axis.

Definition at line 799 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_rotate (cr->gstate, angle);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_save ( cairo_t *  cr)

cairo_save: : a #cairo_t

Makes a copy of the current state of and saves it on an internal stack of saved states for . When cairo_restore() is called, will be restored to the saved state. Multiple calls to cairo_save() and cairo_restore() can be nested; each call to cairo_restore() restores the state from the matching paired cairo_save().

It isn't necessary to clear all saved states before a #cairo_t is freed. If the reference count of a #cairo_t drops to zero in response to a call to cairo_destroy(), any saved states will be freed along with the #cairo_t.

Definition at line 282 of file cairo.c.

{
    cairo_gstate_t *top;

    if (cr->status)
       return;

    top = _cairo_gstate_clone (cr->gstate);

    if (top == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NO_MEMORY);
       return;
    }

    top->next = cr->gstate;
    cr->gstate = top;
}

Here is the call graph for this function:

void cairo_scale ( cairo_t *  cr,
double  sx,
double  sy 
)

cairo_scale: : a cairo context : scale factor for the X dimension : scale factor for the Y dimension

Modifies the current transformation matrix (CTM) by scaling the X and Y user-space axes by and respectively. The scaling of the axes takes place after any existing transformation of user space.

Definition at line 775 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_scale (cr->gstate, sx, sy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_select_font_face ( cairo_t *  cr,
const char *  family,
cairo_font_slant_t  slant,
cairo_font_weight_t  weight 
)

cairo_select_font_face: : a #cairo_t : a font family name, encoded in UTF-8 : the slant for the font : the weight for the font

Selects a family and style of font from a simplified description as a family name, slant and weight. This function is meant to be used only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to cairo.

Definition at line 1797 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_antialias ( cairo_t *  cr,
cairo_antialias_t  antialias 
)

cairo_set_antialias: : a #cairo_t : the new antialiasing mode

Set the antialiasing mode of the rasterizer used for drawing shapes. This value is a hint, and a particular backend may or may not support a particular value. At the current time, no backend supports CAIRO_ANTIALIAS_SUBPIXEL when drawing shapes.

Note that this option does not affect text rendering, instead see cairo_font_options_set_antialias().

Definition at line 581 of file cairo.c.

{
    if (cr->status) 
       return;

    cr->status = _cairo_gstate_set_antialias (cr->gstate, antialias);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_dash ( cairo_t *  cr,
double *  dashes,
int  num_dashes,
double  offset 
)

cairo_set_dash: : a cairo context : an array specifying alternate lengths of on and off po : the length of the dashes array : an offset into the dash pattern at which the stroke should start

Sets the dash pattern to be used by cairo_stroke(). A dash pattern is specified by , an array of positive values. Each value provides the user-space length of altenate "on" and "off" portions of the stroke. The specifies an offset into the pattern at which the stroke begins.

If is 0 dashing is disabled.

If is 1 a symmetric pattern is assumed with alternating on and off portions of the size specified by the single value in .

If any value in is negative, or if all values are 0, then will be put into an error state with a status of

CAIRO_STATUS_INVALID_DASH.

Definition at line 714 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_dash (cr->gstate,
                                    dashes, num_dashes, offset);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_fill_rule ( cairo_t *  cr,
cairo_fill_rule_t  fill_rule 
)

cairo_set_fill_rule: : a #cairo_t : a fill rule, specified as a cairo_fill_rule_t

Set the current fill rule within the cairo context. The fill rule is used to determine which regions are inside or outside a complex (potentially self-intersecting) path. The current fill rule affects both cairo_fill and cairo_clip. See cairo_fill_rule_t for details on the semantics of each available fill rule.

Definition at line 603 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_fill_rule (cr->gstate, fill_rule);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_face ( cairo_t *  cr,
cairo_font_face_t *  font_face 
)

cairo_set_font_face: : a #cairo_t : a #cairo_font_face_t, or NULL to restore to the default font

Replaces the current #cairo_font_face_t object in the #cairo_t with . The replaced font face in the #cairo_t will be destroyed if there are no other references to it.

Definition at line 1868 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_face (cr->gstate, font_face);  
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_matrix ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_set_font_matrix : a #cairo_t : a cairo_matrix_t describing a transform to be applied to the current font.

Sets the current font matrix to . The font matrix gives a transformation from the design space of the font (in this space, the em-square is 1 unit by 1 unit) to user space. Normally, a simple scale is used (see cairo_set_font_size()), but a more complex font matrix can be used to shear the font or stretch it unequally along the two axes

Definition at line 1915 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_matrix (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_options ( cairo_t *  cr,
const cairo_font_options_t *  options 
)

cairo_set_font_options: : a #cairo_t : font options to use

Sets a set of custom font rendering options for the #cairo_t. Rendering options are derived by merging these options with the options derived from underlying surface; if the value in has a default value (like CAIRO_ANTIALIAS_DEFAULT), then the value from the surface is used.

Definition at line 1952 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_options (cr->gstate, options);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_font_size ( cairo_t *  cr,
double  size 
)

cairo_set_font_size: : a #cairo_t : the new font size, in user space units

Sets the current font matrix to a scale by a factor of , replacing any font matrix previously set with cairo_set_font_size() or cairo_set_font_matrix(). This results in a font size of user space units. (More precisely, this matrix will result in the font's em-square being a by square in user space.)

Definition at line 1891 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_font_size (cr->gstate, size);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_cap ( cairo_t *  cr,
cairo_line_cap_t  line_cap 
)

cairo_set_line_cap: : a cairo context, as a #cairo_t : a line cap style, as a cairo_line_cap_t

Sets the current line cap style within the cairo context. See

cairo_line_cap_t for details about how the available line cap

styles are drawn.

As with the other stroke parameters, the current line cap style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 655 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_line_cap (cr->gstate, line_cap);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_join ( cairo_t *  cr,
cairo_line_join_t  line_join 
)

cairo_set_line_join: : a cairo context, as a #cairo_t : a line joint style, as a cairo_line_join_t

Sets the current line join style within the cairo context. See

cairo_line_join_t for details about how the available line join

styles are drawn.

As with the other stroke parameters, the current line join style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 680 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_line_join (cr->gstate, line_join);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_line_width ( cairo_t *  cr,
double  width 
)

cairo_set_line_width: : a #cairo_t : a line width, as a user-space value

Sets the current line width within the cairo context. The line width specifies the diameter of a pen that is circular in user-space.

As with the other stroke parameters, the current line cap style is examined by cairo_stroke(), cairo_stroke_extents(), and cairo_stroke_to_path(), but does not have any effect during path construction.

Definition at line 628 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_restrict_value (&width, 0.0, width);

    cr->status = _cairo_gstate_set_line_width (cr->gstate, width);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_matrix ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_set_matrix: : a cairo context : a transformation matrix from user space to device space

Modifies the current transformation matrix (CTM) by setting it equal to .

Definition at line 839 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_matrix (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_miter_limit ( cairo_t *  cr,
double  limit 
)

Definition at line 729 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_miter_limit (cr->gstate, limit);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_operator ( cairo_t *  cr,
cairo_operator_t  op 
)

cairo_set_operator: : a #cairo_t : a compositing operator, specified as a cairo_operator_t

Sets the compositing operator to be used for all drawing operations. See cairo_operator_t for details on the semantics of each available compositing operator.

XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).

Definition at line 369 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_set_operator (cr->gstate, op);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_source ( cairo_t *  cr,
cairo_pattern_t *  source 
)

cairo_set_source : a cairo context : a #cairo_pattern_t to be used as the source for subsequent drawing operations.

Sets the source pattern within to . This pattern will then be used for any subsequent drawing operation until a new source pattern is set.

Note: The pattern's transformation matrix will be locked to the user space in effect at the time of cairo_set_source(). This means that further modifications of the current transformation matrix will not affect the source pattern. See cairo_pattern_set_matrix().

XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).

Definition at line 502 of file cairo.c.

{
    if (cr->status)
       return;

    if (source == NULL) {
       _cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
       return;
    }

    if (source->status) {
       _cairo_set_error (cr, source->status);
       return;
    }

    cr->status = _cairo_gstate_set_source (cr->gstate, source);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_set_source_rgb ( cairo_t *  cr,
double  red,
double  green,
double  blue 
)

cairo_set_source_rgb : a cairo context : red component of color : green component of color : blue component of color

Sets the source pattern within to an opaque color. This opaque color will then be used for any subsequent drawing operation until a new source pattern is set.

The color components are floating point numbers in the range 0 to

  1. If the values passed in are outside that range, they will be clamped.

Definition at line 395 of file cairo.c.

{
    cairo_pattern_t *pattern;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_rgb (red, green, blue);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_source_rgba ( cairo_t *  cr,
double  red,
double  green,
double  blue,
double  alpha 
)

cairo_set_source_rgba: : a cairo context : red component of color : green component of color : blue component of color : alpha component of color

Sets the source pattern within to a translucent color. This color will then be used for any subsequent drawing operation until a new source pattern is set.

The color and alpha components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.

Definition at line 424 of file cairo.c.

{
    cairo_pattern_t *pattern;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_rgba (red, green, blue, alpha);
    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_source_surface ( cairo_t *  cr,
cairo_surface_t *  surface,
double  x,
double  y 
)

cairo_set_source_surface: : a cairo context : a surface to be used to set the source pattern : User-space X coordinate for surface origin : User-space Y coordinate for surface origin

This is a convenience function for creating a pattern from and setting it as the source in with cairo_set_source().

The and parameters give the user-space coordinate at which the surface origin should appear. (The surface origin is its upper-left corner before any transformation has been applied.) The and patterns are negated and then set as translation values in the pattern matrix.

Other than the initial translation pattern matrix, as described above, all other pattern attributes, (such as its extend mode), are set to the default values as in cairo_pattern_create_for_surface(). The resulting pattern can be queried with cairo_get_source() so that these attributes can be modified if desired, (eg. to create a repeating pattern with cairo_pattern_set_extend()).

Definition at line 462 of file cairo.c.

{
    cairo_pattern_t *pattern;
    cairo_matrix_t matrix;

    if (cr->status)
       return;

    pattern = cairo_pattern_create_for_surface (surface);

    cairo_matrix_init_translate (&matrix, -x, -y);
    cairo_pattern_set_matrix (pattern, &matrix);

    cairo_set_source (cr, pattern);
    cairo_pattern_destroy (pattern);
}
void cairo_set_tolerance ( cairo_t *  cr,
double  tolerance 
)

cairo_set_tolerance: : a #cairo_t : the tolerance, in device units (typically pixels)

Sets the tolerance used when converting paths into trapezoids. Curved segments of the path will be subdivided until the maximum deviation between the original path and the polygonal approximation is less than . The default value is 0.1. A larger value will give better performance, a smaller value, better appearance. (Reducing the value from the default value of 0.1 is unlikely to improve appearance significantly.)

Definition at line 555 of file cairo.c.

{
    if (cr->status)
       return;

    _cairo_restrict_value (&tolerance, CAIRO_TOLERANCE_MINIMUM, tolerance);

    cr->status = _cairo_gstate_set_tolerance (cr->gstate, tolerance);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_glyphs ( cairo_t *  cr,
cairo_glyph_t glyphs,
int  num_glyphs 
)

Definition at line 2153 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_page ( cairo_t *  cr)

Definition at line 1616 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_show_page (cr->gstate);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_show_text ( cairo_t *  cr,
const char *  utf8 
)

cairo_show_text: : a cairo context : a string of text encoded in UTF-8

A drawing operator that generates the shape from a string of UTF-8 characters, rendered according to the current font_face, font_size (font_matrix), and font_options.

This function first computes a set of glyphs for the string of text. The first glyph is placed so that its origin is at the current point. The origin of each subsequent glyph is offset from that of the previous glyph by the advance values of the previous glyph.

After this call the current point is moved to the origin of where the next glyph would be placed in this same progression. That is, the current point will be at the origin of the final glyph offset by its advance values. This allows for easy display of a single logical string with multiple calls to cairo_show_text().

NOTE: The cairo_show_text() function call is part of what the cairo designers call the "toy" text API. It is convenient for short demos and simple programs, but it is not expected to be adequate for the most serious of text-using applications. See cairo_show_glyphs() for the "real" text display API in cairo.

Definition at line 2105 of file cairo.c.

{
    cairo_text_extents_t extents;
    cairo_glyph_t *glyphs = NULL, *last_glyph;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    if (utf8 == NULL)
       return;

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);
    if (cr->status)
       goto BAIL;

    if (num_glyphs == 0)
       return;

    cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
    if (cr->status)
       goto BAIL;

    last_glyph = &glyphs[num_glyphs - 1];
    cr->status = _cairo_gstate_glyph_extents (cr->gstate,
                                         last_glyph, 1,
                                         &extents);
    if (cr->status)
       goto BAIL;

    x = last_glyph->x + extents.x_advance;
    y = last_glyph->y + extents.y_advance;
    cairo_move_to (cr, x, y);

 BAIL:
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_status_t cairo_status ( cairo_t *  cr)

cairo_status: : a cairo context

Checks whether an error has previously occurred for this context.

Returns the current status of this context, see cairo_status_t

Definition at line 2536 of file cairo.c.

{
    return cr->status;
}

cairo_status_to_string: : a cairo status

Provides a human-readable description of a cairo_status_t.

Returns a string representation of the status

Definition at line 2550 of file cairo.c.

{
    switch (status) {
    case CAIRO_STATUS_SUCCESS:
       return "success";
    case CAIRO_STATUS_NO_MEMORY:
       return "out of memory";
    case CAIRO_STATUS_INVALID_RESTORE:
       return "cairo_restore without matching cairo_save";
    case CAIRO_STATUS_INVALID_POP_GROUP:
       return "cairo_pop_group without matching cairo_push_group";
    case CAIRO_STATUS_NO_CURRENT_POINT:
       return "no current point defined";
    case CAIRO_STATUS_INVALID_MATRIX:
       return "invalid matrix (not invertible)";
    case CAIRO_STATUS_INVALID_STATUS:
       return "invalid value for an input cairo_status_t";
    case CAIRO_STATUS_NULL_POINTER:
       return "NULL pointer";
    case CAIRO_STATUS_INVALID_STRING:
       return "input string not valid UTF-8";
    case CAIRO_STATUS_INVALID_PATH_DATA:
       return "input path data not valid";
    case CAIRO_STATUS_READ_ERROR:
       return "error while reading from input stream";
    case CAIRO_STATUS_WRITE_ERROR:
       return "error while writing to output stream";
    case CAIRO_STATUS_SURFACE_FINISHED:
       return "the target surface has been finished";
    case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
       return "the surface type is not appropriate for the operation";
    case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
       return "the pattern type is not appropriate for the operation";
    case CAIRO_STATUS_INVALID_CONTENT:
       return "invalid value for an input cairo_content_t";
    case CAIRO_STATUS_INVALID_FORMAT:
       return "invalid value for an input cairo_format_t";
    case CAIRO_STATUS_INVALID_VISUAL:
       return "invalid value for an input Visual*";
    case CAIRO_STATUS_FILE_NOT_FOUND:
       return "file not found";
    case CAIRO_STATUS_INVALID_DASH:
       return "invalid value for a dash setting";
    }

    return "<unknown error status>";
}
void cairo_stroke ( cairo_t *  cr)

cairo_stroke: : a cairo context

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. After cairo_stroke, the current path will be cleared from the cairo context. See cairo_set_line_width(), cairo_set_line_join(), cairo_set_line_cap(), cairo_set_dash(), and cairo_stroke_preserve().

Definition at line 1531 of file cairo.c.

void cairo_stroke_extents ( cairo_t *  cr,
double *  x1,
double *  y1,
double *  x2,
double *  y2 
)

Definition at line 1663 of file cairo.c.

{
    if (cr->status)
       return;
    
    cr->status = _cairo_gstate_stroke_extents (cr->gstate,
                                          &cr->path,
                                          x1, y1, x2, y2);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_stroke_preserve ( cairo_t *  cr)

cairo_stroke_preserve: : a cairo context

A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. Unlike cairo_stroke(), cairo_stroke_preserve preserves the path within the cairo context.

See cairo_set_line_width(), cairo_set_line_join(), cairo_set_line_cap(), cairo_set_dash(), and cairo_stroke_preserve().

Definition at line 1552 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_stroke (cr->gstate, &cr->path);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_text_extents ( cairo_t *  cr,
const char *  utf8,
cairo_text_extents_t extents 
)

cairo_text_extents: : a #cairo_t : a string of text, encoded in UTF-8 : a cairo_text_extents_t object into which the results will be stored

Gets the extents for a string of text. The extents describe a user-space rectangle that encloses the "inked" portion of the text, (as it would be drawn by cairo_show_text()). Additionally, the x_advance and y_advance values indicate the amount by which the current point would be advanced by cairo_show_text().

Note that whitespace characters do not directly contribute to the size of the rectangle (extents.width and extents.height). They do contribute indirectly by changing the position of non-whitespace characters. In particular, trailing whitespace characters are likely to not affect the size of the rectangle, though they will affect the x_advance and y_advance values.

Definition at line 2002 of file cairo.c.

{
    cairo_glyph_t *glyphs = NULL;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    if (utf8 == NULL) {
       extents->x_bearing = 0.0;
       extents->y_bearing = 0.0;
       extents->width = 0.0;
       extents->height = 0.0;
       extents->x_advance = 0.0;
       extents->y_advance = 0.0;
       return;
    }

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);

    if (cr->status) {
       if (glyphs)
           free (glyphs);
       _cairo_set_error (cr, cr->status);
       return;
    }
       
    cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_text_path ( cairo_t *  cr,
const char *  utf8 
)

Definition at line 2164 of file cairo.c.

{
    cairo_glyph_t *glyphs = NULL;
    int num_glyphs;
    double x, y;

    if (cr->status)
       return;

    cairo_get_current_point (cr, &x, &y);

    cr->status = _cairo_gstate_text_to_glyphs (cr->gstate, utf8,
                                          x, y,
                                          &glyphs, &num_glyphs);

    if (cr->status) {
       if (glyphs)
           free (glyphs);
       _cairo_set_error (cr, cr->status);
       return;
    }

    cr->status = _cairo_gstate_glyph_path (cr->gstate,
                                      glyphs, num_glyphs,
                                      &cr->path);
    if (glyphs)
       free (glyphs);

    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cairo_transform ( cairo_t *  cr,
const cairo_matrix_t matrix 
)

cairo_transform: : a cairo context : a transformation to be applied to the user-space axes

Modifies the current transformation matrix (CTM) by applying as an additional transformation. The new transformation of user space takes place after any existing transformation.

Definition at line 819 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_transform (cr->gstate, matrix);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_translate ( cairo_t *  cr,
double  tx,
double  ty 
)

cairo_translate: : a cairo context : amount to translate in the X direction : amount to translate in the Y direction

Modifies the current transformation matrix (CTM) by translating the user-space origin by (, ). This offset is interpreted as a user-space coordinate according to the CTM in place before the new call to cairo_translate. In other words, the translation of the user-space origin takes place after any existing transformation.

Definition at line 753 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_translate (cr->gstate, tx, ty);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_user_to_device ( cairo_t *  cr,
double *  x,
double *  y 
)

cairo_user_to_device: : a cairo context : X value of coordinate (in/out parameter) : Y value of coordinate (in/out parameter)

Transform a coordinate from user space to device space by multiplying the given point by the current transformation matrix (CTM).

Definition at line 881 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_user_to_device (cr->gstate, x, y);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

void cairo_user_to_device_distance ( cairo_t *  cr,
double *  dx,
double *  dy 
)

cairo_user_to_device_distance: : a cairo context : X component of a distance vector (in/out parameter) : Y component of a distance vector (in/out parameter)

Transform a distance vector from user space to device space. This function is similar to cairo_user_to_device() except that the translation components of the CTM will be ignored when transforming (,).

Definition at line 903 of file cairo.c.

{
    if (cr->status)
       return;

    cr->status = _cairo_gstate_user_to_device_distance (cr->gstate, dx, dy);
    if (cr->status)
       _cairo_set_error (cr, cr->status);
}

Here is the call graph for this function:

cairo_version:

Returns the version of the cairo library encoded in a single integer as per CAIRO_VERSION_ENCODE. The encoding ensures that later versions compare greater than earlier versions.

A run-time comparison to check that cairo's version is greater than or equal to version X.Y.Z could be performed as follows:

<informalexample><programlisting> if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...} </programlisting></informalexample>

See also cairo_version_string() as well as the compile-time equivalents CAIRO_VERSION and CAIRO_VERSION_STRING.

Return value: the encoded version.

Definition at line 137 of file cairo.c.

{
    return CAIRO_VERSION;
}

cairo_version_string:

Returns the version of the cairo library as a human-readable string of the form "X.Y.Z".

See also cairo_version() as well as the compile-time equivalents CAIRO_VERSION_STRING and CAIRO_VERSION.

Return value: a string containing the version.

Definition at line 154 of file cairo.c.

{
    return CAIRO_VERSION_STRING;
}

Variable Documentation

const cairo_t cairo_nil [static]
Initial value:
 {
  (unsigned int)-1,         
  CAIRO_STATUS_NO_MEMORY,   
  {                         
    NULL, NULL,                    
    NULL, NULL,                    
    { 0, 0 },               
    { 0, 0 },               
    FALSE,                  
  },
  NULL                      
}

Definition at line 46 of file cairo.c.