cairo_create ()

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

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

target :

target surface for the context

Returns :

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.

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.

cairo_push_group ()

Temporarily redirects drawing to an intermediate surface known as a
group. The redirection lasts until the group is completed by a call
to cairo_pop_group() or cairo_pop_group_to_source(). These calls
provide the result of any drawing to the group as a pattern,
(either as an explicit object, or set as the source pattern).

This group functionality can be convenient for performing
intermediate compositing. One common use of a group is to render
objects as opaque within the group, (so that they occlude each
other), and then blend the result with translucence onto the
destination.

cairo_push_group_with_content ()

Temporarily redirects drawing to an intermediate surface known as a
group. The redirection lasts until the group is completed by a call
to cairo_pop_group() or cairo_pop_group_to_source(). These calls
provide the result of any drawing to the group as a pattern,
(either as an explicit object, or set as the source pattern).

The group will have a content type of content. The ability to
control this content type is the only distinction between this
function and cairo_push_group() which you should see for a more
detailed description of group rendering.

a newly created (surface) pattern containing the
results of all drawing operations performed to the group. The
caller owns the returned object and should call
cairo_pattern_destroy() when finished with it.

cairo_set_source ()

Sets the source pattern within cr to source. 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).

cr :

a cairo context

source :

a cairo_pattern_t to be used as the source for
subsequent drawing operations.

cairo_set_source_surface ()

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

The x and y 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
x and y patterns are negated and then set as translation values
in the pattern matrix.

cairo_set_antialias ()

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.

cairo_set_dash ()

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

Each "on" segment will have caps applied as if the segment were a
separate sub-path. In particular, it is valid to use an "on" length
of 0.0 with CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE in order
to distributed dots or squares along a path.

Note: The length values are in user-space units as evaluated at the
time of stroking. This is not necessarily the same as the user
space at the time of cairo_set_dash().

If num_dashes is 0 dashing is disabled.

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

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

enum cairo_fill_rule_t

cairo_fill_rule_t is used to select how paths are filled. For both
fill rules, whether or not a point is included in the fill is
determined by taking a ray from that point to infinity and looking
at intersections with the path. The ray can be in any direction,
as long as it doesn't pass through the end point of a segment
or have a tricky intersection such as intersecting tangent to the path.
(Note that filling is not actually implemented in this way. This
is just a description of the rule that is applied.)

New entries may be added in future versions.

CAIRO_FILL_RULE_WINDING

If the path crosses the ray from
left-to-right, counts +1. If the path crosses the ray
from right to left, counts -1. (Left and right are determined
from the perspective of looking along the ray from the starting
point.) If the total count is non-zero, the point will be filled.

CAIRO_FILL_RULE_EVEN_ODD

Counts the total number of
intersections, without regard to the orientation of the contour. If
the total number of intersections is odd, the point will be
filled.

cairo_set_fill_rule ()

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.

cairo_set_line_cap ()

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.

cairo_set_line_join ()

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.

cairo_set_line_width ()

Sets the current line width within the cairo context. The line
width value specifies the diameter of a pen that is circular in
user space, (though device-space pen may be an ellipse in general
due to scaling/shear/rotation of the CTM).

Note: When the description above refers to user space and CTM it
refers to the user space and CTM in effect at the time of the
stroking operation, not the user space and CTM in effect at the
time of the call to cairo_set_line_width(). The simplest usage
makes both of these spaces identical. That is, if there is no
change to the CTM between a call to cairo_set_line_with() and the
stroking operation, then one can just pass user-space values to
cairo_set_line_width() and ignore this note.

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

cairo_set_miter_limit ()

If the current line join style is set to CAIRO_LINE_JOIN_MITER
(see cairo_set_line_join()), the miter limit is used to determine
whether the lines should be joined with a bevel instead of a miter.
Cairo divides the length of the miter by the line width.
If the result is greater than the miter limit, the style is
converted to a bevel.

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

cairo_set_tolerance ()

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 tolerance. 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.)

cairo_reset_clip ()

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.

cairo_copy_clip_rectangle_list ()

Gets the current clip region as a list of rectangles in user coordinates.
Never returns NULL.

The status in the list may be CAIRO_STATUS_CLIP_NOT_REPRESENTABLE to
indicate that the clip region cannot be represented as a list of
user-space rectangles. The status may have other values to indicate
other errors.

The caller must always call cairo_rectangle_list_destroy on the result of
this function.

cr :

a cairo context

Returns :

the current clip region as a list of rectangles in user coordinates.

Since 1.4

cairo_fill ()

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().

cr :

a cairo context

cairo_fill_preserve ()

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.

cairo_fill_extents ()

Computes a bounding box in user coordinates covering the area that
would be affected by a cairo_fill() operation given the current path
and fill parameters. If the current path is empty, returns an empty
rectangle (0,0, 0,0). Surface dimensions and clipping are not taken
into account.

cairo_in_fill ()

Tests whether the given point is inside the area that would be
affected by a cairo_fill() operation given the current path and
filling parameters. Surface dimensions and clipping are not taken
into account.

cairo_paint_with_alpha ()

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

Note: Degenerate segments and sub-paths are treated specially and
provide a useful result. These can result in two different
situations:

1. Zero-length "on" segments set in cairo_set_dash(). If the cap
style is CAIRO_LINE_CAP_ROUND or CAIRO_LINE_CAP_SQUARE then these
segments will be drawn as circular dots or squares respectively. In
the case of CAIRO_LINE_CAP_SQUARE, the orientation of the squares
is determined by the direction of the underlying path.

2. A sub-path created by cairo_move_to() followed by either a
cairo_close_path() or one or more calls to cairo_line_to() to the
same coordinate as the cairo_move_to(). If the cap style is
CAIRO_LINE_CAP_ROUND then these sub-paths will be drawn as circular
dots. Note that in the case of CAIRO_LINE_CAP_SQUARE a degenerate
sub-path will not be drawn at all, (since the correct orientation
is indeterminate).

In no case will a cap style of CAIRO_LINE_CAP_BUTT cause anything
to be drawn in the case of either degenerate segments or sub-paths.

cr :

a cairo context

cairo_stroke_preserve ()

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.

cairo_in_stroke ()

Tests whether the given point is inside the area that would be
affected by a cairo_stroke() operation given the current path and
stroking parameters. Surface dimensions and clipping are not taken
into account.

cairo_copy_page ()

Emits the current page for backends that support multiple pages, but
doesn't clear it, so, the contents of the current page will be retained
for the next page too. Use cairo_show_page() if you want to get an
empty page after the emission.