/usr/share/doc/python-cairo-dev/html/reference/patterns.html is in python-cairo-dev 1.8.8-2.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Patterns — pycairo 1.8.8 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.8.8',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="pycairo 1.8.8 documentation" href="../index.html" />
<link rel="up" title="Reference" href="index.html" />
<link rel="next" title="Surfaces" href="surfaces.html" />
<link rel="prev" title="Paths" href="paths.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head>
<body role="document">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="patterns">
<span id="id1"></span><h1>Patterns<a class="headerlink" href="#patterns" title="Permalink to this headline">¶</a></h1>
<p>Patterns are the paint with which cairo draws. The primary use of patterns is
as the source for all cairo drawing operations, although they can also be used
as masks, that is, as the brush too.</p>
<p>A cairo <em>Pattern</em> is created by using one of the <em>PatternType</em> constructors
listed below, or implicitly through <em>Context.set_source_<type>()</em> methods.</p>
<div class="section" id="class-pattern">
<h2>class Pattern()<a class="headerlink" href="#class-pattern" title="Permalink to this headline">¶</a></h2>
<p><em>Pattern</em> is the abstract base class from which all the other pattern classes
derive. It cannot be instantiated directly.</p>
<dl class="class">
<dt id="cairo.Pattern">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">Pattern</code><a class="headerlink" href="#cairo.Pattern" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="cairo.Pattern.get_extend">
<code class="descname">get_extend</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Pattern.get_extend" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the current extend strategy used for drawing the <em>Pattern</em>.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
<p>Gets the current extend mode for the <em>Pattern</em>. See
<a class="reference internal" href="constants.html#constants-extend"><span class="std std-ref">EXTEND attributes</span></a>
for details on the semantics of each extend strategy.</p>
</dd></dl>
<dl class="method">
<dt id="cairo.Pattern.get_matrix">
<code class="descname">get_matrix</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Pattern.get_matrix" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a new <a class="reference internal" href="matrix.html#cairo.Matrix" title="cairo.Matrix"><code class="xref py py-class docutils literal"><span class="pre">Matrix</span></code></a> which stores a copy of the <em>Pattern’s</em> transformation matrix</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="cairo.Pattern.set_extend">
<code class="descname">set_extend</code><span class="sig-paren">(</span><em>extend</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Pattern.set_extend" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>extend</strong> – an <a class="reference internal" href="constants.html#constants-extend"><span class="std std-ref">EXTEND</span></a> describing how the
area outside of the <em>Pattern</em> will be drawn</td>
</tr>
</tbody>
</table>
<p>Sets the mode to be used for drawing outside the area of a <em>Pattern</em>.</p>
<p>The default extend mode is <a class="reference internal" href="constants.html#cairo.EXTEND_NONE" title="cairo.EXTEND_NONE"><code class="xref py py-data docutils literal"><span class="pre">cairo.EXTEND_NONE</span></code></a> for
<a class="reference internal" href="#cairo.SurfacePattern" title="cairo.SurfacePattern"><code class="xref py py-class docutils literal"><span class="pre">SurfacePattern</span></code></a> and <a class="reference internal" href="constants.html#cairo.EXTEND_PAD" title="cairo.EXTEND_PAD"><code class="xref py py-data docutils literal"><span class="pre">cairo.EXTEND_PAD</span></code></a> for
<a class="reference internal" href="#cairo.Gradient" title="cairo.Gradient"><code class="xref py py-class docutils literal"><span class="pre">Gradient</span></code></a> Patterns.</p>
</dd></dl>
<dl class="method">
<dt id="cairo.Pattern.set_matrix">
<code class="descname">set_matrix</code><span class="sig-paren">(</span><em>matrix</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Pattern.set_matrix" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>matrix</strong> – a <a class="reference internal" href="matrix.html#cairo.Matrix" title="cairo.Matrix"><code class="xref py py-class docutils literal"><span class="pre">Matrix</span></code></a></td>
</tr>
</tbody>
</table>
<p>Sets the <em>Pattern’s</em> transformation matrix to <em>matrix</em>. This matrix is a
transformation from user space to pattern space.</p>
<p>When a <em>Pattern</em> 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 <em>Pattern</em> to user space (and on to device space), then
coordinates in that flow will be transformed by the inverse of the
<em>Pattern</em> matrix.</p>
<p>For example, if you want to make a <em>Pattern</em> appear twice as large as it
does by default the correct code to use is:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">matrix</span> <span class="o">=</span> <span class="n">cairo</span><span class="o">.</span><span class="n">Matrix</span><span class="p">(</span><span class="n">xx</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span><span class="n">yy</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="n">pattern</span><span class="o">.</span><span class="n">set_matrix</span><span class="p">(</span><span class="n">matrix</span><span class="p">)</span>
</pre></div>
</div>
<p>Meanwhile, using values of 2.0 rather than 0.5 in the code above would
cause the <em>Pattern</em> to appear at half of its default size.</p>
<p>Also, please note the discussion of the user-space locking semantics of
<a class="reference internal" href="context.html#cairo.Context.set_source" title="cairo.Context.set_source"><code class="xref py py-class docutils literal"><span class="pre">Context.set_source</span></code></a>.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="class-solidpattern-pattern">
<h2>class SolidPattern(<a class="reference internal" href="#cairo.Pattern" title="cairo.Pattern"><code class="xref py py-class docutils literal"><span class="pre">Pattern</span></code></a>)<a class="headerlink" href="#class-solidpattern-pattern" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="cairo.SolidPattern">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">SolidPattern</code><span class="sig-paren">(</span><em>red</em>, <em>green</em>, <em>blue</em>, <em>alpha=1.0</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SolidPattern" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>red</strong> (<em>float</em>) – red component of the color</li>
<li><strong>green</strong> (<em>float</em>) – green component of the color</li>
<li><strong>blue</strong> (<em>float</em>) – blue component of the color</li>
<li><strong>alpha</strong> (<em>float</em>) – alpha component of the color</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a new <em>SolidPattern</em></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><em>MemoryError</em> in case of no memory</p>
</td>
</tr>
</tbody>
</table>
<p>Creates a new <em>SolidPattern</em> 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>
<dl class="method">
<dt id="cairo.SolidPattern.get_rgba">
<code class="descname">get_rgba</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SolidPattern.get_rgba" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">(red, green, blue, alpha) a tuple of float</td>
</tr>
</tbody>
</table>
<p>Gets the solid color for a <em>SolidPattern</em>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.4.</span></p>
</div>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="class-surfacepattern-pattern">
<h2>class SurfacePattern(<a class="reference internal" href="#cairo.Pattern" title="cairo.Pattern"><code class="xref py py-class docutils literal"><span class="pre">Pattern</span></code></a>)<a class="headerlink" href="#class-surfacepattern-pattern" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="cairo.SurfacePattern">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">SurfacePattern</code><span class="sig-paren">(</span><em>surface</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SurfacePattern" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>surface</strong> – a cairo <a class="reference internal" href="surfaces.html#cairo.Surface" title="cairo.Surface"><code class="xref py py-class docutils literal"><span class="pre">Surface</span></code></a></td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a newly created <em>SurfacePattern</em> for the given surface.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><em>MemoryError</em> in case of no memory.</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="cairo.SurfacePattern.get_filter">
<code class="descname">get_filter</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SurfacePattern.get_filter" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the current <a class="reference internal" href="constants.html#constants-filter"><span class="std std-ref">FILTER</span></a> used for
resizing the <em>SurfacePattern</em>.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="cairo.SurfacePattern.get_surface">
<code class="descname">get_surface</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SurfacePattern.get_surface" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the <a class="reference internal" href="surfaces.html#cairo.Surface" title="cairo.Surface"><code class="xref py py-class docutils literal"><span class="pre">Surface</span></code></a> of the <em>SurfacePattern</em>.</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.4.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="cairo.SurfacePattern.set_filter">
<code class="descname">set_filter</code><span class="sig-paren">(</span><em>filter</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.SurfacePattern.set_filter" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filter</strong> – a <a class="reference internal" href="constants.html#constants-filter"><span class="std std-ref">FILTER</span></a> describing the filter
to use for resizing the <em>Pattern</em></td>
</tr>
</tbody>
</table>
<p>Note that you might want to control filtering even when you do not have
an explicit <em>Pattern</em> object, (for example when using
<a class="reference internal" href="context.html#cairo.Context.set_source_surface" title="cairo.Context.set_source_surface"><code class="xref py py-meth docutils literal"><span class="pre">Context.set_source_surface()</span></code></a>). In these cases, it is convenient to use
<a class="reference internal" href="context.html#cairo.Context.get_source" title="cairo.Context.get_source"><code class="xref py py-meth docutils literal"><span class="pre">Context.get_source()</span></code></a> to get access to the pattern that cairo creates
implicitly. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">context</span><span class="o">.</span><span class="n">set_source_surface</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="n">surfacepattern</span><span class="o">.</span><span class="n">set_filter</span><span class="p">(</span><span class="n">context</span><span class="o">.</span><span class="n">get_source</span><span class="p">(),</span> <span class="n">cairo</span><span class="o">.</span><span class="n">FILTER_NEAREST</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="class-gradient-pattern">
<h2>class Gradient(<a class="reference internal" href="#cairo.Pattern" title="cairo.Pattern"><code class="xref py py-class docutils literal"><span class="pre">Pattern</span></code></a>)<a class="headerlink" href="#class-gradient-pattern" title="Permalink to this headline">¶</a></h2>
<p><em>Gradient</em> is an abstract base class from which other <em>Pattern</em> classes
derive. It cannot be instantiated directly.</p>
<dl class="class">
<dt id="cairo.Gradient">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">Gradient</code><a class="headerlink" href="#cairo.Gradient" title="Permalink to this definition">¶</a></dt>
<dd><dl class="method">
<dt id="cairo.Gradient.add_color_stop_rgb">
<code class="descname">add_color_stop_rgb</code><span class="sig-paren">(</span><em>offset</em>, <em>red</em>, <em>green</em>, <em>blue</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Gradient.add_color_stop_rgb" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>offset</strong> (<em>float</em>) – an offset in the range [0.0 .. 1.0]</li>
<li><strong>red</strong> (<em>float</em>) – red component of color</li>
<li><strong>green</strong> (<em>float</em>) – green component of color</li>
<li><strong>blue</strong> (<em>float</em>) – blue component of color</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Adds an opaque color stop to a <em>Gradient</em> pattern. The offset specifies
the location along the gradient’s control vector. For example, a
<em>LinearGradient’s</em> control vector is from (x0,y0) to (x1,y1) while a
<em>RadialGradient’s</em> 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 class="reference internal" href="context.html#cairo.Context.set_source_rgb" title="cairo.Context.set_source_rgb"><code class="xref py py-meth docutils literal"><span class="pre">Context.set_source_rgb()</span></code></a>.</p>
<p>If two (or more) stops are specified with identical offset values, they
will be sorted according to the order in which the stops are added,
(stops added earlier will compare less than stops added later). This can
be useful for reliably making sharp color transitions instead of the
typical blend.</p>
</dd></dl>
<dl class="method">
<dt id="cairo.Gradient.add_color_stop_rgba">
<code class="descname">add_color_stop_rgba</code><span class="sig-paren">(</span><em>offset</em>, <em>red</em>, <em>green</em>, <em>blue</em>, <em>alpha</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.Gradient.add_color_stop_rgba" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>offset</strong> (<em>float</em>) – an offset in the range [0.0 .. 1.0]</li>
<li><strong>red</strong> (<em>float</em>) – red component of color</li>
<li><strong>green</strong> (<em>float</em>) – green component of color</li>
<li><strong>blue</strong> (<em>float</em>) – blue component of color</li>
<li><strong>alpha</strong> (<em>float</em>) – alpha component of color</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Adds an opaque color stop to a <em>Gradient</em> pattern. The offset specifies
the location along the gradient’s control vector. For example, a
<em>LinearGradient’s</em> control vector is from (x0,y0) to (x1,y1) while a
<em>RadialGradient’s</em> 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 class="reference internal" href="context.html#cairo.Context.set_source_rgb" title="cairo.Context.set_source_rgb"><code class="xref py py-meth docutils literal"><span class="pre">Context.set_source_rgb()</span></code></a>.</p>
<p>If two (or more) stops are specified with identical offset values, they
will be sorted according to the order in which the stops are added,
(stops added earlier will compare less than stops added later). This can
be useful for reliably making sharp color transitions instead of the
typical blend.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="class-lineargradient-gradient">
<h2>class LinearGradient(<a class="reference internal" href="#cairo.Gradient" title="cairo.Gradient"><code class="xref py py-class docutils literal"><span class="pre">Gradient</span></code></a>)<a class="headerlink" href="#class-lineargradient-gradient" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="cairo.LinearGradient">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">LinearGradient</code><span class="sig-paren">(</span><em>x0</em>, <em>y0</em>, <em>x1</em>, <em>y1</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.LinearGradient" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>x0</strong> (<em>float</em>) – x coordinate of the start point</li>
<li><strong>y0</strong> (<em>float</em>) – y coordinate of the start point</li>
<li><strong>x1</strong> (<em>float</em>) – x coordinate of the end point</li>
<li><strong>y1</strong> (<em>float</em>) – y coordinate of the end point</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">a new <em>LinearGradient</em></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><em>MemoryError</em> in case of no memory</p>
</td>
</tr>
</tbody>
</table>
<p>Create a new <em>LinearGradient</em> along the line defined by (x0, y0) and (x1,
y1). Before using the <em>Gradient</em> pattern, a number of color stops should
be defined using <a class="reference internal" href="#cairo.Gradient.add_color_stop_rgb" title="cairo.Gradient.add_color_stop_rgb"><code class="xref py py-meth docutils literal"><span class="pre">Gradient.add_color_stop_rgb()</span></code></a> or
<a class="reference internal" href="#cairo.Gradient.add_color_stop_rgba" title="cairo.Gradient.add_color_stop_rgba"><code class="xref py py-meth docutils literal"><span class="pre">Gradient.add_color_stop_rgba()</span></code></a></p>
<p>Note: The coordinates here are in pattern space. For a new <em>Pattern</em>,
pattern space is identical to user space, but the relationship between the
spaces can be changed with <a class="reference internal" href="#cairo.Pattern.set_matrix" title="cairo.Pattern.set_matrix"><code class="xref py py-meth docutils literal"><span class="pre">Pattern.set_matrix()</span></code></a></p>
<dl class="method">
<dt id="cairo.LinearGradient.get_linear_points">
<code class="descname">get_linear_points</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.LinearGradient.get_linear_points" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">(x0, y0, x1, y1) - a tuple of float<ul class="simple">
<li>x0: return value for the x coordinate of the first point</li>
<li>y0: return value for the y coordinate of the first point</li>
<li>x1: return value for the x coordinate of the second point</li>
<li>y1: return value for the y coordinate of the second point</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Gets the gradient endpoints for a <em>LinearGradient</em>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.4.</span></p>
</div>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="class-radialgradient-gradient">
<h2>class RadialGradient(<a class="reference internal" href="#cairo.Gradient" title="cairo.Gradient"><code class="xref py py-class docutils literal"><span class="pre">Gradient</span></code></a>)<a class="headerlink" href="#class-radialgradient-gradient" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="cairo.RadialGradient">
<em class="property">class </em><code class="descclassname">cairo.</code><code class="descname">RadialGradient</code><span class="sig-paren">(</span><em>cx0</em>, <em>cy0</em>, <em>radius0</em>, <em>cx1</em>, <em>cy1</em>, <em>radius1</em><span class="sig-paren">)</span><a class="headerlink" href="#cairo.RadialGradient" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>cx0</strong> (<em>float</em>) – x coordinate for the center of the start circle</li>
<li><strong>cy0</strong> (<em>float</em>) – y coordinate for the center of the start circle</li>
<li><strong>radius0</strong> (<em>float</em>) – radius of the start circle</li>
<li><strong>cx1</strong> (<em>float</em>) – x coordinate for the center of the end circle</li>
<li><strong>cy1</strong> (<em>float</em>) – y coordinate for the center of the end circle</li>
<li><strong>radius1</strong> (<em>float</em>) – radius of the end circle</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the newly created <em>RadialGradient</em></p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><em>MemoryError</em> in case of no memory</p>
</td>
</tr>
</tbody>
</table>
<p>Creates a new <em>RadialGradient</em> pattern between the two circles defined by
(cx0, cy0, radius0) and (cx1, cy1, radius1). Before using the gradient
pattern, a number of color stops should be defined using
<a class="reference internal" href="#cairo.Gradient.add_color_stop_rgb" title="cairo.Gradient.add_color_stop_rgb"><code class="xref py py-meth docutils literal"><span class="pre">Gradient.add_color_stop_rgb()</span></code></a> or <a class="reference internal" href="#cairo.Gradient.add_color_stop_rgba" title="cairo.Gradient.add_color_stop_rgba"><code class="xref py py-meth docutils literal"><span class="pre">Gradient.add_color_stop_rgba()</span></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 class="reference internal" href="#cairo.Pattern.set_matrix" title="cairo.Pattern.set_matrix"><code class="xref py py-meth docutils literal"><span class="pre">Pattern.set_matrix()</span></code></a>.</p>
<dl class="method">
<dt id="cairo.RadialGradient.get_radial_circles">
<code class="descname">get_radial_circles</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#cairo.RadialGradient.get_radial_circles" title="Permalink to this definition">¶</a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">(x0, y0, r0, x1, y1, r1) - a tuple of float<ul class="simple">
<li>x0: return value for the x coordinate of the center of the first circle</li>
<li>y0: return value for the y coordinate of the center of the first circle</li>
<li>r0: return value for the radius of the first circle</li>
<li>x1: return value for the x coordinate of the center of the second circle</li>
<li>y1: return value for the y coordinate of the center of the second circle</li>
<li>r1: return value for the radius of the second circle</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Gets the <em>Gradient</em> endpoint circles for a <em>RadialGradient</em>, each
specified as a center coordinate and a radius.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.4.</span></p>
</div>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Patterns</a><ul>
<li><a class="reference internal" href="#class-pattern">class Pattern()</a></li>
<li><a class="reference internal" href="#class-solidpattern-pattern">class SolidPattern(<code class="docutils literal"><span class="pre">Pattern</span></code>)</a></li>
<li><a class="reference internal" href="#class-surfacepattern-pattern">class SurfacePattern(<code class="docutils literal"><span class="pre">Pattern</span></code>)</a></li>
<li><a class="reference internal" href="#class-gradient-pattern">class Gradient(<code class="docutils literal"><span class="pre">Pattern</span></code>)</a></li>
<li><a class="reference internal" href="#class-lineargradient-gradient">class LinearGradient(<code class="docutils literal"><span class="pre">Gradient</span></code>)</a></li>
<li><a class="reference internal" href="#class-radialgradient-gradient">class RadialGradient(<code class="docutils literal"><span class="pre">Gradient</span></code>)</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li><a href="index.html">Reference</a><ul>
<li>Previous: <a href="paths.html" title="previous chapter">Paths</a></li>
<li>Next: <a href="surfaces.html" title="next chapter">Surfaces</a></li>
</ul></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/reference/patterns.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©2017, Steve Chaplin.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.9</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
|
<a href="../_sources/reference/patterns.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|