cairo-matrix.html   [plain text]


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>cairo_matrix_t</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library">
<link rel="up" href="cairo-support.html" title="Utilities">
<link rel="prev" href="cairo-support.html" title="Utilities">
<link rel="next" href="cairo-error-status.html" title="Error handling">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="cairo-drawing.html" title="Drawing">
<link rel="chapter" href="cairo-fonts.html" title="Fonts">
<link rel="chapter" href="cairo-surfaces.html" title="Surfaces">
<link rel="chapter" href="cairo-support.html" title="Utilities">
<link rel="index" href="index-all.html" title="Index">
<link rel="index" href="index-1.2.html" title="Index of new symbols in 1.2">
<link rel="index" href="index-1.4.html" title="Index of new symbols in 1.4">
<link rel="index" href="index-1.6.html" title="Index of new symbols in 1.6">
<link rel="index" href="index-1.8.html" title="Index of new symbols in 1.8">
<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-support.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="cairo-support.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-error-status.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#cairo-matrix.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#cairo-matrix.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-matrix"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="cairo-matrix.top_of_page"></a>cairo_matrix_t</span></h2>
<p>cairo_matrix_t — Generic matrix operations</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="cairo-matrix.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
                    <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a>;
void                <a class="link" href="cairo-matrix.html#cairo-matrix-init" title="cairo_matrix_init ()">cairo_matrix_init</a>                   (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double xx,
                                                         double yx,
                                                         double xy,
                                                         double yy,
                                                         double x0,
                                                         double y0);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-init-identity" title="cairo_matrix_init_identity ()">cairo_matrix_init_identity</a>          (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-init-translate" title="cairo_matrix_init_translate ()">cairo_matrix_init_translate</a>         (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double tx,
                                                         double ty);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-init-scale" title="cairo_matrix_init_scale ()">cairo_matrix_init_scale</a>             (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double sx,
                                                         double sy);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-init-rotate" title="cairo_matrix_init_rotate ()">cairo_matrix_init_rotate</a>            (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double radians);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-translate" title="cairo_matrix_translate ()">cairo_matrix_translate</a>              (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double tx,
                                                         double ty);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-scale" title="cairo_matrix_scale ()">cairo_matrix_scale</a>                  (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double sx,
                                                         double sy);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-rotate" title="cairo_matrix_rotate ()">cairo_matrix_rotate</a>                 (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double radians);
<a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      <a class="link" href="cairo-matrix.html#cairo-matrix-invert" title="cairo_matrix_invert ()">cairo_matrix_invert</a>                 (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-multiply" title="cairo_matrix_multiply ()">cairo_matrix_multiply</a>               (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *result,
                                                         const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *a,
                                                         const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *b);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-transform-distance" title="cairo_matrix_transform_distance ()">cairo_matrix_transform_distance</a>     (const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double *dx,
                                                         double *dy);
void                <a class="link" href="cairo-matrix.html#cairo-matrix-transform-point" title="cairo_matrix_transform_point ()">cairo_matrix_transform_point</a>        (const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double *x,
                                                         double *y);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="cairo-matrix.description"></a><h2>Description</h2>
<p>
    <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a> is used throughout cairo to convert between different
    coordinate spaces.  A <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a> holds an affine transformation,
    such as a scale, rotation, shear, or a combination of these.
    The transformation of a point (<code class="literal">x</code>,<code class="literal">y</code>)
    is given by:
  </p>
<pre class="programlisting">
    x_new = xx * x + xy * y + x0;
    y_new = yx * x + yy * y + y0;
  </pre>
<p>
    The current transformation matrix of a <a class="link" href="cairo-context.html#cairo-t" title="cairo_t"><span class="type">cairo_t</span></a>, represented as a
    <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>, defines the transformation from user-space
    coordinates to device-space coordinates. See <a class="link" href="cairo-transformations.html#cairo-get-matrix" title="cairo_get_matrix ()"><code class="function">cairo_get_matrix()</code></a> and
    <a class="link" href="cairo-transformations.html#cairo-set-matrix" title="cairo_set_matrix ()"><code class="function">cairo_set_matrix()</code></a>.
  </p>
</div>
<div class="refsect1" lang="en">
<a name="cairo-matrix.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="cairo-matrix-t"></a><h3>cairo_matrix_t</h3>
<pre class="programlisting">typedef struct {
    double xx; double yx;
    double xy; double yy;
    double x0; double y0;
} cairo_matrix_t;
</pre>
<p>
A <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a> holds an affine transformation, such as a scale,
rotation, shear, or a combination of those. The transformation of
a point (x, y) is given by:
</p>
<pre class="programlisting">
    x_new = xx * x + xy * y + x0;
    y_new = yx * x + yy * y + y0;
</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">double <em class="structfield"><code>xx</code></em>;</span></p></td>
<td> xx component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term">double <em class="structfield"><code>yx</code></em>;</span></p></td>
<td> yx component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term">double <em class="structfield"><code>xy</code></em>;</span></p></td>
<td> xy component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term">double <em class="structfield"><code>yy</code></em>;</span></p></td>
<td> yy component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term">double <em class="structfield"><code>x0</code></em>;</span></p></td>
<td> X translation component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term">double <em class="structfield"><code>y0</code></em>;</span></p></td>
<td> Y translation component of the affine transformation
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-init"></a><h3>cairo_matrix_init ()</h3>
<pre class="programlisting">void                cairo_matrix_init                   (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double xx,
                                                         double yx,
                                                         double xy,
                                                         double yy,
                                                         double x0,
                                                         double y0);</pre>
<p>
Sets <em class="parameter"><code>matrix</code></em> to be the affine transformation given by
<em class="parameter"><code>xx</code></em>, <em class="parameter"><code>yx</code></em>, <em class="parameter"><code>xy</code></em>, <em class="parameter"><code>yy</code></em>, <em class="parameter"><code>x0</code></em>, <em class="parameter"><code>y0</code></em>. The transformation is given
by:
</p>
<pre class="programlisting">
 x_new = xx * x + xy * y + x0;
 y_new = yx * x + yy * y + y0;
</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>xx</code></em> :</span></p></td>
<td> xx component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>yx</code></em> :</span></p></td>
<td> yx component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>xy</code></em> :</span></p></td>
<td> xy component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>yy</code></em> :</span></p></td>
<td> yy component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x0</code></em> :</span></p></td>
<td> X translation component of the affine transformation
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y0</code></em> :</span></p></td>
<td> Y translation component of the affine transformation
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-init-identity"></a><h3>cairo_matrix_init_identity ()</h3>
<pre class="programlisting">void                cairo_matrix_init_identity          (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix);</pre>
<p>
Modifies <em class="parameter"><code>matrix</code></em> to be an identity transformation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="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="cairo-matrix-init-translate"></a><h3>cairo_matrix_init_translate ()</h3>
<pre class="programlisting">void                cairo_matrix_init_translate         (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double tx,
                                                         double ty);</pre>
<p>
Initializes <em class="parameter"><code>matrix</code></em> to a transformation that translates by <em class="parameter"><code>tx</code></em> and
<em class="parameter"><code>ty</code></em> in the X and Y dimensions, respectively.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>tx</code></em> :</span></p></td>
<td> amount to translate in the X direction
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ty</code></em> :</span></p></td>
<td> amount to translate in the Y direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-init-scale"></a><h3>cairo_matrix_init_scale ()</h3>
<pre class="programlisting">void                cairo_matrix_init_scale             (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double sx,
                                                         double sy);</pre>
<p>
Initializes <em class="parameter"><code>matrix</code></em> to a transformation that scales by <em class="parameter"><code>sx</code></em> and <em class="parameter"><code>sy</code></em>
in the X and Y dimensions, respectively.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sx</code></em> :</span></p></td>
<td> scale factor in the X direction
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sy</code></em> :</span></p></td>
<td> scale factor in the Y direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-init-rotate"></a><h3>cairo_matrix_init_rotate ()</h3>
<pre class="programlisting">void                cairo_matrix_init_rotate            (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double radians);</pre>
<p>
Initialized <em class="parameter"><code>matrix</code></em> to a transformation that rotates by <em class="parameter"><code>radians</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>radians</code></em> :</span></p></td>
<td> angle of rotation, in radians. The direction of rotation
is defined such that positive angles rotate in the direction from
the positive X axis toward the positive Y axis. With the default
axis orientation of cairo, positive angles rotate in a clockwise
direction.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-translate"></a><h3>cairo_matrix_translate ()</h3>
<pre class="programlisting">void                cairo_matrix_translate              (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double tx,
                                                         double ty);</pre>
<p>
Applies a translation by <em class="parameter"><code>tx</code></em>, <em class="parameter"><code>ty</code></em> to the transformation in
<em class="parameter"><code>matrix</code></em>. The effect of the new transformation is to first translate
the coordinates by <em class="parameter"><code>tx</code></em> and <em class="parameter"><code>ty</code></em>, then apply the original transformation
to the coordinates.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>tx</code></em> :</span></p></td>
<td> amount to translate in the X direction
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ty</code></em> :</span></p></td>
<td> amount to translate in the Y direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-scale"></a><h3>cairo_matrix_scale ()</h3>
<pre class="programlisting">void                cairo_matrix_scale                  (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double sx,
                                                         double sy);</pre>
<p>
Applies scaling by <em class="parameter"><code>sx</code></em>, <em class="parameter"><code>sy</code></em> to the transformation in <em class="parameter"><code>matrix</code></em>. The
effect of the new transformation is to first scale the coordinates
by <em class="parameter"><code>sx</code></em> and <em class="parameter"><code>sy</code></em>, then apply the original transformation to the coordinates.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sx</code></em> :</span></p></td>
<td> scale factor in the X direction
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sy</code></em> :</span></p></td>
<td> scale factor in the Y direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-rotate"></a><h3>cairo_matrix_rotate ()</h3>
<pre class="programlisting">void                cairo_matrix_rotate                 (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double radians);</pre>
<p>
Applies rotation by <em class="parameter"><code>radians</code></em> to the transformation in
<em class="parameter"><code>matrix</code></em>. The effect of the new transformation is to first rotate the
coordinates by <em class="parameter"><code>radians</code></em>, then apply the original transformation
to the coordinates.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>radians</code></em> :</span></p></td>
<td> angle of rotation, in radians. The direction of rotation
is defined such that positive angles rotate in the direction from
the positive X axis toward the positive Y axis. With the default
axis orientation of cairo, positive angles rotate in a clockwise
direction.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-invert"></a><h3>cairo_matrix_invert ()</h3>
<pre class="programlisting"><a class="link" href="cairo-error-status.html#cairo-status-t" title="enum cairo_status_t">cairo_status_t</a>      cairo_matrix_invert                 (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix);</pre>
<p>
Changes <em class="parameter"><code>matrix</code></em> to be the inverse of it's original value. Not
all transformation matrices have inverses; if the matrix
collapses points together (it is <em class="firstterm">degenerate</em>),
then it has no inverse and this function will fail.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> If <em class="parameter"><code>matrix</code></em> has an inverse, modifies <em class="parameter"><code>matrix</code></em> to
 be the inverse matrix and returns <a class="link" href="cairo-error-status.html#CAIRO-STATUS-SUCCESS--CAPS"><code class="literal">CAIRO_STATUS_SUCCESS</code></a>. Otherwise,
 returns <a class="link" href="cairo-error-status.html#CAIRO-STATUS-INVALID-MATRIX--CAPS"><code class="literal">CAIRO_STATUS_INVALID_MATRIX</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-multiply"></a><h3>cairo_matrix_multiply ()</h3>
<pre class="programlisting">void                cairo_matrix_multiply               (<a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *result,
                                                         const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *a,
                                                         const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *b);</pre>
<p>
Multiplies the affine transformations in <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> together
and stores the result in <em class="parameter"><code>result</code></em>. The effect of the resulting
transformation is to first apply the transformation in <em class="parameter"><code>a</code></em> to the
coordinates and then apply the transformation in <em class="parameter"><code>b</code></em> to the
coordinates.
</p>
<p>
It is allowable for <em class="parameter"><code>result</code></em> to be identical to either <em class="parameter"><code>a</code></em> or <em class="parameter"><code>b</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a> in which to store the result
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>a</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>b</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="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="cairo-matrix-transform-distance"></a><h3>cairo_matrix_transform_distance ()</h3>
<pre class="programlisting">void                cairo_matrix_transform_distance     (const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double *dx,
                                                         double *dy);</pre>
<p>
Transforms the distance vector (<em class="parameter"><code>dx</code></em>,<em class="parameter"><code>dy</code></em>) by <em class="parameter"><code>matrix</code></em>. This is
similar to <a class="link" href="cairo-matrix.html#cairo-matrix-transform-point" title="cairo_matrix_transform_point ()"><code class="function">cairo_matrix_transform_point()</code></a> except that the translation
components of the transformation are ignored. The calculation of
the returned vector is as follows:
</p>
<p>
</p>
<pre class="programlisting">
dx2 = dx1 * a + dy1 * c;
dy2 = dx1 * b + dy1 * d;
</pre>
<p>
</p>
<p>
Affine transformations are position invariant, so the same vector
always transforms to the same vector. If (<em class="parameter"><code>x1</code></em>,<em class="parameter"><code>y1</code></em>) transforms
to (<em class="parameter"><code>x2</code></em>,<em class="parameter"><code>y2</code></em>) then (<em class="parameter"><code>x1</code></em>+<em class="parameter"><code>dx1</code></em>,<em class="parameter"><code>y1</code></em>+<em class="parameter"><code>dy1</code></em>) will transform to
(<em class="parameter"><code>x1</code></em>+<em class="parameter"><code>dx2</code></em>,<em class="parameter"><code>y1</code></em>+<em class="parameter"><code>dy2</code></em>) for all values of <em class="parameter"><code>x1</code></em> and <em class="parameter"><code>x2</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dx</code></em> :</span></p></td>
<td> X component of a distance vector. An in/out parameter
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dy</code></em> :</span></p></td>
<td> Y component of a distance vector. An in/out parameter
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="cairo-matrix-transform-point"></a><h3>cairo_matrix_transform_point ()</h3>
<pre class="programlisting">void                cairo_matrix_transform_point        (const <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t">cairo_matrix_t</a> *matrix,
                                                         double *x,
                                                         double *y);</pre>
<p>
Transforms the point (<em class="parameter"><code>x</code></em>, <em class="parameter"><code>y</code></em>) by <em class="parameter"><code>matrix</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>matrix</code></em> :</span></p></td>
<td> a <a class="link" href="cairo-matrix.html#cairo-matrix-t" title="cairo_matrix_t"><span class="type">cairo_matrix_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td> X position. An in/out parameter
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td> Y position. An in/out parameter
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="cairo-matrix.see-also"></a><h2>See Also</h2>
<p>
</p>
<div class="itemizedlist"><ul type="disc"><li><a class="link" href="cairo-context.html#cairo-t" title="cairo_t"><span class="type">cairo_t</span></a></li></ul></div>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>