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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org" />
<title>RMagick 0.0.0: RVG Reference: Transforms</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<meta name="GENERATOR" content="Quanta Plus" />
<meta name="Copyright" content="Copyright (C) 2006 by Timothy P. Hunter" />
<link rel="stylesheet" type="text/css" href="css/doc.css" />
<link rel="stylesheet" type="text/css" href="css/ref.css" />
<script type="text/javascript" src="scripts/doc.js"></script>
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
<style type="text/css">
/*<![CDATA[*/
}
/*]]>*/
</style>
</head>
<body>
<h6 id="header">RMagick 0.0.0 User's Guide and Reference</h6>
<div class="nav">« <a href="rvgshape.html">Prev</a> | <a href="index.html">Contents</a> | <a href="index.html">Next</a> »</div>
<h1>The transform methods</h1>
<div id="toc">
<h2>Table of Contents</h2>
<h3>About the transform methods</h3>
<h3>Transform methods</h3>
<ul>
<li><a href="#matrix">matrix</a></li>
<li><a href="#rotate">rotate</a></li>
<li><a href="#scale">scale</a></li>
<li><a href="#skewX">skewX</a></li>
<li><a href="#skewY">skewY</a></li>
<li><a href="#translate">translate</a></li>
</ul>
</div>
<div class="subhd">
<h2>About the transform methods</h2>
</div>
<div class="intro">
<p>
The default coordinate system has its origin in the upper-left corner. The positive x-axis extends to the right. The positive y-axis extends downward.
You can change this coordinate system by using one or more of the transform methods described on this page. This image shows the default coordinate
system.
</p>
<p>
<a href="javascript:popup('initial_coords.rb.html')"
><img src="ex/initial_coords.gif" title="Click to see the example script" alt="initial coordinates example"
/></a>
</p>
<p>This image shows a drawing without transformations.</p>
<p>
<a href="javascript:popup('orig_coord_sys.rb.html')"
><img src="ex/orig_coord_sys.gif" title="Click to see the example script" alt="a drawing without transformations"
/></a>
</p>
<p>
The transform methods are defined in the <a href="rvg.html">RVG</a>, <a href="rvggroup.html">RVG::Group</a>, and
<a href="rvguse.html">RVG::Use</a> classes. You can also chain these methods to the <a href="rvgshape.html">shape methods</a> and to the
<a href="rvgimage.html">image</a> method.
</p>
</div>
<div class="subhd">
<h2>Transform methods</h2>
</div>
<div class="sig">
<h4 id="matrix">matrix</h4>
<p>
<span class="arg">obj</span>.matrix(<span class="arg">sx</span>, <span class="arg">rx</span>, <span class="arg">ry</span>, <span class="arg">sy</span>,
<span class="arg">tx</span>, <span class="arg">ty</span>) -> <em>obj</em>
</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>
Replaces the current transformation matrix with a new matrix having the specified values. See the
<a href="https://www.w3.org/TR/SVG11/coords.html#TransformAttribute">SVG standard</a>
for more information.
</p>
<h5>Arguments</h5>
<dl>
<dt>sx, sy</dt>
<dd>The scale factor in the <em>x</em>-dimension and <em>y</em>-dimension, measured in user coordinates.</dd>
<dt>rx, ry</dt>
<dd>The amount of rotation about the x-axis and y-axis, measured in degrees.</dd>
<dt>tx, ty</dt>
<dd>The translation on the <em>x</em>-axis and the <em>y</em>-axis, measured in user coordinates.</dd>
</dl>
</div>
<div class="sig">
<h4 id="rotate">rotate</h4>
<p>
<span class="arg">obj</span>.rotate(<span class="arg">angle</span>[, <span class="arg">cx</span>, <span class="arg">cy</span>]) ->
<em>obj</em>
</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Rotates the axes about the origin or, if <span class="arg">cx</span> and <span class="arg">cy</span> are present, about the specified point.</p>
<h5>Arguments</h5>
<dl>
<dt>angle</dt>
<dd>The amount of rotation. Positive angles rotate clockwise, negative angles rotate counter-clockwise.</dd>
<dt>cx, cy</dt>
<dd>If present, the point to rotate about.</dd>
</dl>
<h5>Example</h5>
<p>See <a href="#scale">scale</a>.</p>
</div>
<div class="sig">
<h4 id="scale">scale</h4>
<p><span class="arg">obj</span>.scale(<span class="arg">sx</span>[, <span class="arg">sy</span>]) -> <em>obj</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Scales the axes.</p>
<h5>Arguments</h5>
<dl>
<dt>sx</dt>
<dd>The amount of scaling on the <em>x</em>-axis.</dd>
<dt>sy</dt>
<dd>If present, the amount of scaling on the <em>y</em>-axis. Otherwise defaults to <span class="arg">sx</span>.</dd>
</dl>
<h5>Example</h5>
<p>
<a href="javascript:popup('rotate_scale.rb.html')"
><img src="ex/rotate_scale.gif" title="Click to see the example script" alt="rotate and scale example"
/></a>
</p>
</div>
<div class="sig">
<h4 id="skewX">skewX</h4>
<p>
<span class="arg">obj</span>.skewX(<span class="arg">angle</span>) ->
<em>obj</em>
</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Skews the <em>x</em>-axis.</p>
<h5>Arguments</h5>
<dl>
<dt>angle</dt>
<dd>The skew amount, measured in degrees.</dd>
</dl>
<h5>Example</h5>
<p>See <a href="#skewY">skewY</a></p>
</div>
<div class="sig">
<h4 id="skewY">skewY</h4>
<p>
<span class="arg">obj</span>.skewY(<span class="arg">angle</span>) ->
<em>obj</em>
</p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Skews the <em>y</em>-axis.</p>
<h5>Arguments</h5>
<dl>
<dt>angle</dt>
<dd>The skew amount, measured in degrees.</dd>
</dl>
<h5>Example</h5>
<p>
<a href="javascript:popup('skew.rb.html')"><img src="ex/skew.gif" title="Click to see the example script" alt="skewX and skewY example" /></a>
</p>
</div>
<div class="sig">
<h4 id="translate">translate</h4>
<p><span class="arg">obj</span>.translate(<span class="arg">tx</span>[, <span class="arg">ty</span>]) -> <em>obj</em></p>
</div>
<div class="desc">
<h5>Description</h5>
<p>Moves the origin.</p>
<h5>Arguments</h5>
<dl>
<dt>tx</dt>
<dd>The location of the new origin on the x-axis.</dd>
<dt>ty</dt>
<dd>
The location of the new origin on the y-axis. If omitted, defaults to
<span class="arg">tx</span>.
</dd>
</dl>
<h5>Example</h5>
<p>
<a href="javascript:popup('new_coord_sys.rb.html')"
><img src="ex/new_coord_sys.gif" title="Click to see the example script" alt="translate example"
/></a>
</p>
</div>
<p class="spacer"> </p>
<div class="nav">
« <a href="rvgshape.html">Prev</a> | <a href="index.html">Contents</a> | <a href="index.html">Next</a>
»
</div>
</body>
</html>
|