<?xml version='1.0' encoding='UTF-8'?> 
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="cairo-cairo-t">
<refmeta>
<refentrytitle role="top_of_page" id="cairo-cairo-t.top_of_page">cairo_t</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>
  CAIRO Library
</refmiscinfo>
</refmeta>
<refnamediv>
<refname>cairo_t</refname>
<refpurpose>The cairo drawing context</refpurpose>
</refnamediv>

<refsynopsisdiv id="cairo-cairo-t.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>typedef             <link linkend="cairo-t">cairo_t</link>;
<link linkend="cairo-t"><returnvalue>cairo_t</returnvalue></link> *           <link linkend="cairo-create">cairo_create</link>                        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *target</parameter>);
<link linkend="cairo-t"><returnvalue>cairo_t</returnvalue></link> *           <link linkend="cairo-reference">cairo_reference</link>                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-destroy">cairo_destroy</link>                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>      <link linkend="cairo-status">cairo_status</link>                        (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-save">cairo_save</link>                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-restore">cairo_restore</link>                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   <link linkend="cairo-get-target">cairo_get_target</link>                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-push-group">cairo_push_group</link>                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-push-group-with-content">cairo_push_group_with_content</link>       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-content-t"><type>cairo_content_t</type></link> content</parameter>);
<link linkend="cairo-pattern-t"><returnvalue>cairo_pattern_t</returnvalue></link> *   <link linkend="cairo-pop-group">cairo_pop_group</link>                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-pop-group-to-source">cairo_pop_group_to_source</link>           (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   <link linkend="cairo-get-group-target">cairo_get_group_target</link>              (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-source-rgb">cairo_set_source_rgb</link>                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> red</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> green</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> blue</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-source-rgba">cairo_set_source_rgba</link>               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> red</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> green</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> blue</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> alpha</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-source">cairo_set_source</link>                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> *source</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-source-surface">cairo_set_source_surface</link>            (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);
<link linkend="cairo-pattern-t"><returnvalue>cairo_pattern_t</returnvalue></link> *   <link linkend="cairo-get-source">cairo_get_source</link>                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
enum                <link linkend="cairo-antialias-t">cairo_antialias_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-antialias">cairo_set_antialias</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-antialias-t"><type>cairo_antialias_t</type></link> antialias</parameter>);
<link linkend="cairo-antialias-t"><returnvalue>cairo_antialias_t</returnvalue></link>   <link linkend="cairo-get-antialias">cairo_get_antialias</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-dash">cairo_set_dash</link>                      (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="double"><type>double</type></link> *dashes</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> num_dashes</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> offset</parameter>);
<link linkend="int"><returnvalue>int</returnvalue></link>                 <link linkend="cairo-get-dash-count">cairo_get_dash_count</link>                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-get-dash">cairo_get_dash</link>                      (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *dashes</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *offset</parameter>);
enum                <link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-fill-rule">cairo_set_fill_rule</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link> fill_rule</parameter>);
<link linkend="cairo-fill-rule-t"><returnvalue>cairo_fill_rule_t</returnvalue></link>   <link linkend="cairo-get-fill-rule">cairo_get_fill_rule</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
enum                <link linkend="cairo-line-cap-t">cairo_line_cap_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-line-cap">cairo_set_line_cap</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-line-cap-t"><type>cairo_line_cap_t</type></link> line_cap</parameter>);
<link linkend="cairo-line-cap-t"><returnvalue>cairo_line_cap_t</returnvalue></link>    <link linkend="cairo-get-line-cap">cairo_get_line_cap</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
enum                <link linkend="cairo-line-join-t">cairo_line_join_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-line-join">cairo_set_line_join</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-line-join-t"><type>cairo_line_join_t</type></link> line_join</parameter>);
<link linkend="cairo-line-join-t"><returnvalue>cairo_line_join_t</returnvalue></link>   <link linkend="cairo-get-line-join">cairo_get_line_join</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-line-width">cairo_set_line_width</link>                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width</parameter>);
<link linkend="double"><returnvalue>double</returnvalue></link>              <link linkend="cairo-get-line-width">cairo_get_line_width</link>                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-miter-limit">cairo_set_miter_limit</link>               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> limit</parameter>);
<link linkend="double"><returnvalue>double</returnvalue></link>              <link linkend="cairo-get-miter-limit">cairo_get_miter_limit</link>               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
enum                <link linkend="cairo-operator-t">cairo_operator_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-operator">cairo_set_operator</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-operator-t"><type>cairo_operator_t</type></link> op</parameter>);
<link linkend="cairo-operator-t"><returnvalue>cairo_operator_t</returnvalue></link>    <link linkend="cairo-get-operator">cairo_get_operator</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-set-tolerance">cairo_set_tolerance</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> tolerance</parameter>);
<link linkend="double"><returnvalue>double</returnvalue></link>              <link linkend="cairo-get-tolerance">cairo_get_tolerance</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-clip">cairo_clip</link>                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-clip-preserve">cairo_clip_preserve</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-clip-extents">cairo_clip_extents</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);
<link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        <link linkend="cairo-in-clip">cairo_in_clip</link>                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-reset-clip">cairo_reset_clip</link>                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
                    <link linkend="cairo-rectangle-t">cairo_rectangle_t</link>;
                    <link linkend="cairo-rectangle-list-t">cairo_rectangle_list_t</link>;
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-rectangle-list-destroy">cairo_rectangle_list_destroy</link>        (<parameter><link linkend="cairo-rectangle-list-t"><type>cairo_rectangle_list_t</type></link> *rectangle_list</parameter>);
<link linkend="cairo-rectangle-list-t"><returnvalue>cairo_rectangle_list_t</returnvalue></link> * <link linkend="cairo-copy-clip-rectangle-list">cairo_copy_clip_rectangle_list</link> (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-fill">cairo_fill</link>                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-fill-preserve">cairo_fill_preserve</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-fill-extents">cairo_fill_extents</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);
<link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        <link linkend="cairo-in-fill">cairo_in_fill</link>                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-mask">cairo_mask</link>                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> *pattern</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-mask-surface">cairo_mask_surface</link>                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> surface_x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> surface_y</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-paint">cairo_paint</link>                         (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-paint-with-alpha">cairo_paint_with_alpha</link>              (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> alpha</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-stroke">cairo_stroke</link>                        (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-stroke-preserve">cairo_stroke_preserve</link>               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-stroke-extents">cairo_stroke_extents</link>                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);
<link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        <link linkend="cairo-in-stroke">cairo_in_stroke</link>                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-copy-page">cairo_copy_page</link>                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link>                <link linkend="cairo-show-page">cairo_show_page</link>                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
unsigned <link linkend="int"><returnvalue>int</returnvalue></link>        <link linkend="cairo-get-reference-count">cairo_get_reference_count</link>           (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);
<link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>      <link linkend="cairo-set-user-data">cairo_set_user_data</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> *key</parameter>,
                                                         <parameter><link linkend="void"><type>void</type></link> *user_data</parameter>,
                                                         <parameter><link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> destroy</parameter>);
<link linkend="void"><returnvalue>void</returnvalue></link> *              <link linkend="cairo-get-user-data">cairo_get_user_data</link>                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> *key</parameter>);
</synopsis>
</refsynopsisdiv>

<refsect1 id="cairo-cairo-t.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="cairo-t"><type>cairo_t</type></link> is the main object used when drawing with cairo. To
draw with cairo, you create a <link linkend="cairo-t"><type>cairo_t</type></link>, set the target surface,
and drawing options for the <link linkend="cairo-t"><type>cairo_t</type></link>, create shapes with
functions like <link linkend="cairo-move-to"><function>cairo_move_to()</function></link> and <link linkend="cairo-line-to"><function>cairo_line_to()</function></link>, and then
draw shapes with <link linkend="cairo-stroke"><function>cairo_stroke()</function></link> or <link linkend="cairo-fill"><function>cairo_fill()</function></link>.
</para>
<para>
<link linkend="cairo-t"><type>cairo_t</type></link><!-- -->'s can be pushed to a stack via <link linkend="cairo-save"><function>cairo_save()</function></link>.
They may then safely be changed, without losing the current state.
Use <link linkend="cairo-restore"><function>cairo_restore()</function></link> to restore to the saved state.
</para>
</refsect1>
<refsect1 id="cairo-cairo-t.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="cairo-t" role="typedef" condition="since:1.0">
<title>cairo_t</title>
<indexterm zone="cairo-t" role="1.0"><primary sortas="t">cairo_t</primary></indexterm>
<programlisting>typedef struct _cairo cairo_t;
</programlisting>
<para>
A <link linkend="cairo-t"><type>cairo_t</type></link> contains the current state of the rendering device,
including coordinates of yet to be drawn shapes.
</para>
<para>
Cairo contexts, as <link linkend="cairo-t"><type>cairo_t</type></link> objects are named, are central to
cairo and all drawing with cairo is always done to a <link linkend="cairo-t"><type>cairo_t</type></link>
object.
</para>
<para>
Memory management of <link linkend="cairo-t"><type>cairo_t</type></link> is done with
<link linkend="cairo-reference"><function>cairo_reference()</function></link> and <link linkend="cairo-destroy"><function>cairo_destroy()</function></link>.
</para><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-create" role="function" condition="since:1.0">
<title>cairo_create ()</title>
<indexterm zone="cairo-create" role="1.0"><primary sortas="create">cairo_create</primary></indexterm>
<programlisting><link linkend="cairo-t"><returnvalue>cairo_t</returnvalue></link> *           cairo_create                        (<parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *target</parameter>);</programlisting>
<para>
Creates a new <link linkend="cairo-t"><type>cairo_t</type></link> with all graphics state parameters set to
default values and with <parameter>target</parameter> as a target surface. The target
surface should be constructed with a backend-specific function such
as <link linkend="cairo-image-surface-create"><function>cairo_image_surface_create()</function></link> (or any other
<function>cairo_<emphasis>backend</emphasis>_surface_create(<!-- -->)</function>
variant).
</para>
<para>
This function references <parameter>target</parameter>, so you can immediately
call <link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> on it if you don't need to
maintain a separate reference to it.
</para><variablelist role="params">
<varlistentry><term><parameter>target</parameter>&#160;:</term>
<listitem><simpara>target surface for the context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>a newly allocated <link linkend="cairo-t"><type>cairo_t</type></link> with a reference
count of 1. The initial reference count should be released
with <link linkend="cairo-destroy"><function>cairo_destroy()</function></link> when you are done using the <link linkend="cairo-t"><type>cairo_t</type></link>.
This function never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>. If memory cannot be
allocated, a special <link linkend="cairo-t"><type>cairo_t</type></link> object will be returned on
which <link linkend="cairo-status"><function>cairo_status()</function></link> returns <link linkend="CAIRO-STATUS-NO-MEMORY:CAPS"><literal>CAIRO_STATUS_NO_MEMORY</literal></link>. If
you attempt to target a surface which does not support
writing (such as <link linkend="cairo-mime-surface-t"><type>cairo_mime_surface_t</type></link>) then a
<link linkend="CAIRO-STATUS-WRITE-ERROR:CAPS"><literal>CAIRO_STATUS_WRITE_ERROR</literal></link> will be raised.  You can use this
object normally, but no drawing will be done.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-reference" role="function" condition="since:1.0">
<title>cairo_reference ()</title>
<indexterm zone="cairo-reference" role="1.0"><primary sortas="reference">cairo_reference</primary></indexterm>
<programlisting><link linkend="cairo-t"><returnvalue>cairo_t</returnvalue></link> *           cairo_reference                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Increases the reference count on <parameter>cr</parameter> by one. This prevents
<parameter>cr</parameter> from being destroyed until a matching call to <link linkend="cairo-destroy"><function>cairo_destroy()</function></link>
is made.
</para>
<para>
The number of references to a <link linkend="cairo-t"><type>cairo_t</type></link> can be get using
<link linkend="cairo-get-reference-count"><function>cairo_get_reference_count()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the referenced <link linkend="cairo-t"><type>cairo_t</type></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-destroy" role="function" condition="since:1.0">
<title>cairo_destroy ()</title>
<indexterm zone="cairo-destroy" role="1.0"><primary sortas="destroy">cairo_destroy</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_destroy                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Decreases the reference count on <parameter>cr</parameter> by one. If the result
is zero, then <parameter>cr</parameter> and all associated resources are freed.
See <link linkend="cairo-reference"><function>cairo_reference()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-status" role="function" condition="since:1.0">
<title>cairo_status ()</title>
<indexterm zone="cairo-status" role="1.0"><primary sortas="status">cairo_status</primary></indexterm>
<programlisting><link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>      cairo_status                        (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Checks whether an error has previously occurred for this context.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current status of this context, see <link linkend="cairo-status-t"><type>cairo_status_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-save" role="function" condition="since:1.0">
<title>cairo_save ()</title>
<indexterm zone="cairo-save" role="1.0"><primary sortas="save">cairo_save</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_save                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Makes a copy of the current state of <parameter>cr</parameter> and saves it
on an internal stack of saved states for <parameter>cr</parameter>. When
<link linkend="cairo-restore"><function>cairo_restore()</function></link> is called, <parameter>cr</parameter> will be restored to
the saved state. Multiple calls to <link linkend="cairo-save"><function>cairo_save()</function></link> and
<link linkend="cairo-restore"><function>cairo_restore()</function></link> can be nested; each call to <link linkend="cairo-restore"><function>cairo_restore()</function></link>
restores the state from the matching paired <link linkend="cairo-save"><function>cairo_save()</function></link>.
</para>
<para>
It isn't necessary to clear all saved states before
a <link linkend="cairo-t"><type>cairo_t</type></link> is freed. If the reference count of a <link linkend="cairo-t"><type>cairo_t</type></link>
drops to zero in response to a call to <link linkend="cairo-destroy"><function>cairo_destroy()</function></link>,
any saved states will be freed along with the <link linkend="cairo-t"><type>cairo_t</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-restore" role="function" condition="since:1.0">
<title>cairo_restore ()</title>
<indexterm zone="cairo-restore" role="1.0"><primary sortas="restore">cairo_restore</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_restore                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Restores <parameter>cr</parameter> to the state saved by a preceding call to
<link linkend="cairo-save"><function>cairo_save()</function></link> and removes that state from the stack of
saved states.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-target" role="function" condition="since:1.0">
<title>cairo_get_target ()</title>
<indexterm zone="cairo-get-target" role="1.0"><primary sortas="get_target">cairo_get_target</primary></indexterm>
<programlisting><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   cairo_get_target                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the target surface for the cairo context as passed to
<link linkend="cairo-create"><function>cairo_create()</function></link>.
</para>
<para>
This function will always return a valid pointer, but the result
can be a "nil" surface if <parameter>cr</parameter> is already in an error state,
(ie. <link linkend="cairo-status"><function>cairo_status()</function></link> <literal>!=</literal> <link linkend="CAIRO-STATUS-SUCCESS:CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link>).
A nil surface is indicated by <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link>
<literal>!=</literal> <link linkend="CAIRO-STATUS-SUCCESS:CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the target surface. This object is owned by cairo. To
keep a reference to it, you must call <link linkend="cairo-surface-reference"><function>cairo_surface_reference()</function></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-push-group" role="function" condition="since:1.2">
<title>cairo_push_group ()</title>
<indexterm zone="cairo-push-group" role="1.2"><primary sortas="push_group">cairo_push_group</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_push_group                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Temporarily redirects drawing to an intermediate surface known as a
group. The redirection lasts until the group is completed by a call
to <link linkend="cairo-pop-group"><function>cairo_pop_group()</function></link> or <link linkend="cairo-pop-group-to-source"><function>cairo_pop_group_to_source()</function></link>. 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).
</para>
<para>
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.
</para>
<para>
Groups can be nested arbitrarily deep by making balanced calls to
<link linkend="cairo-push-group"><function>cairo_push_group()</function></link>/<link linkend="cairo-pop-group"><function>cairo_pop_group()</function></link>. Each call pushes/pops the new
target group onto/from a stack.
</para>
<para>
The <link linkend="cairo-push-group"><function>cairo_push_group()</function></link> function calls <link linkend="cairo-save"><function>cairo_save()</function></link> so that any
changes to the graphics state will not be visible outside the
group, (the pop_group functions call <link linkend="cairo-restore"><function>cairo_restore()</function></link>).
</para>
<para>
By default the intermediate group will have a content type of
<link linkend="CAIRO-CONTENT-COLOR-ALPHA:CAPS"><literal>CAIRO_CONTENT_COLOR_ALPHA</literal></link>. Other content types can be chosen for
the group by using <link linkend="cairo-push-group-with-content"><function>cairo_push_group_with_content()</function></link> instead.
</para>
<para>
As an example, here is how one might fill and stroke a path with
translucence, but without any portion of the fill being visible
under the stroke:
</para>
<para>
<informalexample><programlisting>
cairo_push_group (cr);
cairo_set_source (cr, fill_pattern);
cairo_fill_preserve (cr);
cairo_set_source (cr, stroke_pattern);
cairo_stroke (cr);
cairo_pop_group_to_source (cr);
cairo_paint_with_alpha (cr, alpha);
</programlisting></informalexample>
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-push-group-with-content" role="function" condition="since:1.2">
<title>cairo_push_group_with_content ()</title>
<indexterm zone="cairo-push-group-with-content" role="1.2"><primary sortas="push_group_with_content">cairo_push_group_with_content</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_push_group_with_content       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-content-t"><type>cairo_content_t</type></link> content</parameter>);</programlisting>
<para>
Temporarily redirects drawing to an intermediate surface known as a
group. The redirection lasts until the group is completed by a call
to <link linkend="cairo-pop-group"><function>cairo_pop_group()</function></link> or <link linkend="cairo-pop-group-to-source"><function>cairo_pop_group_to_source()</function></link>. 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).
</para>
<para>
The group will have a content type of <parameter>content</parameter>. The ability to
control this content type is the only distinction between this
function and <link linkend="cairo-push-group"><function>cairo_push_group()</function></link> which you should see for a more
detailed description of group rendering.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>content</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-content-t"><type>cairo_content_t</type></link> indicating the type of group that
will be created</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-pop-group" role="function" condition="since:1.2">
<title>cairo_pop_group ()</title>
<indexterm zone="cairo-pop-group" role="1.2"><primary sortas="pop_group">cairo_pop_group</primary></indexterm>
<programlisting><link linkend="cairo-pattern-t"><returnvalue>cairo_pattern_t</returnvalue></link> *   cairo_pop_group                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Terminates the redirection begun by a call to <link linkend="cairo-push-group"><function>cairo_push_group()</function></link> or
<link linkend="cairo-push-group-with-content"><function>cairo_push_group_with_content()</function></link> and returns a new pattern
containing the results of all drawing operations performed to the
group.
</para>
<para>
The <link linkend="cairo-pop-group"><function>cairo_pop_group()</function></link> function calls <link linkend="cairo-restore"><function>cairo_restore()</function></link>, (balancing a
call to <link linkend="cairo-save"><function>cairo_save()</function></link> by the push_group function), so that any
changes to the graphics state will not be visible outside the
group.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>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
<link linkend="cairo-pattern-destroy"><function>cairo_pattern_destroy()</function></link> when finished with it.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-pop-group-to-source" role="function" condition="since:1.2">
<title>cairo_pop_group_to_source ()</title>
<indexterm zone="cairo-pop-group-to-source" role="1.2"><primary sortas="pop_group_to_source">cairo_pop_group_to_source</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_pop_group_to_source           (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Terminates the redirection begun by a call to <link linkend="cairo-push-group"><function>cairo_push_group()</function></link> or
<link linkend="cairo-push-group-with-content"><function>cairo_push_group_with_content()</function></link> and installs the resulting pattern
as the source pattern in the given cairo context.
</para>
<para>
The behavior of this function is equivalent to the sequence of
operations:
</para>
<para>
<informalexample><programlisting>
cairo_pattern_t *group = cairo_pop_group (cr);
cairo_set_source (cr, group);
cairo_pattern_destroy (group);
</programlisting></informalexample>
</para>
<para>
but is more convenient as their is no need for a variable to store
the short-lived pointer to the pattern.
</para>
<para>
The <link linkend="cairo-pop-group"><function>cairo_pop_group()</function></link> function calls <link linkend="cairo-restore"><function>cairo_restore()</function></link>, (balancing a
call to <link linkend="cairo-save"><function>cairo_save()</function></link> by the push_group function), so that any
changes to the graphics state will not be visible outside the
group.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-get-group-target" role="function" condition="since:1.2">
<title>cairo_get_group_target ()</title>
<indexterm zone="cairo-get-group-target" role="1.2"><primary sortas="get_group_target">cairo_get_group_target</primary></indexterm>
<programlisting><link linkend="cairo-surface-t"><returnvalue>cairo_surface_t</returnvalue></link> *   cairo_get_group_target              (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current destination surface for the context. This is either
the original target surface as passed to <link linkend="cairo-create"><function>cairo_create()</function></link> or the target
surface for the current group as started by the most recent call to
<link linkend="cairo-push-group"><function>cairo_push_group()</function></link> or <link linkend="cairo-push-group-with-content"><function>cairo_push_group_with_content()</function></link>.
</para>
<para>
This function will always return a valid pointer, but the result
can be a "nil" surface if <parameter>cr</parameter> is already in an error state,
(ie. <link linkend="cairo-status"><function>cairo_status()</function></link> <literal>!=</literal> <link linkend="CAIRO-STATUS-SUCCESS:CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link>).
A nil surface is indicated by <link linkend="cairo-surface-status"><function>cairo_surface_status()</function></link>
<literal>!=</literal> <link linkend="CAIRO-STATUS-SUCCESS:CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the target surface. This object is owned by cairo. To
keep a reference to it, you must call <link linkend="cairo-surface-reference"><function>cairo_surface_reference()</function></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.2</para></refsect2>
<refsect2 id="cairo-set-source-rgb" role="function" condition="since:1.0">
<title>cairo_set_source_rgb ()</title>
<indexterm zone="cairo-set-source-rgb" role="1.0"><primary sortas="set_source_rgb">cairo_set_source_rgb</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_source_rgb                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> red</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> green</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> blue</parameter>);</programlisting>
<para>
Sets the source pattern within <parameter>cr</parameter> to an opaque color. This opaque
color will then be used for any subsequent drawing operation until
a new source pattern is set.
</para>
<para>
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.
</para>
<para>
The default source pattern is opaque black, (that is, it is
equivalent to cairo_set_source_rgb(cr, 0.0, 0.0, 0.0)).
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>red</parameter>&#160;:</term>
<listitem><simpara>red component of color</simpara></listitem></varlistentry>
<varlistentry><term><parameter>green</parameter>&#160;:</term>
<listitem><simpara>green component of color</simpara></listitem></varlistentry>
<varlistentry><term><parameter>blue</parameter>&#160;:</term>
<listitem><simpara>blue component of color</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-source-rgba" role="function" condition="since:1.0">
<title>cairo_set_source_rgba ()</title>
<indexterm zone="cairo-set-source-rgba" role="1.0"><primary sortas="set_source_rgba">cairo_set_source_rgba</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_source_rgba               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> red</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> green</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> blue</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> alpha</parameter>);</programlisting>
<para>
Sets the source pattern within <parameter>cr</parameter> to a translucent color. This
color will then be used for any subsequent drawing operation until
a new source pattern is set.
</para>
<para>
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.
</para>
<para>
The default source pattern is opaque black, (that is, it is
equivalent to cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0)).
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>red</parameter>&#160;:</term>
<listitem><simpara>red component of color</simpara></listitem></varlistentry>
<varlistentry><term><parameter>green</parameter>&#160;:</term>
<listitem><simpara>green component of color</simpara></listitem></varlistentry>
<varlistentry><term><parameter>blue</parameter>&#160;:</term>
<listitem><simpara>blue component of color</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter>&#160;:</term>
<listitem><simpara>alpha component of color</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-source" role="function" condition="since:1.0">
<title>cairo_set_source ()</title>
<indexterm zone="cairo-set-source" role="1.0"><primary sortas="set_source">cairo_set_source</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_source                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> *source</parameter>);</programlisting>
<para>
Sets the source pattern within <parameter>cr</parameter> to <parameter>source</parameter>. This pattern
will then be used for any subsequent drawing operation until a new
source pattern is set.
</para>
<para>
Note: The pattern's transformation matrix will be locked to the
user space in effect at the time of <link linkend="cairo-set-source"><function>cairo_set_source()</function></link>. This means
that further modifications of the current transformation matrix
will not affect the source pattern. See <link linkend="cairo-pattern-set-matrix"><function>cairo_pattern_set_matrix()</function></link>.
</para>
<para>
The default source pattern is a solid pattern that is opaque black,
(that is, it is equivalent to cairo_set_source_rgb(cr, 0.0, 0.0,
0.0)).
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>source</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> to be used as the source for
subsequent drawing operations.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-source-surface" role="function" condition="since:1.0">
<title>cairo_set_source_surface ()</title>
<indexterm zone="cairo-set-source-surface" role="1.0"><primary sortas="set_source_surface">cairo_set_source_surface</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_source_surface            (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);</programlisting>
<para>
This is a convenience function for creating a pattern from <parameter>surface</parameter>
and setting it as the source in <parameter>cr</parameter> with <link linkend="cairo-set-source"><function>cairo_set_source()</function></link>.
</para>
<para>
The <parameter>x</parameter> and <parameter>y</parameter> 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
<parameter>x</parameter> and <parameter>y</parameter> parameters are negated and then set as translation values
in the pattern matrix.
</para>
<para>
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 <link linkend="cairo-pattern-create-for-surface"><function>cairo_pattern_create_for_surface()</function></link>.
The resulting pattern can be queried with <link linkend="cairo-get-source"><function>cairo_get_source()</function></link> so
that these attributes can be modified if desired, (eg. to create a
repeating pattern with <link linkend="cairo-pattern-set-extend"><function>cairo_pattern_set_extend()</function></link>).
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a surface to be used to set the source pattern</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>User-space X coordinate for surface origin</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&#160;:</term>
<listitem><simpara>User-space Y coordinate for surface origin</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-source" role="function" condition="since:1.0">
<title>cairo_get_source ()</title>
<indexterm zone="cairo-get-source" role="1.0"><primary sortas="get_source">cairo_get_source</primary></indexterm>
<programlisting><link linkend="cairo-pattern-t"><returnvalue>cairo_pattern_t</returnvalue></link> *   cairo_get_source                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current source pattern for <parameter>cr</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current source pattern. This object is owned by
cairo. To keep a reference to it, you must call
<link linkend="cairo-pattern-reference"><function>cairo_pattern_reference()</function></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-antialias-t" role="enum" condition="since:1.0">
<title>enum cairo_antialias_t</title>
<indexterm zone="cairo-antialias-t" role="1.0"><primary sortas="antialias_t">cairo_antialias_t</primary></indexterm>
<programlisting>typedef enum {
    CAIRO_ANTIALIAS_DEFAULT,

    /* method */
    CAIRO_ANTIALIAS_NONE,
    CAIRO_ANTIALIAS_GRAY,
    CAIRO_ANTIALIAS_SUBPIXEL,

    /* hints */
    CAIRO_ANTIALIAS_FAST,
    CAIRO_ANTIALIAS_GOOD,
    CAIRO_ANTIALIAS_BEST
} cairo_antialias_t;
</programlisting>
<para>
Specifies the type of antialiasing to do when rendering text or shapes.
</para>
<para>
As it is not necessarily clear from the above what advantages a particular
antialias method provides, since 1.12, there is also a set of hints:
<parameter>CAIRO_ANTIALIAS_FAST</parameter>: Allow the backend to degrade raster quality for speed
<parameter>CAIRO_ANTIALIAS_GOOD</parameter>: A balance between speed and quality
<parameter>CAIRO_ANTIALIAS_BEST</parameter>: A high-fidelity, but potentially slow, raster mode
</para>
<para>
These make no guarantee on how the backend will perform its rasterisation
(if it even rasterises!), nor that they have any differing effect other
than to enable some form of antialiasing. In the case of glyph rendering,
<parameter>CAIRO_ANTIALIAS_FAST</parameter> and <parameter>CAIRO_ANTIALIAS_GOOD</parameter> will be mapped to
<parameter>CAIRO_ANTIALIAS_GRAY</parameter>, with <parameter>CAIRO_ANTALIAS_BEST</parameter> being equivalent to
<parameter>CAIRO_ANTIALIAS_SUBPIXEL</parameter>.
</para>
<para>
The interpretation of <parameter>CAIRO_ANTIALIAS_DEFAULT</parameter> is left entirely up to
the backend, typically this will be similar to <parameter>CAIRO_ANTIALIAS_GOOD</parameter>.
</para><variablelist role="enum">
<varlistentry id="CAIRO-ANTIALIAS-DEFAULT:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_DEFAULT</literal></term>
<listitem><simpara>Use the default antialiasing for
  the subsystem and target device, since 1.0
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-NONE:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_NONE</literal></term>
<listitem><simpara>Use a bilevel alpha mask, since 1.0
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-GRAY:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_GRAY</literal></term>
<listitem><simpara>Perform single-color antialiasing (using
 shades of gray for black text on a white background, for example), since 1.0
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-SUBPIXEL:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_SUBPIXEL</literal></term>
<listitem><simpara>Perform antialiasing by taking
 advantage of the order of subpixel elements on devices
 such as LCD panels, since 1.0
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-FAST:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_FAST</literal></term>
<listitem><simpara>Hint that the backend should perform some
antialiasing but prefer speed over quality, since 1.12
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-GOOD:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_GOOD</literal></term>
<listitem><simpara>The backend should balance quality against
performance, since 1.12
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-ANTIALIAS-BEST:CAPS" role="constant">
<term><literal>CAIRO_ANTIALIAS_BEST</literal></term>
<listitem><simpara>Hint that the backend should render at the highest
quality, sacrificing speed if necessary, since 1.12
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-antialias" role="function" condition="since:1.0">
<title>cairo_set_antialias ()</title>
<indexterm zone="cairo-set-antialias" role="1.0"><primary sortas="set_antialias">cairo_set_antialias</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_antialias                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-antialias-t"><type>cairo_antialias_t</type></link> antialias</parameter>);</programlisting>
<para>
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
<link linkend="CAIRO-ANTIALIAS-SUBPIXEL:CAPS"><literal>CAIRO_ANTIALIAS_SUBPIXEL</literal></link> when drawing shapes.
</para>
<para>
Note that this option does not affect text rendering, instead see
<link linkend="cairo-font-options-set-antialias"><function>cairo_font_options_set_antialias()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>antialias</parameter>&#160;:</term>
<listitem><simpara>the new antialiasing mode</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-antialias" role="function" condition="since:1.0">
<title>cairo_get_antialias ()</title>
<indexterm zone="cairo-get-antialias" role="1.0"><primary sortas="get_antialias">cairo_get_antialias</primary></indexterm>
<programlisting><link linkend="cairo-antialias-t"><returnvalue>cairo_antialias_t</returnvalue></link>   cairo_get_antialias                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current shape antialiasing mode, as set by
<link linkend="cairo-set-antialias"><function>cairo_set_antialias()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current shape antialiasing mode.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-dash" role="function" condition="since:1.0">
<title>cairo_set_dash ()</title>
<indexterm zone="cairo-set-dash" role="1.0"><primary sortas="set_dash">cairo_set_dash</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_dash                      (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="double"><type>double</type></link> *dashes</parameter>,
                                                         <parameter><link linkend="int"><type>int</type></link> num_dashes</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> offset</parameter>);</programlisting>
<para>
Sets the dash pattern to be used by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>. A dash pattern
is specified by <parameter>dashes</parameter>, an array of positive values. Each value
provides the length of alternate "on" and "off" portions of the
stroke. The <parameter>offset</parameter> specifies an offset into the pattern at which
the stroke begins.
</para>
<para>
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 <link linkend="CAIRO-LINE-CAP-ROUND:CAPS"><literal>CAIRO_LINE_CAP_ROUND</literal></link> or <link linkend="CAIRO-LINE-CAP-SQUARE:CAPS"><literal>CAIRO_LINE_CAP_SQUARE</literal></link> in order
to distributed dots or squares along a path.
</para>
<para>
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 <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>.
</para>
<para>
If <parameter>num_dashes</parameter> is 0 dashing is disabled.
</para>
<para>
If <parameter>num_dashes</parameter> is 1 a symmetric pattern is assumed with alternating
on and off portions of the size specified by the single value in
<parameter>dashes</parameter>.
</para>
<para>
If any value in <parameter>dashes</parameter> is negative, or if all values are 0, then
<parameter>cr</parameter> will be put into an error state with a status of
<link linkend="CAIRO-STATUS-INVALID-DASH:CAPS"><literal>CAIRO_STATUS_INVALID_DASH</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dashes</parameter>&#160;:</term>
<listitem><simpara>an array specifying alternate lengths of on and off stroke portions</simpara></listitem></varlistentry>
<varlistentry><term><parameter>num_dashes</parameter>&#160;:</term>
<listitem><simpara>the length of the dashes array</simpara></listitem></varlistentry>
<varlistentry><term><parameter>offset</parameter>&#160;:</term>
<listitem><simpara>an offset into the dash pattern at which the stroke should start</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-dash-count" role="function" condition="since:1.4">
<title>cairo_get_dash_count ()</title>
<indexterm zone="cairo-get-dash-count" role="1.4"><primary sortas="get_dash_count">cairo_get_dash_count</primary></indexterm>
<programlisting><link linkend="int"><returnvalue>int</returnvalue></link>                 cairo_get_dash_count                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
This function returns the length of the dash array in <parameter>cr</parameter> (0 if dashing
is not currently in effect).
</para>
<para>
See also <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link> and <link linkend="cairo-get-dash"><function>cairo_get_dash()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the length of the dash array, or 0 if no dash array set.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-get-dash" role="function" condition="since:1.4">
<title>cairo_get_dash ()</title>
<indexterm zone="cairo-get-dash" role="1.4"><primary sortas="get_dash">cairo_get_dash</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_get_dash                      (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *dashes</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *offset</parameter>);</programlisting>
<para>
Gets the current dash array.  If not <link linkend="NULL:CAPS"><literal>NULL</literal></link>, <parameter>dashes</parameter> should be big
enough to hold at least the number of values returned by
<link linkend="cairo-get-dash-count"><function>cairo_get_dash_count()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>dashes</parameter>&#160;:</term>
<listitem><simpara>return value for the dash array, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>offset</parameter>&#160;:</term>
<listitem><simpara>return value for the current dash offset, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-fill-rule-t" role="enum" condition="since:1.0">
<title>enum cairo_fill_rule_t</title>
<indexterm zone="cairo-fill-rule-t" role="1.0"><primary sortas="fill_rule_t">cairo_fill_rule_t</primary></indexterm>
<programlisting>typedef enum {
    CAIRO_FILL_RULE_WINDING,
    CAIRO_FILL_RULE_EVEN_ODD
} cairo_fill_rule_t;
</programlisting>
<para>
<link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link> 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.)
</para>
<para>
The default fill rule is <link linkend="CAIRO-FILL-RULE-WINDING:CAPS"><literal>CAIRO_FILL_RULE_WINDING</literal></link>.
</para>
<para>
New entries may be added in future versions.
</para><variablelist role="enum">
<varlistentry id="CAIRO-FILL-RULE-WINDING:CAPS" role="constant">
<term><literal>CAIRO_FILL_RULE_WINDING</literal></term>
<listitem><simpara>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. (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-FILL-RULE-EVEN-ODD:CAPS" role="constant">
<term><literal>CAIRO_FILL_RULE_EVEN_ODD</literal></term>
<listitem><simpara>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. (Since 1.0)
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-fill-rule" role="function" condition="since:1.0">
<title>cairo_set_fill_rule ()</title>
<indexterm zone="cairo-set-fill-rule" role="1.0"><primary sortas="set_fill_rule">cairo_set_fill_rule</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_fill_rule                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link> fill_rule</parameter>);</programlisting>
<para>
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 <link linkend="cairo-fill"><function>cairo_fill()</function></link> and <link linkend="cairo-clip"><function>cairo_clip()</function></link>. See <link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link> for details
on the semantics of each available fill rule.
</para>
<para>
The default fill rule is <link linkend="CAIRO-FILL-RULE-WINDING:CAPS"><literal>CAIRO_FILL_RULE_WINDING</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>fill_rule</parameter>&#160;:</term>
<listitem><simpara>a fill rule, specified as a <link linkend="cairo-fill-rule-t"><type>cairo_fill_rule_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-fill-rule" role="function" condition="since:1.0">
<title>cairo_get_fill_rule ()</title>
<indexterm zone="cairo-get-fill-rule" role="1.0"><primary sortas="get_fill_rule">cairo_get_fill_rule</primary></indexterm>
<programlisting><link linkend="cairo-fill-rule-t"><returnvalue>cairo_fill_rule_t</returnvalue></link>   cairo_get_fill_rule                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current fill rule, as set by <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current fill rule.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-line-cap-t" role="enum" condition="since:1.0">
<title>enum cairo_line_cap_t</title>
<indexterm zone="cairo-line-cap-t" role="1.0"><primary sortas="line_cap_t">cairo_line_cap_t</primary></indexterm>
<programlisting>typedef enum {
    CAIRO_LINE_CAP_BUTT,
    CAIRO_LINE_CAP_ROUND,
    CAIRO_LINE_CAP_SQUARE
} cairo_line_cap_t;
</programlisting>
<para>
Specifies how to render the endpoints of the path when stroking.
</para>
<para>
The default line cap style is <link linkend="CAIRO-LINE-CAP-BUTT:CAPS"><literal>CAIRO_LINE_CAP_BUTT</literal></link>.
</para><variablelist role="enum">
<varlistentry id="CAIRO-LINE-CAP-BUTT:CAPS" role="constant">
<term><literal>CAIRO_LINE_CAP_BUTT</literal></term>
<listitem><simpara>start(stop) the line exactly at the start(end) point (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-LINE-CAP-ROUND:CAPS" role="constant">
<term><literal>CAIRO_LINE_CAP_ROUND</literal></term>
<listitem><simpara>use a round ending, the center of the circle is the end point (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-LINE-CAP-SQUARE:CAPS" role="constant">
<term><literal>CAIRO_LINE_CAP_SQUARE</literal></term>
<listitem><simpara>use squared ending, the center of the square is the end point (Since 1.0)
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-line-cap" role="function" condition="since:1.0">
<title>cairo_set_line_cap ()</title>
<indexterm zone="cairo-set-line-cap" role="1.0"><primary sortas="set_line_cap">cairo_set_line_cap</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_line_cap                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-line-cap-t"><type>cairo_line_cap_t</type></link> line_cap</parameter>);</programlisting>
<para>
Sets the current line cap style within the cairo context. See
<link linkend="cairo-line-cap-t"><type>cairo_line_cap_t</type></link> for details about how the available line cap
styles are drawn.
</para>
<para>
As with the other stroke parameters, the current line cap style is
examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
construction.
</para>
<para>
The default line cap style is <link linkend="CAIRO-LINE-CAP-BUTT:CAPS"><literal>CAIRO_LINE_CAP_BUTT</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>line_cap</parameter>&#160;:</term>
<listitem><simpara>a line cap style</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-line-cap" role="function" condition="since:1.0">
<title>cairo_get_line_cap ()</title>
<indexterm zone="cairo-get-line-cap" role="1.0"><primary sortas="get_line_cap">cairo_get_line_cap</primary></indexterm>
<programlisting><link linkend="cairo-line-cap-t"><returnvalue>cairo_line_cap_t</returnvalue></link>    cairo_get_line_cap                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current line cap style, as set by <link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current line cap style.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-line-join-t" role="enum" condition="since:1.0">
<title>enum cairo_line_join_t</title>
<indexterm zone="cairo-line-join-t" role="1.0"><primary sortas="line_join_t">cairo_line_join_t</primary></indexterm>
<programlisting>typedef enum {
    CAIRO_LINE_JOIN_MITER,
    CAIRO_LINE_JOIN_ROUND,
    CAIRO_LINE_JOIN_BEVEL
} cairo_line_join_t;
</programlisting>
<para>
Specifies how to render the junction of two lines when stroking.
</para>
<para>
The default line join style is <link linkend="CAIRO-LINE-JOIN-MITER:CAPS"><literal>CAIRO_LINE_JOIN_MITER</literal></link>.
</para><variablelist role="enum">
<varlistentry id="CAIRO-LINE-JOIN-MITER:CAPS" role="constant">
<term><literal>CAIRO_LINE_JOIN_MITER</literal></term>
<listitem><simpara>use a sharp (angled) corner, see
<link linkend="cairo-set-miter-limit"><function>cairo_set_miter_limit()</function></link> (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-LINE-JOIN-ROUND:CAPS" role="constant">
<term><literal>CAIRO_LINE_JOIN_ROUND</literal></term>
<listitem><simpara>use a rounded join, the center of the circle is the
joint point (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-LINE-JOIN-BEVEL:CAPS" role="constant">
<term><literal>CAIRO_LINE_JOIN_BEVEL</literal></term>
<listitem><simpara>use a cut-off join, the join is cut off at half
the line width from the joint point (Since 1.0)
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-line-join" role="function" condition="since:1.0">
<title>cairo_set_line_join ()</title>
<indexterm zone="cairo-set-line-join" role="1.0"><primary sortas="set_line_join">cairo_set_line_join</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_line_join                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-line-join-t"><type>cairo_line_join_t</type></link> line_join</parameter>);</programlisting>
<para>
Sets the current line join style within the cairo context. See
<link linkend="cairo-line-join-t"><type>cairo_line_join_t</type></link> for details about how the available line join
styles are drawn.
</para>
<para>
As with the other stroke parameters, the current line join style is
examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
construction.
</para>
<para>
The default line join style is <link linkend="CAIRO-LINE-JOIN-MITER:CAPS"><literal>CAIRO_LINE_JOIN_MITER</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>line_join</parameter>&#160;:</term>
<listitem><simpara>a line join style</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-line-join" role="function" condition="since:1.0">
<title>cairo_get_line_join ()</title>
<indexterm zone="cairo-get-line-join" role="1.0"><primary sortas="get_line_join">cairo_get_line_join</primary></indexterm>
<programlisting><link linkend="cairo-line-join-t"><returnvalue>cairo_line_join_t</returnvalue></link>   cairo_get_line_join                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current line join style, as set by <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current line join style.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-line-width" role="function" condition="since:1.0">
<title>cairo_set_line_width ()</title>
<indexterm zone="cairo-set-line-width" role="1.0"><primary sortas="set_line_width">cairo_set_line_width</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_line_width                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> width</parameter>);</programlisting>
<para>
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).
</para>
<para>
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 <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>. The simplest usage
makes both of these spaces identical. That is, if there is no
change to the CTM between a call to <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link> and the
stroking operation, then one can just pass user-space values to
<link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link> and ignore this note.
</para>
<para>
As with the other stroke parameters, the current line width is
examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
construction.
</para>
<para>
The default line width value is 2.0.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>width</parameter>&#160;:</term>
<listitem><simpara>a line width</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-line-width" role="function" condition="since:1.0">
<title>cairo_get_line_width ()</title>
<indexterm zone="cairo-get-line-width" role="1.0"><primary sortas="get_line_width">cairo_get_line_width</primary></indexterm>
<programlisting><link linkend="double"><returnvalue>double</returnvalue></link>              cairo_get_line_width                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
This function returns the current line width value exactly as set by
<link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>. Note that the value is unchanged even if
the CTM has changed between the calls to <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link> and
<link linkend="cairo-get-line-width"><function>cairo_get_line_width()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current line width.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-miter-limit" role="function" condition="since:1.0">
<title>cairo_set_miter_limit ()</title>
<indexterm zone="cairo-set-miter-limit" role="1.0"><primary sortas="set_miter_limit">cairo_set_miter_limit</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_miter_limit               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> limit</parameter>);</programlisting>
<para>
Sets the current miter limit within the cairo context.
</para>
<para>
If the current line join style is set to <link linkend="CAIRO-LINE-JOIN-MITER:CAPS"><literal>CAIRO_LINE_JOIN_MITER</literal></link>
(see <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>), 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.
</para>
<para>
As with the other stroke parameters, the current line miter limit is
examined by <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link>, and
<link linkend="cairo-stroke-to-path"><function>cairo_stroke_to_path()</function></link>, but does not have any effect during path
construction.
</para>
<para>
The default miter limit value is 10.0, which will convert joins
with interior angles less than 11 degrees to bevels instead of
miters. For reference, a miter limit of 2.0 makes the miter cutoff
at 60 degrees, and a miter limit of 1.414 makes the cutoff at 90
degrees.
</para>
<para>
A miter limit for a desired angle can be computed as: miter limit =
1/sin(angle/2)
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>limit</parameter>&#160;:</term>
<listitem><simpara>miter limit to set</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-miter-limit" role="function" condition="since:1.0">
<title>cairo_get_miter_limit ()</title>
<indexterm zone="cairo-get-miter-limit" role="1.0"><primary sortas="get_miter_limit">cairo_get_miter_limit</primary></indexterm>
<programlisting><link linkend="double"><returnvalue>double</returnvalue></link>              cairo_get_miter_limit               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current miter limit, as set by <link linkend="cairo-set-miter-limit"><function>cairo_set_miter_limit()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current miter limit.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-operator-t" role="enum" condition="since:1.0">
<title>enum cairo_operator_t</title>
<indexterm zone="cairo-operator-t" role="1.0"><primary sortas="operator_t">cairo_operator_t</primary></indexterm>
<programlisting>typedef enum {
    CAIRO_OPERATOR_CLEAR,

    CAIRO_OPERATOR_SOURCE,
    CAIRO_OPERATOR_OVER,
    CAIRO_OPERATOR_IN,
    CAIRO_OPERATOR_OUT,
    CAIRO_OPERATOR_ATOP,

    CAIRO_OPERATOR_DEST,
    CAIRO_OPERATOR_DEST_OVER,
    CAIRO_OPERATOR_DEST_IN,
    CAIRO_OPERATOR_DEST_OUT,
    CAIRO_OPERATOR_DEST_ATOP,

    CAIRO_OPERATOR_XOR,
    CAIRO_OPERATOR_ADD,
    CAIRO_OPERATOR_SATURATE,

    CAIRO_OPERATOR_MULTIPLY,
    CAIRO_OPERATOR_SCREEN,
    CAIRO_OPERATOR_OVERLAY,
    CAIRO_OPERATOR_DARKEN,
    CAIRO_OPERATOR_LIGHTEN,
    CAIRO_OPERATOR_COLOR_DODGE,
    CAIRO_OPERATOR_COLOR_BURN,
    CAIRO_OPERATOR_HARD_LIGHT,
    CAIRO_OPERATOR_SOFT_LIGHT,
    CAIRO_OPERATOR_DIFFERENCE,
    CAIRO_OPERATOR_EXCLUSION,
    CAIRO_OPERATOR_HSL_HUE,
    CAIRO_OPERATOR_HSL_SATURATION,
    CAIRO_OPERATOR_HSL_COLOR,
    CAIRO_OPERATOR_HSL_LUMINOSITY
} cairo_operator_t;
</programlisting>
<para>
<link linkend="cairo-operator-t"><type>cairo_operator_t</type></link> is used to set the compositing operator for all cairo
drawing operations.
</para>
<para>
The default operator is <link linkend="CAIRO-OPERATOR-OVER:CAPS"><literal>CAIRO_OPERATOR_OVER</literal></link>.
</para>
<para>
The operators marked as <firstterm>unbounded</firstterm> modify their
destination even outside of the mask layer (that is, their effect is not
bound by the mask layer).  However, their effect can still be limited by
way of clipping.
</para>
<para>
To keep things simple, the operator descriptions here
document the behavior for when both source and destination are either fully
transparent or fully opaque.  The actual implementation works for
translucent layers too.
For a more detailed explanation of the effects of each operator, including
the mathematical definitions, see
<ulink url="http://cairographics.org/operators/">http://cairographics.org/operators/</ulink>.
</para><variablelist role="enum">
<varlistentry id="CAIRO-OPERATOR-CLEAR:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_CLEAR</literal></term>
<listitem><simpara>clear destination layer (bounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-SOURCE:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_SOURCE</literal></term>
<listitem><simpara>replace destination layer (bounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-OVER:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_OVER</literal></term>
<listitem><simpara>draw source layer on top of destination layer
(bounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-IN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_IN</literal></term>
<listitem><simpara>draw source where there was destination content
(unbounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-OUT:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_OUT</literal></term>
<listitem><simpara>draw source where there was no destination
content (unbounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-ATOP:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_ATOP</literal></term>
<listitem><simpara>draw source on top of destination content and
only there (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DEST:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DEST</literal></term>
<listitem><simpara>ignore the source (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DEST-OVER:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DEST_OVER</literal></term>
<listitem><simpara>draw destination on top of source (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DEST-IN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DEST_IN</literal></term>
<listitem><simpara>leave destination only where there was
source content (unbounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DEST-OUT:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DEST_OUT</literal></term>
<listitem><simpara>leave destination only where there was no
source content (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DEST-ATOP:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DEST_ATOP</literal></term>
<listitem><simpara>leave destination on top of source content
and only there (unbounded) (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-XOR:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_XOR</literal></term>
<listitem><simpara>source and destination are shown where there is only
one of them (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-ADD:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_ADD</literal></term>
<listitem><simpara>source and destination layers are accumulated (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-SATURATE:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_SATURATE</literal></term>
<listitem><simpara>like over, but assuming source and dest are
disjoint geometries (Since 1.0)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-MULTIPLY:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_MULTIPLY</literal></term>
<listitem><simpara>source and destination layers are multiplied.
This causes the result to be at least as dark as the darker inputs. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-SCREEN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_SCREEN</literal></term>
<listitem><simpara>source and destination are complemented and
multiplied. This causes the result to be at least as light as the lighter
inputs. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-OVERLAY:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_OVERLAY</literal></term>
<listitem><simpara>multiplies or screens, depending on the
lightness of the destination color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DARKEN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DARKEN</literal></term>
<listitem><simpara>replaces the destination with the source if it
is darker, otherwise keeps the source. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-LIGHTEN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_LIGHTEN</literal></term>
<listitem><simpara>replaces the destination with the source if it
is lighter, otherwise keeps the source. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-COLOR-DODGE:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_COLOR_DODGE</literal></term>
<listitem><simpara>brightens the destination color to reflect
the source color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-COLOR-BURN:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_COLOR_BURN</literal></term>
<listitem><simpara>darkens the destination color to reflect
the source color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-HARD-LIGHT:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_HARD_LIGHT</literal></term>
<listitem><simpara>Multiplies or screens, dependent on source
color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-SOFT-LIGHT:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_SOFT_LIGHT</literal></term>
<listitem><simpara>Darkens or lightens, dependent on source
color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-DIFFERENCE:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_DIFFERENCE</literal></term>
<listitem><simpara>Takes the difference of the source and
destination color. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-EXCLUSION:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_EXCLUSION</literal></term>
<listitem><simpara>Produces an effect similar to difference, but
with lower contrast. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-HSL-HUE:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_HSL_HUE</literal></term>
<listitem><simpara>Creates a color with the hue of the source
and the saturation and luminosity of the target. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-HSL-SATURATION:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_HSL_SATURATION</literal></term>
<listitem><simpara>Creates a color with the saturation
of the source and the hue and luminosity of the target. Painting with
this mode onto a gray area produces no change. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-HSL-COLOR:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_HSL_COLOR</literal></term>
<listitem><simpara>Creates a color with the hue and saturation
of the source and the luminosity of the target. This preserves the gray
levels of the target and is useful for coloring monochrome images or
tinting color images. (Since 1.10)
</simpara></listitem>
</varlistentry>
<varlistentry id="CAIRO-OPERATOR-HSL-LUMINOSITY:CAPS" role="constant">
<term><literal>CAIRO_OPERATOR_HSL_LUMINOSITY</literal></term>
<listitem><simpara>Creates a color with the luminosity of
the source and the hue and saturation of the target. This produces an
inverse effect to <parameter>CAIRO_OPERATOR_HSL_COLOR</parameter>. (Since 1.10)
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-operator" role="function" condition="since:1.0">
<title>cairo_set_operator ()</title>
<indexterm zone="cairo-set-operator" role="1.0"><primary sortas="set_operator">cairo_set_operator</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_operator                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-operator-t"><type>cairo_operator_t</type></link> op</parameter>);</programlisting>
<para>
Sets the compositing operator to be used for all drawing
operations. See <link linkend="cairo-operator-t"><type>cairo_operator_t</type></link> for details on the semantics of
each available compositing operator.
</para>
<para>
The default operator is <link linkend="CAIRO-OPERATOR-OVER:CAPS"><literal>CAIRO_OPERATOR_OVER</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>op</parameter>&#160;:</term>
<listitem><simpara>a compositing operator, specified as a <link linkend="cairo-operator-t"><type>cairo_operator_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-operator" role="function" condition="since:1.0">
<title>cairo_get_operator ()</title>
<indexterm zone="cairo-get-operator" role="1.0"><primary sortas="get_operator">cairo_get_operator</primary></indexterm>
<programlisting><link linkend="cairo-operator-t"><returnvalue>cairo_operator_t</returnvalue></link>    cairo_get_operator                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current compositing operator for a cairo context.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current compositing operator.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-set-tolerance" role="function" condition="since:1.0">
<title>cairo_set_tolerance ()</title>
<indexterm zone="cairo-set-tolerance" role="1.0"><primary sortas="set_tolerance">cairo_set_tolerance</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_set_tolerance                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> tolerance</parameter>);</programlisting>
<para>
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 <parameter>tolerance</parameter>. 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.)  The accuracy of paths
within Cairo is limited by the precision of its internal arithmetic, and
the prescribed <parameter>tolerance</parameter> is restricted to the smallest
representable internal value.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>tolerance</parameter>&#160;:</term>
<listitem><simpara>the tolerance, in device units (typically pixels)</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-tolerance" role="function" condition="since:1.0">
<title>cairo_get_tolerance ()</title>
<indexterm zone="cairo-get-tolerance" role="1.0"><primary sortas="get_tolerance">cairo_get_tolerance</primary></indexterm>
<programlisting><link linkend="double"><returnvalue>double</returnvalue></link>              cairo_get_tolerance                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current tolerance value, as set by <link linkend="cairo-set-tolerance"><function>cairo_set_tolerance()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current tolerance value.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-clip" role="function" condition="since:1.0">
<title>cairo_clip ()</title>
<indexterm zone="cairo-clip" role="1.0"><primary sortas="clip">cairo_clip</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_clip                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Establishes a new clip region by intersecting the current clip
region with the current path as it would be filled by <link linkend="cairo-fill"><function>cairo_fill()</function></link>
and according to the current fill rule (see <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>).
</para>
<para>
After <link linkend="cairo-clip"><function>cairo_clip()</function></link>, the current path will be cleared from the cairo
context.
</para>
<para>
The current clip region affects all drawing operations by
effectively masking out any changes to the surface that are outside
the current clip region.
</para>
<para>
Calling <link linkend="cairo-clip"><function>cairo_clip()</function></link> 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 <link linkend="cairo-clip"><function>cairo_clip()</function></link> within a <link linkend="cairo-save"><function>cairo_save()</function></link>/<link linkend="cairo-restore"><function>cairo_restore()</function></link>
pair. The only other means of increasing the size of the clip
region is <link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-clip-preserve" role="function" condition="since:1.0">
<title>cairo_clip_preserve ()</title>
<indexterm zone="cairo-clip-preserve" role="1.0"><primary sortas="clip_preserve">cairo_clip_preserve</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_clip_preserve                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Establishes a new clip region by intersecting the current clip
region with the current path as it would be filled by <link linkend="cairo-fill"><function>cairo_fill()</function></link>
and according to the current fill rule (see <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link>).
</para>
<para>
Unlike <link linkend="cairo-clip"><function>cairo_clip()</function></link>, <link linkend="cairo-clip-preserve"><function>cairo_clip_preserve()</function></link> preserves the path within
the cairo context.
</para>
<para>
The current clip region affects all drawing operations by
effectively masking out any changes to the surface that are outside
the current clip region.
</para>
<para>
Calling <link linkend="cairo-clip-preserve"><function>cairo_clip_preserve()</function></link> 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 <link linkend="cairo-clip-preserve"><function>cairo_clip_preserve()</function></link> within a <link linkend="cairo-save"><function>cairo_save()</function></link>/<link linkend="cairo-restore"><function>cairo_restore()</function></link>
pair. The only other means of increasing the size of the clip
region is <link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-clip-extents" role="function" condition="since:1.4">
<title>cairo_clip_extents ()</title>
<indexterm zone="cairo-clip-extents" role="1.4"><primary sortas="clip_extents">cairo_clip_extents</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_clip_extents                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);</programlisting>
<para>
Computes a bounding box in user coordinates covering the area inside the
current clip.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x1</parameter>&#160;:</term>
<listitem><simpara>left of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y1</parameter>&#160;:</term>
<listitem><simpara>top of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x2</parameter>&#160;:</term>
<listitem><simpara>right of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y2</parameter>&#160;:</term>
<listitem><simpara>bottom of the resulting extents</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-in-clip" role="function" condition="since:1.10">
<title>cairo_in_clip ()</title>
<indexterm zone="cairo-in-clip" role="1.10"><primary sortas="in_clip">cairo_in_clip</primary></indexterm>
<programlisting><link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        cairo_in_clip                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);</programlisting>
<para>
Tests whether the given point is inside the area that would be
visible through the current clip, i.e. the area that would be filled by
a <link linkend="cairo-paint"><function>cairo_paint()</function></link> operation.
</para>
<para>
See <link linkend="cairo-clip"><function>cairo_clip()</function></link>, and <link linkend="cairo-clip-preserve"><function>cairo_clip_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>X coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&#160;:</term>
<listitem><simpara>Y coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>A non-zero value if the point is inside, or zero if
outside.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.10</para></refsect2>
<refsect2 id="cairo-reset-clip" role="function" condition="since:1.0">
<title>cairo_reset_clip ()</title>
<indexterm zone="cairo-reset-clip" role="1.0"><primary sortas="reset_clip">cairo_reset_clip</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_reset_clip                    (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
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.
</para>
<para>
Note that code meant to be reusable should not call
<link linkend="cairo-reset-clip"><function>cairo_reset_clip()</function></link> as it will cause results unexpected by
higher-level code which calls <link linkend="cairo-clip"><function>cairo_clip()</function></link>. Consider using
<link linkend="cairo-save"><function>cairo_save()</function></link> and <link linkend="cairo-restore"><function>cairo_restore()</function></link> around <link linkend="cairo-clip"><function>cairo_clip()</function></link> as a more
robust means of temporarily restricting the clip region.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-rectangle-t" role="struct" condition="since:1.4">
<title>cairo_rectangle_t</title>
<indexterm zone="cairo-rectangle-t" role="1.4"><primary sortas="rectangle_t">cairo_rectangle_t</primary></indexterm>
<programlisting>typedef struct {
    double x, y, width, height;
} cairo_rectangle_t;
</programlisting>
<para>
A data structure for holding a rectangle.
</para><variablelist role="struct">
<varlistentry><term><link linkend="double"><type>double</type></link>&#160;<structfield id="cairo-rectangle-t.x">x</structfield>;</term>
<listitem><simpara>X coordinate of the left side of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="double"><type>double</type></link>&#160;<structfield id="cairo-rectangle-t.y">y</structfield>;</term>
<listitem><simpara>Y coordinate of the the top side of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="double"><type>double</type></link>&#160;<structfield id="cairo-rectangle-t.width">width</structfield>;</term>
<listitem><simpara>width of the rectangle</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="double"><type>double</type></link>&#160;<structfield id="cairo-rectangle-t.height">height</structfield>;</term>
<listitem><simpara>height of the rectangle</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-rectangle-list-t" role="struct" condition="since:1.4">
<title>cairo_rectangle_list_t</title>
<indexterm zone="cairo-rectangle-list-t" role="1.4"><primary sortas="rectangle_list_t">cairo_rectangle_list_t</primary></indexterm>
<programlisting>typedef struct {
    cairo_status_t     status;
    cairo_rectangle_t *rectangles;
    int                num_rectangles;
} cairo_rectangle_list_t;
</programlisting>
<para>
A data structure for holding a dynamically allocated
array of rectangles.
</para><variablelist role="struct">
<varlistentry><term><link linkend="cairo-status-t"><type>cairo_status_t</type></link>&#160;<structfield id="cairo-rectangle-list-t.status">status</structfield>;</term>
<listitem><simpara>Error status of the rectangle list</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="cairo-rectangle-t"><type>cairo_rectangle_t</type></link>&#160;*<structfield id="cairo-rectangle-list-t.rectangles">rectangles</structfield>;</term>
<listitem><simpara>Array containing the rectangles</simpara></listitem>
</varlistentry>
<varlistentry><term><link linkend="int"><type>int</type></link>&#160;<structfield id="cairo-rectangle-list-t.num-rectangles">num_rectangles</structfield>;</term>
<listitem><simpara>Number of rectangles in this list</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-rectangle-list-destroy" role="function" condition="since:1.4">
<title>cairo_rectangle_list_destroy ()</title>
<indexterm zone="cairo-rectangle-list-destroy" role="1.4"><primary sortas="rectangle_list_destroy">cairo_rectangle_list_destroy</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_rectangle_list_destroy        (<parameter><link linkend="cairo-rectangle-list-t"><type>cairo_rectangle_list_t</type></link> *rectangle_list</parameter>);</programlisting>
<para>
Unconditionally frees <parameter>rectangle_list</parameter> and all associated
references. After this call, the <parameter>rectangle_list</parameter> pointer must not
be dereferenced.
</para><variablelist role="params">
<varlistentry><term><parameter>rectangle_list</parameter>&#160;:</term>
<listitem><simpara>a rectangle list, as obtained from <link linkend="cairo-copy-clip-rectangle-list"><function>cairo_copy_clip_rectangle_list()</function></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-copy-clip-rectangle-list" role="function" condition="since:1.4">
<title>cairo_copy_clip_rectangle_list ()</title>
<indexterm zone="cairo-copy-clip-rectangle-list" role="1.4"><primary sortas="copy_clip_rectangle_list">cairo_copy_clip_rectangle_list</primary></indexterm>
<programlisting><link linkend="cairo-rectangle-list-t"><returnvalue>cairo_rectangle_list_t</returnvalue></link> * cairo_copy_clip_rectangle_list (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Gets the current clip region as a list of rectangles in user coordinates.
Never returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</para>
<para>
The status in the list may be <link linkend="CAIRO-STATUS-CLIP-NOT-REPRESENTABLE:CAPS"><literal>CAIRO_STATUS_CLIP_NOT_REPRESENTABLE</literal></link> 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.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current clip region as a list of rectangles in user coordinates,
which should be destroyed using <link linkend="cairo-rectangle-list-destroy"><function>cairo_rectangle_list_destroy()</function></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-fill" role="function" condition="since:1.0">
<title>cairo_fill ()</title>
<indexterm zone="cairo-fill" role="1.0"><primary sortas="fill">cairo_fill</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_fill                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
A drawing operator that fills the current path according to the
current fill rule, (each sub-path is implicitly closed before being
filled). After <link linkend="cairo-fill"><function>cairo_fill()</function></link>, the current path will be cleared from
the cairo context. See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and
<link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-fill-preserve" role="function" condition="since:1.0">
<title>cairo_fill_preserve ()</title>
<indexterm zone="cairo-fill-preserve" role="1.0"><primary sortas="fill_preserve">cairo_fill_preserve</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_fill_preserve                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
A drawing operator that fills the current path according to the
current fill rule, (each sub-path is implicitly closed before being
filled). Unlike <link linkend="cairo-fill"><function>cairo_fill()</function></link>, <link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link> preserves the
path within the cairo context.
</para>
<para>
See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill"><function>cairo_fill()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-fill-extents" role="function" condition="since:1.0">
<title>cairo_fill_extents ()</title>
<indexterm zone="cairo-fill-extents" role="1.0"><primary sortas="fill_extents">cairo_fill_extents</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_fill_extents                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);</programlisting>
<para>
Computes a bounding box in user coordinates covering the area that
would be affected, (the "inked" area), by a <link linkend="cairo-fill"><function>cairo_fill()</function></link> 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.
</para>
<para>
Contrast with <link linkend="cairo-path-extents"><function>cairo_path_extents()</function></link>, which is similar, but returns
non-zero extents for some paths with no inked area, (such as a
simple line segment).
</para>
<para>
Note that <link linkend="cairo-fill-extents"><function>cairo_fill_extents()</function></link> must necessarily do more work to
compute the precise inked areas in light of the fill rule, so
<link linkend="cairo-path-extents"><function>cairo_path_extents()</function></link> may be more desirable for sake of performance
if the non-inked path extents are desired.
</para>
<para>
See <link linkend="cairo-fill"><function>cairo_fill()</function></link>, <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x1</parameter>&#160;:</term>
<listitem><simpara>left of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y1</parameter>&#160;:</term>
<listitem><simpara>top of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x2</parameter>&#160;:</term>
<listitem><simpara>right of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y2</parameter>&#160;:</term>
<listitem><simpara>bottom of the resulting extents</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-in-fill" role="function" condition="since:1.0">
<title>cairo_in_fill ()</title>
<indexterm zone="cairo-in-fill" role="1.0"><primary sortas="in_fill">cairo_in_fill</primary></indexterm>
<programlisting><link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        cairo_in_fill                       (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);</programlisting>
<para>
Tests whether the given point is inside the area that would be
affected by a <link linkend="cairo-fill"><function>cairo_fill()</function></link> operation given the current path and
filling parameters. Surface dimensions and clipping are not taken
into account.
</para>
<para>
See <link linkend="cairo-fill"><function>cairo_fill()</function></link>, <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>X coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&#160;:</term>
<listitem><simpara>Y coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>A non-zero value if the point is inside, or zero if
outside.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-mask" role="function" condition="since:1.0">
<title>cairo_mask ()</title>
<indexterm zone="cairo-mask" role="1.0"><primary sortas="mask">cairo_mask</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_mask                          (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> *pattern</parameter>);</programlisting>
<para>
A drawing operator that paints the current source
using the alpha channel of <parameter>pattern</parameter> as a mask. (Opaque
areas of <parameter>pattern</parameter> are painted with the source, transparent
areas are not painted.)
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pattern</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-mask-surface" role="function" condition="since:1.0">
<title>cairo_mask_surface ()</title>
<indexterm zone="cairo-mask-surface" role="1.0"><primary sortas="mask_surface">cairo_mask_surface</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_mask_surface                  (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> *surface</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> surface_x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> surface_y</parameter>);</programlisting>
<para>
A drawing operator that paints the current source
using the alpha channel of <parameter>surface</parameter> as a mask. (Opaque
areas of <parameter>surface</parameter> are painted with the source, transparent
areas are not painted.)
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>surface</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>surface_x</parameter>&#160;:</term>
<listitem><simpara>X coordinate at which to place the origin of <parameter>surface</parameter></simpara></listitem></varlistentry>
<varlistentry><term><parameter>surface_y</parameter>&#160;:</term>
<listitem><simpara>Y coordinate at which to place the origin of <parameter>surface</parameter></simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-paint" role="function" condition="since:1.0">
<title>cairo_paint ()</title>
<indexterm zone="cairo-paint" role="1.0"><primary sortas="paint">cairo_paint</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_paint                         (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
A drawing operator that paints the current source everywhere within
the current clip region.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-paint-with-alpha" role="function" condition="since:1.0">
<title>cairo_paint_with_alpha ()</title>
<indexterm zone="cairo-paint-with-alpha" role="1.0"><primary sortas="paint_with_alpha">cairo_paint_with_alpha</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_paint_with_alpha              (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> alpha</parameter>);</programlisting>
<para>
A drawing operator that paints the current source everywhere within
the current clip region using a mask of constant alpha value
<parameter>alpha</parameter>. The effect is similar to <link linkend="cairo-paint"><function>cairo_paint()</function></link>, but the drawing
is faded out using the alpha value.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>alpha</parameter>&#160;:</term>
<listitem><simpara>alpha value, between 0 (transparent) and 1 (opaque)</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-stroke" role="function" condition="since:1.0">
<title>cairo_stroke ()</title>
<indexterm zone="cairo-stroke" role="1.0"><primary sortas="stroke">cairo_stroke</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_stroke                        (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
A drawing operator that strokes the current path according to the
current line width, line join, line cap, and dash settings. After
<link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, the current path will be cleared from the cairo
context. See <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.
</para>
<para>
Note: Degenerate segments and sub-paths are treated specially and
provide a useful result. These can result in two different
situations:
</para>
<para>
1. Zero-length "on" segments set in <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>. If the cap
style is <link linkend="CAIRO-LINE-CAP-ROUND:CAPS"><literal>CAIRO_LINE_CAP_ROUND</literal></link> or <link linkend="CAIRO-LINE-CAP-SQUARE:CAPS"><literal>CAIRO_LINE_CAP_SQUARE</literal></link> then these
segments will be drawn as circular dots or squares respectively. In
the case of <link linkend="CAIRO-LINE-CAP-SQUARE:CAPS"><literal>CAIRO_LINE_CAP_SQUARE</literal></link>, the orientation of the squares
is determined by the direction of the underlying path.
</para>
<para>
2. A sub-path created by <link linkend="cairo-move-to"><function>cairo_move_to()</function></link> followed by either a
<link linkend="cairo-close-path"><function>cairo_close_path()</function></link> or one or more calls to <link linkend="cairo-line-to"><function>cairo_line_to()</function></link> to the
same coordinate as the <link linkend="cairo-move-to"><function>cairo_move_to()</function></link>. If the cap style is
<link linkend="CAIRO-LINE-CAP-ROUND:CAPS"><literal>CAIRO_LINE_CAP_ROUND</literal></link> then these sub-paths will be drawn as circular
dots. Note that in the case of <link linkend="CAIRO-LINE-CAP-SQUARE:CAPS"><literal>CAIRO_LINE_CAP_SQUARE</literal></link> a degenerate
sub-path will not be drawn at all, (since the correct orientation
is indeterminate).
</para>
<para>
In no case will a cap style of <link linkend="CAIRO-LINE-CAP-BUTT:CAPS"><literal>CAIRO_LINE_CAP_BUTT</literal></link> cause anything
to be drawn in the case of either degenerate segments or sub-paths.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-stroke-preserve" role="function" condition="since:1.0">
<title>cairo_stroke_preserve ()</title>
<indexterm zone="cairo-stroke-preserve" role="1.0"><primary sortas="stroke_preserve">cairo_stroke_preserve</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_stroke_preserve               (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
A drawing operator that strokes the current path according to the
current line width, line join, line cap, and dash settings. Unlike
<link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link> preserves the path within the
cairo context.
</para>
<para>
See <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-stroke-extents" role="function" condition="since:1.0">
<title>cairo_stroke_extents ()</title>
<indexterm zone="cairo-stroke-extents" role="1.0"><primary sortas="stroke_extents">cairo_stroke_extents</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_stroke_extents                (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y1</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *x2</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> *y2</parameter>);</programlisting>
<para>
Computes a bounding box in user coordinates covering the area that
would be affected, (the "inked" area), by a <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>
operation given the current path and stroke parameters.
If the current path is empty, returns an empty rectangle ((0,0), (0,0)).
Surface dimensions and clipping are not taken into account.
</para>
<para>
Note that if the line width is set to exactly zero, then
<link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link> will return an empty rectangle. Contrast with
<link linkend="cairo-path-extents"><function>cairo_path_extents()</function></link> which can be used to compute the non-empty
bounds as the line width approaches zero.
</para>
<para>
Note that <link linkend="cairo-stroke-extents"><function>cairo_stroke_extents()</function></link> must necessarily do more work to
compute the precise inked areas in light of the stroke parameters,
so <link linkend="cairo-path-extents"><function>cairo_path_extents()</function></link> may be more desirable for sake of
performance if non-inked path extents are desired.
</para>
<para>
See <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x1</parameter>&#160;:</term>
<listitem><simpara>left of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y1</parameter>&#160;:</term>
<listitem><simpara>top of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x2</parameter>&#160;:</term>
<listitem><simpara>right of the resulting extents</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y2</parameter>&#160;:</term>
<listitem><simpara>bottom of the resulting extents</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-in-stroke" role="function" condition="since:1.0">
<title>cairo_in_stroke ()</title>
<indexterm zone="cairo-in-stroke" role="1.0"><primary sortas="in_stroke">cairo_in_stroke</primary></indexterm>
<programlisting><link linkend="cairo-bool-t"><returnvalue>cairo_bool_t</returnvalue></link>        cairo_in_stroke                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> x</parameter>,
                                                         <parameter><link linkend="double"><type>double</type></link> y</parameter>);</programlisting>
<para>
Tests whether the given point is inside the area that would be
affected by a <link linkend="cairo-stroke"><function>cairo_stroke()</function></link> operation given the current path and
stroking parameters. Surface dimensions and clipping are not taken
into account.
</para>
<para>
See <link linkend="cairo-stroke"><function>cairo_stroke()</function></link>, <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</function></link>, <link linkend="cairo-set-line-join"><function>cairo_set_line_join()</function></link>,
<link linkend="cairo-set-line-cap"><function>cairo_set_line_cap()</function></link>, <link linkend="cairo-set-dash"><function>cairo_set_dash()</function></link>, and
<link linkend="cairo-stroke-preserve"><function>cairo_stroke_preserve()</function></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x</parameter>&#160;:</term>
<listitem><simpara>X coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y</parameter>&#160;:</term>
<listitem><simpara>Y coordinate of the point to test</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>A non-zero value if the point is inside, or zero if
outside.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-copy-page" role="function" condition="since:1.0">
<title>cairo_copy_page ()</title>
<indexterm zone="cairo-copy-page" role="1.0"><primary sortas="copy_page">cairo_copy_page</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_copy_page                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
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 <link linkend="cairo-show-page"><function>cairo_show_page()</function></link> if you want to get an
empty page after the emission.
</para>
<para>
This is a convenience function that simply calls
<link linkend="cairo-surface-copy-page"><function>cairo_surface_copy_page()</function></link> on <parameter>cr</parameter>'s target.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-show-page" role="function" condition="since:1.0">
<title>cairo_show_page ()</title>
<indexterm zone="cairo-show-page" role="1.0"><primary sortas="show_page">cairo_show_page</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link>                cairo_show_page                     (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Emits and clears the current page for backends that support multiple
pages.  Use <link linkend="cairo-copy-page"><function>cairo_copy_page()</function></link> if you don't want to clear the page.
</para>
<para>
This is a convenience function that simply calls
<link linkend="cairo-surface-show-page"><function>cairo_surface_show_page()</function></link> on <parameter>cr</parameter>'s target.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a cairo context</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.0</para></refsect2>
<refsect2 id="cairo-get-reference-count" role="function" condition="since:1.4">
<title>cairo_get_reference_count ()</title>
<indexterm zone="cairo-get-reference-count" role="1.4"><primary sortas="get_reference_count">cairo_get_reference_count</primary></indexterm>
<programlisting>unsigned <link linkend="int"><returnvalue>int</returnvalue></link>        cairo_get_reference_count           (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>);</programlisting>
<para>
Returns the current reference count of <parameter>cr</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the current reference count of <parameter>cr</parameter>.  If the
object is a nil object, 0 will be returned.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-set-user-data" role="function" condition="since:1.4">
<title>cairo_set_user_data ()</title>
<indexterm zone="cairo-set-user-data" role="1.4"><primary sortas="set_user_data">cairo_set_user_data</primary></indexterm>
<programlisting><link linkend="cairo-status-t"><returnvalue>cairo_status_t</returnvalue></link>      cairo_set_user_data                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> *key</parameter>,
                                                         <parameter><link linkend="void"><type>void</type></link> *user_data</parameter>,
                                                         <parameter><link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> destroy</parameter>);</programlisting>
<para>
Attach user data to <parameter>cr</parameter>.  To remove user data from a surface,
call this function with the key that was used to set it and <link linkend="NULL:CAPS"><literal>NULL</literal></link>
for <parameter>data</parameter>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&#160;:</term>
<listitem><simpara>the address of a <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> to attach the user data to</simpara></listitem></varlistentry>
<varlistentry><term><parameter>user_data</parameter>&#160;:</term>
<listitem><simpara>the user data to attach to the <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>destroy</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-destroy-func-t"><type>cairo_destroy_func_t</type></link> which will be called when the
<link linkend="cairo-t"><type>cairo_t</type></link> is destroyed or when new user data is attached using the
same key.</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara><link linkend="CAIRO-STATUS-SUCCESS:CAPS"><literal>CAIRO_STATUS_SUCCESS</literal></link> or <link linkend="CAIRO-STATUS-NO-MEMORY:CAPS"><literal>CAIRO_STATUS_NO_MEMORY</literal></link> if a
slot could not be allocated for the user data.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>
<refsect2 id="cairo-get-user-data" role="function" condition="since:1.4">
<title>cairo_get_user_data ()</title>
<indexterm zone="cairo-get-user-data" role="1.4"><primary sortas="get_user_data">cairo_get_user_data</primary></indexterm>
<programlisting><link linkend="void"><returnvalue>void</returnvalue></link> *              cairo_get_user_data                 (<parameter><link linkend="cairo-t"><type>cairo_t</type></link> *cr</parameter>,
                                                         <parameter>const <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> *key</parameter>);</programlisting>
<para>
Return user data previously attached to <parameter>cr</parameter> using the specified
key.  If no user data has been attached with the given key this
function returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>cr</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="cairo-t"><type>cairo_t</type></link></simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&#160;:</term>
<listitem><simpara>the address of the <link linkend="cairo-user-data-key-t"><type>cairo_user_data_key_t</type></link> the user data was
attached to</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the user data previously attached or <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 1.4</para></refsect2>

</refsect1>
<refsect1 id="cairo-cairo-t.see-also">
<title>See Also</title>
<link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>
</refsect1>

</refentry>
