1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Transformations</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-Patterns.html" title="Patterns">
<link rel="next" href="cairo-Text.html" title="Text">
<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-Patterns.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-Text.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="#id2547030" class="shortcut">Top</a>
 | 
<a href="#id2532835" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-Transformations"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2547030"></a><span class="refentrytitle">Transformations</span>
</h2>
<p>Transformations — Manipulating the current transformation matrix</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
void <a href="cairo-Transformations.html#cairo-translate">cairo_translate</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double tx,
double ty);
void <a href="cairo-Transformations.html#cairo-scale">cairo_scale</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double sx,
double sy);
void <a href="cairo-Transformations.html#cairo-rotate">cairo_rotate</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double angle);
void <a href="cairo-Transformations.html#cairo-transform">cairo_transform</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Transformations.html#cairo-set-matrix">cairo_set_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Transformations.html#cairo-get-matrix">cairo_get_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Transformations.html#cairo-identity-matrix">cairo_identity_matrix</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);
void <a href="cairo-Transformations.html#cairo-user-to-device">cairo_user_to_device</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);
void <a href="cairo-Transformations.html#cairo-user-to-device-distance">cairo_user_to_device_distance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);
void <a href="cairo-Transformations.html#cairo-device-to-user">cairo_device_to_user</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);
void <a href="cairo-Transformations.html#cairo-device-to-user-distance">cairo_device_to_user_distance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2532835"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2532851"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2532862"></a><h3>
<a name="cairo-translate"></a>cairo_translate ()</h3>
<a class="indexterm" name="id2532874"></a><pre class="programlisting">void cairo_translate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double tx,
double ty);</pre>
<p>
Modifies the current transformation matrix (CTM) by translating the
user-space origin by (<em class="parameter"><code>tx</code></em>, <em class="parameter"><code>ty</code></em>). This offset is interpreted as a
user-space coordinate according to the CTM in place before the new
call to cairo_translate. In other words, the translation of the
user-space origin takes place after any existing transformation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>tx</code></em> :</span></td>
<td> amount to translate in the X direction
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>ty</code></em> :</span></td>
<td> amount to translate in the Y direction
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2575529"></a><h3>
<a name="cairo-scale"></a>cairo_scale ()</h3>
<a class="indexterm" name="id2575541"></a><pre class="programlisting">void cairo_scale (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double sx,
double sy);</pre>
<p>
Modifies the current transformation matrix (CTM) by scaling the X
and Y user-space axes by <em class="parameter"><code>sx</code></em> and <em class="parameter"><code>sy</code></em> respectively. The scaling of
the axes takes place after any existing transformation of user
space.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>sx</code></em> :</span></td>
<td> scale factor for the X dimension
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>sy</code></em> :</span></td>
<td> scale factor for the Y dimension
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2575646"></a><h3>
<a name="cairo-rotate"></a>cairo_rotate ()</h3>
<a class="indexterm" name="id2575658"></a><pre class="programlisting">void cairo_rotate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double angle);</pre>
<p>
Modifies the current transformation matrix (CTM) by rotating the
user-space axes by <em class="parameter"><code>angle</code></em> radians. The rotation of the axes takes
places after any existing transformation of user space. The
rotation direction for positive angles is from the positive X axis
toward the positive Y axis.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>angle</code></em> :</span></td>
<td> angle (in radians) by which the user-space axes will be
rotated
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2574418"></a><h3>
<a name="cairo-transform"></a>cairo_transform ()</h3>
<a class="indexterm" name="id2574430"></a><pre class="programlisting">void cairo_transform (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Modifies the current transformation matrix (CTM) by applying
<em class="parameter"><code>matrix</code></em> as an additional transformation. The new transformation of
user space takes place after any existing transformation.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> a transformation to be applied to the user-space axes
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2574511"></a><h3>
<a name="cairo-set-matrix"></a>cairo_set_matrix ()</h3>
<a class="indexterm" name="id2574523"></a><pre class="programlisting">void cairo_set_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Modifies the current transformation matrix (CTM) by setting it
equal to <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>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> a transformation matrix from user space to device space
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2574602"></a><h3>
<a name="cairo-get-matrix"></a>cairo_get_matrix ()</h3>
<a class="indexterm" name="id2574614"></a><pre class="programlisting">void cairo_get_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Stores the current transformation matrix (CTM) 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>cr</code></em> :</span></td>
<td> a cairo context
</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="id2527705"></a><h3>
<a name="cairo-identity-matrix"></a>cairo_identity_matrix ()</h3>
<a class="indexterm" name="id2527716"></a><pre class="programlisting">void cairo_identity_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre>
<p>
Resets the current transformation matrix (CTM) by setting it equal
to the identity matrix. That is, the user-space and device-space
axes will be aligned and one user-space unit will transform to one
device-space unit.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2527769"></a><h3>
<a name="cairo-user-to-device"></a>cairo_user_to_device ()</h3>
<a class="indexterm" name="id2527780"></a><pre class="programlisting">void cairo_user_to_device (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);</pre>
<p>
Transform a coordinate from user space to device space by
multiplying the given point by the current transformation matrix
(CTM).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td> X value of coordinate (in/out parameter)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td> Y value of coordinate (in/out parameter)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2527874"></a><h3>
<a name="cairo-user-to-device-distance"></a>cairo_user_to_device_distance ()</h3>
<a class="indexterm" name="id2527886"></a><pre class="programlisting">void cairo_user_to_device_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);</pre>
<p>
Transform a distance vector from user space to device space. This
function is similar to <a href="cairo-Transformations.html#cairo-user-to-device"><code class="function">cairo_user_to_device()</code></a> except that the
translation components of the CTM will be ignored when transforming
(<em class="parameter"><code>dx</code></em>,<em class="parameter"><code>dy</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>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dx</code></em> :</span></td>
<td> X component of a distance vector (in/out parameter)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dy</code></em> :</span></td>
<td> Y component of a distance vector (in/out parameter)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2528002"></a><h3>
<a name="cairo-device-to-user"></a>cairo_device_to_user ()</h3>
<a class="indexterm" name="id2528013"></a><pre class="programlisting">void cairo_device_to_user (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *x,
double *y);</pre>
<p>
Transform a coordinate from device space to user space by
multiplying the given point by the inverse of the current
transformation matrix (CTM).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cr</code></em> :</span></td>
<td> a cairo
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x</code></em> :</span></td>
<td> X value of coordinate (in/out parameter)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y</code></em> :</span></td>
<td> Y value of coordinate (in/out parameter)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2528108"></a><h3>
<a name="cairo-device-to-user-distance"></a>cairo_device_to_user_distance ()</h3>
<a class="indexterm" name="id2528119"></a><pre class="programlisting">void cairo_device_to_user_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr,
double *dx,
double *dy);</pre>
<p>
Transform a distance vector from device space to user space. This
function is similar to <a href="cairo-Transformations.html#cairo-device-to-user"><code class="function">cairo_device_to_user()</code></a> except that the
translation components of the inverse CTM will be ignored when
transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter"><code>dy</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>cr</code></em> :</span></td>
<td> a cairo context
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dx</code></em> :</span></td>
<td> X component of a distance vector (in/out parameter)
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>dy</code></em> :</span></td>
<td> Y component of a distance vector (in/out parameter)
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|