📄 cairo-cairo-matrix-t.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>cairo_matrix_t</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="Support.html" title="Utilities"><link rel="prev" href="Support.html" title="Utilities"><link rel="next" href="cairo-Error-handling.html" title="Error handling"><meta name="generator" content="GTK-Doc V1.6 (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="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="Support.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="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-handling.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="#top_of_page" class="shortcut">Top</a>  |  <a href="#desc" class="shortcut">Description</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="cairo-cairo-matrix-t"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle"><a name="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="synopsis"></a><h2>Synopsis</h2><pre class="synopsis"> <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a>;void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init">cairo_matrix_init</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double xx, double yx, double xy, double yy, double x0, double y0);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-identity">cairo_matrix_init_identity</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-translate">cairo_matrix_init_translate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-scale">cairo_matrix_init_scale</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-init-rotate">cairo_matrix_init_rotate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-translate">cairo_matrix_translate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-scale">cairo_matrix_scale</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-rotate">cairo_matrix_rotate</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);<a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-invert">cairo_matrix_invert</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-multiply">cairo_matrix_multiply</a> (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *a, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-distance">cairo_matrix_transform_distance</a> (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *dx, double *dy);void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-point">cairo_matrix_transform_point</a> (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *x, double *y);</pre></div><div class="refsect1" lang="en"><a name="desc"></a><h2>Description</h2><p><a class="indexterm" name="id2587579"></a><a class="indexterm" name="id2587587"></a> <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a> is used throughout cairo to convert between different coordinate spaces. A <a href="cairo-cairo-matrix-t.html#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 href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, represented as a <a href="cairo-cairo-matrix-t.html#cairo-matrix-t"><span class="type">cairo_matrix_t</span></a>, defines the transformation from user-space coordinates to device-space coordinates. See <a href="cairo-Transformations.html#cairo-get-matrix"><code class="function">cairo_get_matrix()</code></a> and <a href="cairo-Transformations.html#cairo-set-matrix"><code class="function">cairo_set_matrix()</code></a>. </p></div><div class="refsect1" lang="en"><a name="details"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2587684"></a><h3><a name="cairo-matrix-t"></a>cairo_matrix_t</h3><a class="indexterm" name="id2587695"></a><pre class="programlisting">typedef struct { double xx; double yx; double xy; double yy; double x0; double y0;} cairo_matrix_t;</pre><p>A <a href="cairo-cairo-matrix-t.html#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 ofa 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><span class="term">double <em class="structfield"><code>xx</code></em>;</span></td><td> xx component of the affine transformation</td></tr><tr><td><span class="term">double <em class="structfield"><code>yx</code></em>;</span></td><td> yx component of the affine transformation</td></tr><tr><td><span class="term">double <em class="structfield"><code>xy</code></em>;</span></td><td> xy component of the affine transformation</td></tr><tr><td><span class="term">double <em class="structfield"><code>yy</code></em>;</span></td><td> yy component of the affine transformation</td></tr><tr><td><span class="term">double <em class="structfield"><code>x0</code></em>;</span></td><td> X translation component of the affine transformation</td></tr><tr><td><span class="term">double <em class="structfield"><code>y0</code></em>;</span></td><td> Y translation component of the affine transformation</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2544216"></a><h3><a name="cairo-matrix-init"></a>cairo_matrix_init ()</h3><a class="indexterm" name="id2544228"></a><pre class="programlisting">void cairo_matrix_init (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double xx, double yx, double xy, double yy, double x0, double y0);</pre></div><hr><div class="refsect2" lang="en"><a name="id2544292"></a><h3><a name="cairo-matrix-init-identity"></a>cairo_matrix_init_identity ()</h3><a class="indexterm" name="id2544303"></a><pre class="programlisting">void cairo_matrix_init_identity (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre></div><hr><div class="refsect2" lang="en"><a name="id2544327"></a><h3><a name="cairo-matrix-init-translate"></a>cairo_matrix_init_translate ()</h3><a class="indexterm" name="id2544338"></a><pre class="programlisting">void cairo_matrix_init_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);</pre></div><hr><div class="refsect2" lang="en"><a name="id2544376"></a><h3><a name="cairo-matrix-init-scale"></a>cairo_matrix_init_scale ()</h3><a class="indexterm" name="id2544388"></a><pre class="programlisting">void cairo_matrix_init_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);</pre></div><hr><div class="refsect2" lang="en"><a name="id2590907"></a><h3><a name="cairo-matrix-init-rotate"></a>cairo_matrix_init_rotate ()</h3><a class="indexterm" name="id2590917"></a><pre class="programlisting">void cairo_matrix_init_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);</pre></div><hr><div class="refsect2" lang="en"><a name="id2590945"></a><h3><a name="cairo-matrix-translate"></a>cairo_matrix_translate ()</h3><a class="indexterm" name="id2590956"></a><pre class="programlisting">void cairo_matrix_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);</pre></div><hr><div class="refsect2" lang="en"><a name="id2590990"></a><h3><a name="cairo-matrix-scale"></a>cairo_matrix_scale ()</h3><a class="indexterm" name="id2591000"></a><pre class="programlisting">void cairo_matrix_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);</pre></div><hr><div class="refsect2" lang="en"><a name="id2591034"></a><h3><a name="cairo-matrix-rotate"></a>cairo_matrix_rotate ()</h3><a class="indexterm" name="id2591045"></a><pre class="programlisting">void cairo_matrix_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);</pre></div><hr><div class="refsect2" lang="en"><a name="id2591076"></a><h3><a name="cairo-matrix-invert"></a>cairo_matrix_invert ()</h3><a class="indexterm" name="id2591089"></a><pre class="programlisting"><a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> cairo_matrix_invert (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre></div><hr><div class="refsect2" lang="en"><a name="id2591112"></a><h3><a name="cairo-matrix-multiply"></a>cairo_matrix_multiply ()</h3><a class="indexterm" name="id2591124"></a><pre class="programlisting">void cairo_matrix_multiply (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *a, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);</pre></div><hr><div class="refsect2" lang="en"><a name="id2591162"></a><h3><a name="cairo-matrix-transform-distance"></a>cairo_matrix_transform_distance ()</h3><a class="indexterm" name="id2591174"></a><pre class="programlisting">void cairo_matrix_transform_distance (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *dx, double *dy);</pre></div><hr><div class="refsect2" lang="en"><a name="id2591213"></a><h3><a name="cairo-matrix-transform-point"></a>cairo_matrix_transform_point ()</h3><a class="indexterm" name="id2591226"></a><pre class="programlisting">void cairo_matrix_transform_point (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *x, double *y);</pre></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -