|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21585/root/usr/share/gtk-doc/html/cairo/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Patterns</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="Drawing.html" title="Drawing">
<link rel="prev" href="cairo-Paths.html" title="Paths">
<link rel="next" href="cairo-Transformations.html" title="Transformations">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="pt01.html" title="Part I. Tutorial">
<link rel="part" href="pt02.html" title="Part II. Reference">
<link rel="chapter" href="Drawing.html" title="Drawing">
<link rel="chapter" href="Fonts.html" title="Fonts">
<link rel="chapter" href="Surfaces.html" title="Surfaces">
<link rel="chapter" href="Support.html" title="Utilities">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of new symbols in 1.2">
<link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="cairo-Paths.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="Drawing.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Cairo: A Vector Graphics Library</th>
<td><a accesskey="n" href="cairo-Transformations.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2549349" class="shortcut">Top</a>
 | 
<a href="#id2532446" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-Patterns"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2549349"></a><span class="refentrytitle">Patterns</span>
</h2>
<p>Patterns — Gradients and filtered sources</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
typedef <a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</a>
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue);
void <a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba">cairo_pattern_add_color_stop_rgba</a>
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
double alpha);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-rgb">cairo_pattern_create_rgb</a> (double red,
double green,
double blue);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-rgba">cairo_pattern_create_rgba</a> (double red,
double green,
double blue,
double alpha);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-for-surface">cairo_pattern_create_for_surface</a>
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-linear">cairo_pattern_create_linear</a>
(double x0,
double y0,
double x1,
double y1);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-radial">cairo_pattern_create_radial</a>
(double cx0,
double cy0,
double radius0,
double cx1,
double cy1,
double radius1);
void <a href="cairo-Patterns.html#cairo-pattern-destroy">cairo_pattern_destroy</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-reference">cairo_pattern_reference</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
<a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Patterns.html#cairo-pattern-status">cairo_pattern_status</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
enum <a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-set-extend">cairo_pattern_set_extend</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> extend);
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-extend">cairo_pattern_get_extend</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
enum <a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-set-filter">cairo_pattern_set_filter</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> filter);
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-filter">cairo_pattern_get_filter</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
void <a href="cairo-Patterns.html#cairo-pattern-set-matrix">cairo_pattern_set_matrix</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Patterns.html#cairo-pattern-get-matrix">cairo_pattern_get_matrix</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
enum <a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a>;
<a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-type">cairo_pattern_get_type</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2532446"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2532461"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2532472"></a><h3>
<a name="cairo-pattern-t"></a>cairo_pattern_t</h3>
<a class="indexterm" name="id2532484"></a><pre class="programlisting">typedef struct _cairo_pattern cairo_pattern_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2532501"></a><h3>
<a name="cairo-pattern-add-color-stop-rgb"></a>cairo_pattern_add_color_stop_rgb ()</h3>
<a class="indexterm" name="id2532512"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgb
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue);</pre>
<p>
Adds an opaque color stop to a gradient pattern. The offset
specifies the location along the gradient's control vector. For
example, a linear gradient's control vector is from (x0,y0) to
(x1,y1) while a radial gradient's control vector is from any point
on the start circle to the corresponding point on the end circle.
</p>
<p>
The color is specified in the same way as in <a href="cairo-cairo-t.html#cairo-set-source-rgb"><code class="function">cairo_set_source_rgb()</code></a>.
</p>
<p>
Note: If the pattern is not a gradient pattern, (eg. a linear or
radial pattern), then the pattern will be put into an error status
with a status of <a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset</code></em> :</span></td>
<td> an offset in the range [0.0 .. 1.0]
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of color
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2545378"></a><h3>
<a name="cairo-pattern-add-color-stop-rgba"></a>cairo_pattern_add_color_stop_rgba ()</h3>
<a class="indexterm" name="id2545389"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgba
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
double alpha);</pre>
<p>
Adds a translucent color stop to a gradient pattern. The offset
specifies the location along the gradient's control vector. For
example, a linear gradient's control vector is from (x0,y0) to
(x1,y1) while a radial gradient's control vector is from any point
on the start circle to the corresponding point on the end circle.
</p>
<p>
The color is specified in the same way as in <a href="cairo-cairo-t.html#cairo-set-source-rgba"><code class="function">cairo_set_source_rgba()</code></a>.
</p>
<p>
Note: If the pattern is not a gradient pattern, (eg. a linear or
radial pattern), then the pattern will be put into an error status
with a status of <a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset</code></em> :</span></td>
<td> an offset in the range [0.0 .. 1.0]
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td>
<td> alpha component of color
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585223"></a><h3>
<a name="cairo-pattern-create-rgb"></a>cairo_pattern_create_rgb ()</h3>
<a class="indexterm" name="id2585233"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgb (double red,
double green,
double blue);</pre>
<p>
Creates a new cairo_pattern_t corresponding to an opaque color. 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.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585365"></a><h3>
<a name="cairo-pattern-create-rgba"></a>cairo_pattern_create_rgba ()</h3>
<a class="indexterm" name="id2585377"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgba (double red,
double green,
double blue,
double alpha);</pre>
<p>
Creates a new cairo_pattern_t corresponding to a translucent color.
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.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td>
<td> alpha component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585535"></a><h3>
<a name="cairo-pattern-create-for-surface"></a>cairo_pattern_create_for_surface ()</h3>
<a class="indexterm" name="id2585548"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_for_surface
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Create a new cairo_pattern_t for the given surface.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> the surface
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585640"></a><h3>
<a name="cairo-pattern-create-linear"></a>cairo_pattern_create_linear ()</h3>
<a class="indexterm" name="id2585652"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_linear
(double x0,
double y0,
double x1,
double y1);</pre>
<p>
Create a new linear gradient cairo_pattern_t along the line defined
by (x0, y0) and (x1, y1). Before using the gradient pattern, a
number of color stops should be defined using
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a>.
</p>
<p>
Note: The coordinates here are in pattern space. For a new pattern,
pattern space is identical to user space, but the relationship
between the spaces can be changed with <a href="cairo-Patterns.html#cairo-pattern-set-matrix"><code class="function">cairo_pattern_set_matrix()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>x0</code></em> :</span></td>
<td> x coordinate of the start point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y0</code></em> :</span></td>
<td> y coordinate of the start point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x1</code></em> :</span></td>
<td> x coordinate of the end point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y1</code></em> :</span></td>
<td> y coordinate of the end point
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585845"></a><h3>
<a name="cairo-pattern-create-radial"></a>cairo_pattern_create_radial ()</h3>
<a class="indexterm" name="id2585857"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_radial
(double cx0,
double cy0,
double radius0,
double cx1,
double cy1,
double radius1);</pre>
<p>
Creates a new radial gradient cairo_pattern_t between the two
circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the
gradient pattern, a number of color stops should be defined using
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a>.
</p>
<p>
Note: The coordinates here are in pattern space. For a new pattern,
pattern space is identical to user space, but the relationship
between the spaces can be changed with <a href="cairo-Patterns.html#cairo-pattern-set-matrix"><code class="function">cairo_pattern_set_matrix()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cx0</code></em> :</span></td>
<td> x coordinate for the center of the start circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cy0</code></em> :</span></td>
<td> y coordinate for the center of the start circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>radius0</code></em> :</span></td>
<td> radius of the start cirle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cx1</code></em> :</span></td>
<td> x coordinate for the center of the end circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cy1</code></em> :</span></td>
<td> y coordinate for the center of the end circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>radius1</code></em> :</span></td>
<td> radius of the end cirle
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586093"></a><h3>
<a name="cairo-pattern-destroy"></a>cairo_pattern_destroy ()</h3>
<a class="indexterm" name="id2586104"></a><pre class="programlisting">void cairo_pattern_destroy (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Decreases the reference count on <em class="parameter"><code>pattern</code></em> by one. If the result is
zero, then <em class="parameter"><code>pattern</code></em> and all associated resources are freed. See
<a href="cairo-Patterns.html#cairo-pattern-reference"><code class="function">cairo_pattern_reference()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586183"></a><h3>
<a name="cairo-pattern-reference"></a>cairo_pattern_reference ()</h3>
<a class="indexterm" name="id2586195"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_reference (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Increases the reference count on <em class="parameter"><code>pattern</code></em> by one. This prevents
<em class="parameter"><code>pattern</code></em> from being destroyed until a matching call to
<a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> is made.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the referenced <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586291"></a><h3>
<a name="cairo-pattern-status"></a>cairo_pattern_status ()</h3>
<a class="indexterm" name="id2586302"></a><pre class="programlisting"><a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> cairo_pattern_status (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Checks whether an error has previously occurred for this
pattern.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a href="cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS"><code class="literal">CAIRO_STATUS_SUCCESS</code></a>, <a href="cairo-Error-handling.html#CAIRO-STATUS-NO-MEMORY:CAPS"><code class="literal">CAIRO_STATUS_NO_MEMORY</code></a>, or
<a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586399"></a><h3>
<a name="cairo-extend-t"></a>enum cairo_extend_t</h3>
<a class="indexterm" name="id2586411"></a><pre class="programlisting">typedef enum _cairo_extend {
CAIRO_EXTEND_NONE,
CAIRO_EXTEND_REPEAT,
CAIRO_EXTEND_REFLECT,
CAIRO_EXTEND_PAD
} cairo_extend_t;
</pre>
<p>
<a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> is used to describe how the area outside
of a pattern will be drawn.
</p>
<p>
New entries may be added in future versions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-NONE:CAPS"></a><code class="literal">CAIRO_EXTEND_NONE</code></span></td>
<td> pixels outside of the source pattern
are fully transparent
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-REPEAT:CAPS"></a><code class="literal">CAIRO_EXTEND_REPEAT</code></span></td>
<td> the pattern is tiled by repeating
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-REFLECT:CAPS"></a><code class="literal">CAIRO_EXTEND_REFLECT</code></span></td>
<td> the pattern is tiled by reflecting
at the edges (not implemented for surface patterns currently)
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-PAD:CAPS"></a><code class="literal">CAIRO_EXTEND_PAD</code></span></td>
<td> pixels outside of the pattern copy
the closest pixel from the source (Since 1.2; not implemented
for surface patterns currently)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586539"></a><h3>
<a name="cairo-pattern-set-extend"></a>cairo_pattern_set_extend ()</h3>
<a class="indexterm" name="id2586551"></a><pre class="programlisting">void cairo_pattern_set_extend (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> extend);</pre>
<p>
Sets the mode to be used for drawing outside the area of a pattern.
See <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> for details on the semantics of each extend
strategy.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>extend</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> describing how the area outside of the
pattern will be drawn
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586646"></a><h3>
<a name="cairo-pattern-get-extend"></a>cairo_pattern_get_extend ()</h3>
<a class="indexterm" name="id2586657"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> cairo_pattern_get_extend (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Gets the current extend mode for a pattern. See <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a>
for details on the semantics of each extend strategy.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the current extend strategy used for drawing the
pattern.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586735"></a><h3>
<a name="cairo-filter-t"></a>enum cairo_filter_t</h3>
<a class="indexterm" name="id2586747"></a><pre class="programlisting">typedef enum _cairo_filter {
CAIRO_FILTER_FAST,
CAIRO_FILTER_GOOD,
CAIRO_FILTER_BEST,
CAIRO_FILTER_NEAREST,
CAIRO_FILTER_BILINEAR,
CAIRO_FILTER_GAUSSIAN
} cairo_filter_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586766"></a><h3>
<a name="cairo-pattern-set-filter"></a>cairo_pattern_set_filter ()</h3>
<a class="indexterm" name="id2586777"></a><pre class="programlisting">void cairo_pattern_set_filter (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> filter);</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>filter</code></em> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586844"></a><h3>
<a name="cairo-pattern-get-filter"></a>cairo_pattern_get_filter ()</h3>
<a class="indexterm" name="id2586855"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> cairo_pattern_get_filter (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586912"></a><h3>
<a name="cairo-pattern-set-matrix"></a>cairo_pattern_set_matrix ()</h3>
<a class="indexterm" name="id2586923"></a><pre class="programlisting">void cairo_pattern_set_matrix (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Sets the pattern's transformation matrix to <em class="parameter"><code>matrix</code></em>. This matrix is
a transformation from user space to pattern space.
</p>
<p>
When a pattern is first created it always has the identity matrix
for its transformation matrix, which means that pattern space is
initially identical to user space.
</p>
<p>
Important: Please note that the direction of this transformation
matrix is from user space to pattern space. This means that if you
imagine the flow from a pattern to user space (and on to device
space), then coordinates in that flow will be transformed by the
inverse of the pattern matrix.
</p>
<p>
For example, if you want to make a pattern appear twice as large as
it does by default the correct code to use is:
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
cairo_matrix_init_scale (&matrix, 0.5, 0.5);
cairo_pattern_set_matrix (pattern, &matrix);
</pre></div>
<p>
</p>
<p>
Meanwhile, using values of 2.0 rather than 0.5 in the code above
would cause the pattern to appear at half of its default size.
</p>
<p>
Also, please note the discussion of the user-space locking
semantics of <a href="cairo-cairo-t.html#cairo-set-source"><code class="function">cairo_set_source()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2587069"></a><h3>
<a name="cairo-pattern-get-matrix"></a>cairo_pattern_get_matrix ()</h3>
<a class="indexterm" name="id2587080"></a><pre class="programlisting">void cairo_pattern_get_matrix (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Stores the pattern's transformation matrix into <em class="parameter"><code>matrix</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> return value for the matrix
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2587166"></a><h3>
<a name="cairo-pattern-type-t"></a>enum cairo_pattern_type_t</h3>
<a class="indexterm" name="id2587179"></a><pre class="programlisting">typedef enum _cairo_pattern_type {
CAIRO_PATTERN_TYPE_SOLID,
CAIRO_PATTERN_TYPE_SURFACE,
CAIRO_PATTERN_TYPE_LINEAR,
CAIRO_PATTERN_TYPE_RADIAL
} cairo_pattern_type_t;
</pre>
<p>
<a href="cairo-Patterns.html#cairo-pattern-type-t"><span class="type">cairo_pattern_type_t</span></a> is used to describe the type of a given pattern.
</p>
<p>
The type of a pattern is determined by the function used to create
it. The <a href="cairo-Patterns.html#cairo-pattern-create-rgb"><code class="function">cairo_pattern_create_rgb()</code></a> and <a href="cairo-Patterns.html#cairo-pattern-create-rgba"><code class="function">cairo_pattern_create_rgba()</code></a>
functions create SOLID patterns. The remaining
cairo_pattern_create functions map to pattern types in obvious
ways.
</p>
<p>
The pattern type can be queried with <a href="cairo-Patterns.html#cairo-pattern-get-type"><code class="function">cairo_pattern_get_type()</code></a>
</p>
<p>
Most cairo_pattern functions can be called with a pattern of any
type, (though trying to change the extend or filter for a solid
pattern will have no effect). A notable exception is
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> and
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a> which must only be called with
gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
will be shutdown and put into an error state.
</p>
<p>
New entries may be added in future versions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-SOLID:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_SOLID</code></span></td>
<td> The pattern is a solid (uniform)
color. It may be opaque or translucent.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-SURFACE:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_SURFACE</code></span></td>
<td> The pattern is a based on a surface (an image).
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-LINEAR:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_LINEAR</code></span></td>
<td> The pattern is a linear gradient.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-RADIAL:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_RADIAL</code></span></td>
<td> The pattern is a radial gradient.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2587359"></a><h3>
<a name="cairo-pattern-get-type"></a>cairo_pattern_get_type ()</h3>
<a class="indexterm" name="id2587372"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a> cairo_pattern_get_type (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
This function returns the type a pattern.
See <a href="cairo-Patterns.html#cairo-pattern-type-t"><span class="type">cairo_pattern_type_t</span></a> for available types.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The type of <em class="parameter"><code>pattern</code></em>.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
</div>
</div>
</body>
</html>