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 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Patterns</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-Paths.html" title="Paths">
<link rel="next" href="cairo-Transformations.html" title="Transformations">
<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-Paths.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-Transformations.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="#id2549349" class="shortcut">Top</a>
 | 
<a href="#id2532446" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="cairo-Patterns"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2549349"></a><span class="refentrytitle">Patterns</span>
</h2>
<p>Patterns — Gradients and filtered sources</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
typedef <a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</a>
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue);
void <a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba">cairo_pattern_add_color_stop_rgba</a>
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
double alpha);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-rgb">cairo_pattern_create_rgb</a> (double red,
double green,
double blue);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-rgba">cairo_pattern_create_rgba</a> (double red,
double green,
double blue,
double alpha);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-for-surface">cairo_pattern_create_for_surface</a>
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-linear">cairo_pattern_create_linear</a>
(double x0,
double y0,
double x1,
double y1);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-create-radial">cairo_pattern_create_radial</a>
(double cx0,
double cy0,
double radius0,
double cx1,
double cy1,
double radius1);
void <a href="cairo-Patterns.html#cairo-pattern-destroy">cairo_pattern_destroy</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-Patterns.html#cairo-pattern-reference">cairo_pattern_reference</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
<a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Patterns.html#cairo-pattern-status">cairo_pattern_status</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
enum <a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-set-extend">cairo_pattern_set_extend</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> extend);
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-extend">cairo_pattern_get_extend</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
enum <a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a>;
void <a href="cairo-Patterns.html#cairo-pattern-set-filter">cairo_pattern_set_filter</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> filter);
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-filter">cairo_pattern_get_filter</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
void <a href="cairo-Patterns.html#cairo-pattern-set-matrix">cairo_pattern_set_matrix</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
void <a href="cairo-Patterns.html#cairo-pattern-get-matrix">cairo_pattern_get_matrix</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);
enum <a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a>;
<a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a> <a href="cairo-Patterns.html#cairo-pattern-get-type">cairo_pattern_get_type</a> (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2532446"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2532461"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2532472"></a><h3>
<a name="cairo-pattern-t"></a>cairo_pattern_t</h3>
<a class="indexterm" name="id2532484"></a><pre class="programlisting">typedef struct _cairo_pattern cairo_pattern_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2532501"></a><h3>
<a name="cairo-pattern-add-color-stop-rgb"></a>cairo_pattern_add_color_stop_rgb ()</h3>
<a class="indexterm" name="id2532512"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgb
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue);</pre>
<p>
Adds an opaque color stop to a gradient pattern. The offset
specifies the location along the gradient's control vector. For
example, a linear gradient's control vector is from (x0,y0) to
(x1,y1) while a radial gradient's 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 href="cairo-cairo-t.html#cairo-set-source-rgb"><code class="function">cairo_set_source_rgb()</code></a>.
</p>
<p>
Note: If the pattern is not a gradient pattern, (eg. a linear or
radial pattern), then the pattern will be put into an error status
with a status of <a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset</code></em> :</span></td>
<td> an offset in the range [0.0 .. 1.0]
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of color
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2545378"></a><h3>
<a name="cairo-pattern-add-color-stop-rgba"></a>cairo_pattern_add_color_stop_rgba ()</h3>
<a class="indexterm" name="id2545389"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgba
(<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
double offset,
double red,
double green,
double blue,
double alpha);</pre>
<p>
Adds a translucent color stop to a gradient pattern. The offset
specifies the location along the gradient's control vector. For
example, a linear gradient's control vector is from (x0,y0) to
(x1,y1) while a radial gradient's 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 href="cairo-cairo-t.html#cairo-set-source-rgba"><code class="function">cairo_set_source_rgba()</code></a>.
</p>
<p>
Note: If the pattern is not a gradient pattern, (eg. a linear or
radial pattern), then the pattern will be put into an error status
with a status of <a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>offset</code></em> :</span></td>
<td> an offset in the range [0.0 .. 1.0]
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td>
<td> alpha component of color
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585223"></a><h3>
<a name="cairo-pattern-create-rgb"></a>cairo_pattern_create_rgb ()</h3>
<a class="indexterm" name="id2585233"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgb (double red,
double green,
double blue);</pre>
<p>
Creates a new cairo_pattern_t corresponding to an opaque 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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585365"></a><h3>
<a name="cairo-pattern-create-rgba"></a>cairo_pattern_create_rgba ()</h3>
<a class="indexterm" name="id2585377"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgba (double red,
double green,
double blue,
double alpha);</pre>
<p>
Creates a new cairo_pattern_t 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>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>red</code></em> :</span></td>
<td> red component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>green</code></em> :</span></td>
<td> green component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>blue</code></em> :</span></td>
<td> blue component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td>
<td> alpha component of the color
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585535"></a><h3>
<a name="cairo-pattern-create-for-surface"></a>cairo_pattern_create_for_surface ()</h3>
<a class="indexterm" name="id2585548"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_for_surface
(<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre>
<p>
Create a new cairo_pattern_t for the given surface.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>surface</code></em> :</span></td>
<td> the surface
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585640"></a><h3>
<a name="cairo-pattern-create-linear"></a>cairo_pattern_create_linear ()</h3>
<a class="indexterm" name="id2585652"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_linear
(double x0,
double y0,
double x1,
double y1);</pre>
<p>
Create a new linear gradient cairo_pattern_t along the line defined
by (x0, y0) and (x1, y1). Before using the gradient pattern, a
number of color stops should be defined using
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</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 href="cairo-Patterns.html#cairo-pattern-set-matrix"><code class="function">cairo_pattern_set_matrix()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>x0</code></em> :</span></td>
<td> x coordinate of the start point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y0</code></em> :</span></td>
<td> y coordinate of the start point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>x1</code></em> :</span></td>
<td> x coordinate of the end point
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>y1</code></em> :</span></td>
<td> y coordinate of the end point
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2585845"></a><h3>
<a name="cairo-pattern-create-radial"></a>cairo_pattern_create_radial ()</h3>
<a class="indexterm" name="id2585857"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_radial
(double cx0,
double cy0,
double radius0,
double cx1,
double cy1,
double radius1);</pre>
<p>
Creates a new radial gradient cairo_pattern_t between the two
circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the
gradient pattern, a number of color stops should be defined using
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</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 href="cairo-Patterns.html#cairo-pattern-set-matrix"><code class="function">cairo_pattern_set_matrix()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cx0</code></em> :</span></td>
<td> x coordinate for the center of the start circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cy0</code></em> :</span></td>
<td> y coordinate for the center of the start circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>radius0</code></em> :</span></td>
<td> radius of the start cirle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cx1</code></em> :</span></td>
<td> x coordinate for the center of the end circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>cy1</code></em> :</span></td>
<td> y coordinate for the center of the end circle
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>radius1</code></em> :</span></td>
<td> radius of the end cirle
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the newly created <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or
an error pattern in case of no memory. The caller owns the
returned object and should call <a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when
finished with it.
This function will always return a valid pointer, but if an error
occurred the pattern status will be set to an error. To inspect
the status of a pattern use <a href="cairo-Patterns.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586093"></a><h3>
<a name="cairo-pattern-destroy"></a>cairo_pattern_destroy ()</h3>
<a class="indexterm" name="id2586104"></a><pre class="programlisting">void cairo_pattern_destroy (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Decreases the reference count on <em class="parameter"><code>pattern</code></em> by one. If the result is
zero, then <em class="parameter"><code>pattern</code></em> and all associated resources are freed. See
<a href="cairo-Patterns.html#cairo-pattern-reference"><code class="function">cairo_pattern_reference()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586183"></a><h3>
<a name="cairo-pattern-reference"></a>cairo_pattern_reference ()</h3>
<a class="indexterm" name="id2586195"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_reference (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Increases the reference count on <em class="parameter"><code>pattern</code></em> by one. This prevents
<em class="parameter"><code>pattern</code></em> from being destroyed until a matching call to
<a href="cairo-Patterns.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> is made.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the referenced <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586291"></a><h3>
<a name="cairo-pattern-status"></a>cairo_pattern_status ()</h3>
<a class="indexterm" name="id2586302"></a><pre class="programlisting"><a href="cairo-Error-handling.html#cairo-status-t">cairo_status_t</a> cairo_pattern_status (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Checks whether an error has previously occurred for this
pattern.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a href="cairo-Error-handling.html#CAIRO-STATUS-SUCCESS:CAPS"><code class="literal">CAIRO_STATUS_SUCCESS</code></a>, <a href="cairo-Error-handling.html#CAIRO-STATUS-NO-MEMORY:CAPS"><code class="literal">CAIRO_STATUS_NO_MEMORY</code></a>, or
<a href="cairo-Error-handling.html#CAIRO-STATUS-PATTERN-TYPE-MISMATCH:CAPS"><code class="literal">CAIRO_STATUS_PATTERN_TYPE_MISMATCH</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586399"></a><h3>
<a name="cairo-extend-t"></a>enum cairo_extend_t</h3>
<a class="indexterm" name="id2586411"></a><pre class="programlisting">typedef enum _cairo_extend {
CAIRO_EXTEND_NONE,
CAIRO_EXTEND_REPEAT,
CAIRO_EXTEND_REFLECT,
CAIRO_EXTEND_PAD
} cairo_extend_t;
</pre>
<p>
<a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> is used to describe how the area outside
of a pattern will be drawn.
</p>
<p>
New entries may be added in future versions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-NONE:CAPS"></a><code class="literal">CAIRO_EXTEND_NONE</code></span></td>
<td> pixels outside of the source pattern
are fully transparent
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-REPEAT:CAPS"></a><code class="literal">CAIRO_EXTEND_REPEAT</code></span></td>
<td> the pattern is tiled by repeating
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-REFLECT:CAPS"></a><code class="literal">CAIRO_EXTEND_REFLECT</code></span></td>
<td> the pattern is tiled by reflecting
at the edges (not implemented for surface patterns currently)
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-EXTEND-PAD:CAPS"></a><code class="literal">CAIRO_EXTEND_PAD</code></span></td>
<td> pixels outside of the pattern copy
the closest pixel from the source (Since 1.2; not implemented
for surface patterns currently)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586539"></a><h3>
<a name="cairo-pattern-set-extend"></a>cairo_pattern_set_extend ()</h3>
<a class="indexterm" name="id2586551"></a><pre class="programlisting">void cairo_pattern_set_extend (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> extend);</pre>
<p>
Sets the mode to be used for drawing outside the area of a pattern.
See <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> for details on the semantics of each extend
strategy.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>extend</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a> describing how the area outside of the
pattern will be drawn
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586646"></a><h3>
<a name="cairo-pattern-get-extend"></a>cairo_pattern_get_extend ()</h3>
<a class="indexterm" name="id2586657"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-extend-t">cairo_extend_t</a> cairo_pattern_get_extend (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
Gets the current extend mode for a pattern. See <a href="cairo-Patterns.html#cairo-extend-t"><span class="type">cairo_extend_t</span></a>
for details on the semantics of each extend strategy.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the current extend strategy used for drawing the
pattern.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586735"></a><h3>
<a name="cairo-filter-t"></a>enum cairo_filter_t</h3>
<a class="indexterm" name="id2586747"></a><pre class="programlisting">typedef enum _cairo_filter {
CAIRO_FILTER_FAST,
CAIRO_FILTER_GOOD,
CAIRO_FILTER_BEST,
CAIRO_FILTER_NEAREST,
CAIRO_FILTER_BILINEAR,
CAIRO_FILTER_GAUSSIAN
} cairo_filter_t;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586766"></a><h3>
<a name="cairo-pattern-set-filter"></a>cairo_pattern_set_filter ()</h3>
<a class="indexterm" name="id2586777"></a><pre class="programlisting">void cairo_pattern_set_filter (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> filter);</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>filter</code></em> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586844"></a><h3>
<a name="cairo-pattern-get-filter"></a>cairo_pattern_get_filter ()</h3>
<a class="indexterm" name="id2586855"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-filter-t">cairo_filter_t</a> cairo_pattern_get_filter (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2586912"></a><h3>
<a name="cairo-pattern-set-matrix"></a>cairo_pattern_set_matrix ()</h3>
<a class="indexterm" name="id2586923"></a><pre class="programlisting">void cairo_pattern_set_matrix (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Sets the pattern's transformation matrix to <em class="parameter"><code>matrix</code></em>. This matrix is
a transformation from user space to pattern space.
</p>
<p>
When a pattern 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 pattern to user space (and on to device
space), then coordinates in that flow will be transformed by the
inverse of the pattern matrix.
</p>
<p>
For example, if you want to make a pattern appear twice as large as
it does by default the correct code to use is:
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
cairo_matrix_init_scale (&matrix, 0.5, 0.5);
cairo_pattern_set_matrix (pattern, &matrix);
</pre></div>
<p>
</p>
<p>
Meanwhile, using values of 2.0 rather than 0.5 in the code above
would cause the pattern to appear at half of its default size.
</p>
<p>
Also, please note the discussion of the user-space locking
semantics of <a href="cairo-cairo-t.html#cairo-set-source"><code class="function">cairo_set_source()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td>
<td> a <a href="cairo-cairo-matrix-t.html#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="id2587069"></a><h3>
<a name="cairo-pattern-get-matrix"></a>cairo_pattern_get_matrix ()</h3>
<a class="indexterm" name="id2587080"></a><pre class="programlisting">void cairo_pattern_get_matrix (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern,
<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre>
<p>
Stores the pattern's transformation matrix 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>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</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="id2587166"></a><h3>
<a name="cairo-pattern-type-t"></a>enum cairo_pattern_type_t</h3>
<a class="indexterm" name="id2587179"></a><pre class="programlisting">typedef enum _cairo_pattern_type {
CAIRO_PATTERN_TYPE_SOLID,
CAIRO_PATTERN_TYPE_SURFACE,
CAIRO_PATTERN_TYPE_LINEAR,
CAIRO_PATTERN_TYPE_RADIAL
} cairo_pattern_type_t;
</pre>
<p>
<a href="cairo-Patterns.html#cairo-pattern-type-t"><span class="type">cairo_pattern_type_t</span></a> is used to describe the type of a given pattern.
</p>
<p>
The type of a pattern is determined by the function used to create
it. The <a href="cairo-Patterns.html#cairo-pattern-create-rgb"><code class="function">cairo_pattern_create_rgb()</code></a> and <a href="cairo-Patterns.html#cairo-pattern-create-rgba"><code class="function">cairo_pattern_create_rgba()</code></a>
functions create SOLID patterns. The remaining
cairo_pattern_create functions map to pattern types in obvious
ways.
</p>
<p>
The pattern type can be queried with <a href="cairo-Patterns.html#cairo-pattern-get-type"><code class="function">cairo_pattern_get_type()</code></a>
</p>
<p>
Most cairo_pattern functions can be called with a pattern of any
type, (though trying to change the extend or filter for a solid
pattern will have no effect). A notable exception is
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> and
<a href="cairo-Patterns.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a> which must only be called with
gradient patterns (either LINEAR or RADIAL). Otherwise the pattern
will be shutdown and put into an error state.
</p>
<p>
New entries may be added in future versions.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-SOLID:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_SOLID</code></span></td>
<td> The pattern is a solid (uniform)
color. It may be opaque or translucent.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-SURFACE:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_SURFACE</code></span></td>
<td> The pattern is a based on a surface (an image).
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-LINEAR:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_LINEAR</code></span></td>
<td> The pattern is a linear gradient.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="CAIRO-PATTERN-TYPE-RADIAL:CAPS"></a><code class="literal">CAIRO_PATTERN_TYPE_RADIAL</code></span></td>
<td> The pattern is a radial gradient.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2587359"></a><h3>
<a name="cairo-pattern-get-type"></a>cairo_pattern_get_type ()</h3>
<a class="indexterm" name="id2587372"></a><pre class="programlisting"><a href="cairo-Patterns.html#cairo-pattern-type-t">cairo_pattern_type_t</a> cairo_pattern_get_type (<a href="cairo-Patterns.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre>
<p>
This function returns the type a pattern.
See <a href="cairo-Patterns.html#cairo-pattern-type-t"><span class="type">cairo_pattern_type_t</span></a> for available types.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td>
<td> a <a href="cairo-Patterns.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> The type of <em class="parameter"><code>pattern</code></em>.
</td>
</tr>
</tbody>
</table></div>
<p>Since 1.2
</p>
</div>
</div>
</div>
</body>
</html>
|