/usr/share/qt5/doc/qtquick/qml-qtquick-context2d.html is in qtdeclarative5-doc-html 5.9.5-0ubuntu1.
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 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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquickcontext2d.cpp -->
<title>Context2D QML Type | Qt Quick 5.9</title>
<link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
<script type="text/javascript">
document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
// loading style sheet breaks anchors that were jumped to before
// so force jumping to anchor again
setTimeout(function() {
var anchor = location.hash;
// need to jump to different anchor first (e.g. none)
location.hash = "#";
setTimeout(function() {
location.hash = anchor;
}, 0);
}, 0);
</script>
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<table><tr>
<td >Qt 5.9</td><td ><a href="qtquick-index.html">Qt Quick</a></td><td ><a href="qtquick-qmlmodule.html">QML Types</a></td><td >Context2D QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</td>
</tr></table>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Context2D QML Type</h1>
<span class="subtitle"></span>
<!-- $$$Context2D-brief -->
<p>Provides 2D context for shapes on a Canvas item <a href="#details">More...</a></p>
<!-- @@@Context2D -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtQuick 2.7</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.0</td></tr></table></div><ul>
<li><a href="qml-qtquick-context2d-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#canvas-prop">canvas</a></b></b> : QtQuick::Canvas</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#fillRule-prop">fillRule</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a></b></b> : variant</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#font-prop">font</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#globalAlpha-prop">globalAlpha</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#globalCompositeOperation-prop">globalCompositeOperation</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#lineCap-prop">lineCap</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#lineJoin-prop">lineJoin</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#lineWidth-prop">lineWidth</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#miterLimit-prop">miterLimit</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#shadowBlur-prop">shadowBlur</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#shadowColor-prop">shadowColor</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#shadowOffsetX-prop">shadowOffsetX</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#shadowOffsetY-prop">shadowOffsetY</a></b></b> : qreal</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a></b></b> : variant</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#textAlign-prop">textAlign</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#textBaseline-prop">textBaseline</a></b></b> : string</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#arc-method">arc</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>radius</i>, real <i>startAngle</i>, real <i>endAngle</i>, bool <i>anticlockwise</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#arcTo-method">arcTo</a></b></b>(real <i>x1</i>, real <i>y1</i>, real <i>x2</i>, real <i>y2</i>, real <i>radius</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#beginPath-method">beginPath</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#bezierCurveTo-method">bezierCurveTo</a></b></b>(real <i>cp1x</i>, real <i>cp1y</i>, real <i>cp2x</i>, real <i>cp2y</i>, real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#clearRect-method">clearRect</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#clip-method">clip</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#closePath-method">closePath</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#createConicalGradient-method">createConicalGradient</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>angle</i>)</li>
<li class="fn">CanvasImageData <b><b><a href="qml-qtquick-context2d.html#createImageData-method-2">createImageData</a></b></b>(Url <i>imageUrl</i>)</li>
<li class="fn">CanvasImageData <b><b><a href="qml-qtquick-context2d.html#createImageData-method-1">createImageData</a></b></b>(CanvasImageData <i>imageData</i>)</li>
<li class="fn">CanvasImageData <b><b><a href="qml-qtquick-context2d.html#createImageData-method">createImageData</a></b></b>(real <i>sw</i>, real <i>sh</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#createLinearGradient-method">createLinearGradient</a></b></b>(real <i>x0</i>, real <i>y0</i>, real <i>x1</i>, real <i>y1</i>)</li>
<li class="fn">variant <b><b><a href="qml-qtquick-context2d.html#createPattern-method-1">createPattern</a></b></b>(Image <i>image</i>, string <i>repetition</i>)</li>
<li class="fn">variant <b><b><a href="qml-qtquick-context2d.html#createPattern-method">createPattern</a></b></b>(color <i>color</i>, enumeration <i>patternMode</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#createRadialGradient-method">createRadialGradient</a></b></b>(real <i>x0</i>, real <i>y0</i>, real <i>r0</i>, real <i>x1</i>, real <i>y1</i>, real <i>r1</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#drawImage-method-2">drawImage</a></b></b>(variant <i>image</i>, real <i>sx</i>, real <i>sy</i>, real <i>sw</i>, real <i>sh</i>, real <i>dx</i>, real <i>dy</i>, real <i>dw</i>, real <i>dh</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#drawImage-method-1">drawImage</a></b></b>(variant <i>image</i>, real <i>dx</i>, real <i>dy</i>, real <i>dw</i>, real <i>dh</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-context2d.html#drawImage-method">drawImage</a></b></b>(variant <i>image</i>, real <i>dx</i>, real <i>dy</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#ellipse-method">ellipse</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#fill-method">fill</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#fillRect-method">fillRect</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#fillText-method">fillText</a></b></b>(<i>text</i>, <i>x</i>, <i>y</i>)</li>
<li class="fn">CanvasImageData <b><b><a href="qml-qtquick-context2d.html#getImageData-method">getImageData</a></b></b>(real <i>sx</i>, real <i>sy</i>, real <i>sw</i>, real <i>sh</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#isPointInPath-method">isPointInPath</a></b></b>(real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#lineTo-method">lineTo</a></b></b>(real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#measureText-method">measureText</a></b></b>(<i>text</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#moveTo-method">moveTo</a></b></b>(real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#putImageData-method">putImageData</a></b></b>(CanvasImageData <i>imageData</i>, real <i>dx</i>, real <i>dy</i>, real <i>dirtyX</i>, real <i>dirtyY</i>, real <i>dirtyWidth</i>, real <i>dirtyHeight</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#quadraticCurveTo-method">quadraticCurveTo</a></b></b>(real <i>cpx</i>, real <i>cpy</i>, real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#rect-method">rect</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#reset-method">reset</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#resetTransform-method">resetTransform</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#restore-method">restore</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#rotate-method">rotate</a></b></b>(real <i>angle</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#roundedRect-method">roundedRect</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>, real <i>xRadius</i>, real <i>yRadius</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#save-method">save</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#scale-method">scale</a></b></b>(real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#setTransform-method">setTransform</a></b></b>(real <i>a</i>, real <i>b</i>, real <i>c</i>, real <i>d</i>, real <i>e</i>, real <i>f</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#shear-method">shear</a></b></b>(real <i>sh</i>, real <i>sv</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#stroke-method">stroke</a></b></b>()</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#strokeRect-method">strokeRect</a></b></b>(real <i>x</i>, real <i>y</i>, real <i>w</i>, real <i>h</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#strokeText-method">strokeText</a></b></b>(<i>text</i>, <i>x</i>, <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#text-method">text</a></b></b>(string <i>text</i>, real <i>x</i>, real <i>y</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#transform-method">transform</a></b></b>(real <i>a</i>, real <i>b</i>, real <i>c</i>, real <i>d</i>, real <i>e</i>, real <i>f</i>)</li>
<li class="fn">object <b><b><a href="qml-qtquick-context2d.html#translate-method">translate</a></b></b>(real <i>x</i>, real <i>y</i>)</li>
</ul>
<!-- $$$Context2D-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>The <a href="qml-qtquick-context2d.html">Context2D</a> object can be created by <code>Canvas</code> item's <code>getContext()</code> method:</p>
<pre class="cpp">
Canvas {
id:canvas
onPaint:{
var ctx <span class="operator">=</span> canvas<span class="operator">.</span>getContext(<span class="char">'2d'</span>);
<span class="comment">//...</span>
}
}
</pre>
<p>The <a href="qml-qtquick-context2d.html">Context2D</a> API implements the same <a href="http://www.w3.org/TR/2dcontext">W3C Canvas 2D Context API standard</a> with some enhanced features.</p>
<p>The <a href="qml-qtquick-context2d.html">Context2D</a> API provides the rendering <b>context</b> which defines the methods and attributes needed to draw on the <code>Canvas</code> item. The following assigns the canvas rendering context to a <code>context</code> variable:</p>
<pre class="cpp">
var context <span class="operator">=</span> mycanvas<span class="operator">.</span>getContext(<span class="string">"2d"</span>)
</pre>
<p>The <a href="qml-qtquick-context2d.html">Context2D</a> API renders the canvas as a coordinate system whose origin (0,0) is at the top left corner, as shown in the figure below. Coordinates increase along the <code>x</code> axis from left to right and along the <code>y</code> axis from top to bottom of the canvas.</p>
<p class="centerAlign"><img src="images/qml-item-canvas-context.gif" alt="" /></p><!-- @@@Context2D -->
<h2>Property Documentation</h2>
<!-- $$$canvas -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="canvas-prop">
<td class="tblQmlPropNode"><p>
<a name="canvas-prop"></a><span class="name">canvas</span> : <span class="type"><a href="qml-qtquick-canvas.html">QtQuick::Canvas</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the canvas item that the context paints on.</p>
<p>This property is read only.</p>
</div></div><!-- @@@canvas -->
<br/>
<!-- $$$fillRule -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fillRule-prop">
<td class="tblQmlPropNode"><p>
<a name="fillRule-prop"></a><span class="name">fillRule</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current fill rule used for filling shapes. The following fill rules supported:</p>
<ul>
<li>Qt.OddEvenFill</li>
<li>Qt.WindingFill</li>
</ul>
<p>Note: Unlike the <a href="../qtgui/qpainterpath.html">QPainterPath</a>, the Canvas API uses the winding fill as the default fill rule. The fillRule property is part of the context rendering state.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
</div></div><!-- @@@fillRule -->
<br/>
<!-- $$$fillStyle -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fillStyle-prop">
<td class="tblQmlPropNode"><p>
<a name="fillStyle-prop"></a><span class="name">fillStyle</span> : <span class="type">variant</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current style used for filling shapes. The style can be either a string containing a CSS color, a <a href="qml-qtquick-canvasgradient.html">CanvasGradient</a> or CanvasPattern object. Invalid values are ignored. This property accepts several color syntaxes:</p>
<ul>
<li>'rgb(red, green, blue)' - for example: 'rgb(255, 100, 55)' or 'rgb(100%, 70%, 30%)'</li>
<li>'rgba(red, green, blue, alpha)' - for example: 'rgb(255, 100, 55, 1.0)' or 'rgb(100%, 70%, 30%, 0.5)'</li>
<li>'hsl(hue, saturation, lightness)'</li>
<li>'hsla(hue, saturation, lightness, alpha)'</li>
<li>'#RRGGBB' - for example: '#00FFCC'</li>
<li>Qt.rgba(red, green, blue, alpha) - for example: Qt.rgba(0.3, 0.7, 1, 1.0)</li>
</ul>
<p>If the <code>fillStyle</code> or <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a> is assigned many times in a loop, the last Qt.rgba() syntax should be chosen, as it has the best performance, because it's already a valid <a href="../qtgui/qcolor.html">QColor</a> value, does not need to be parsed everytime.</p>
<p>The default value is '#000000'.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#createLinearGradient-method">createLinearGradient()</a>, <a href="qml-qtquick-context2d.html#createRadialGradient-method">createRadialGradient()</a>, <a href="qml-qtquick-context2d.html#createPattern-method">createPattern()</a>, and <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>.</p>
</div></div><!-- @@@fillStyle -->
<br/>
<!-- $$$font -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font-prop">
<td class="tblQmlPropNode"><p>
<a name="font-prop"></a><span class="name">font</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current font settings.</p>
<p>A subset of the <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-font">w3C 2d context standard for font</a> is supported:</p>
<ul>
<li>font-style (optional): normal | italic | oblique</li>
<li>font-variant (optional): normal | small-caps</li>
<li>font-weight (optional): normal | bold | 0 ... 99</li>
<li>font-size: Npx | Npt (where N is a positive number)</li>
<li>font-family: See <a href="http://www.w3.org/TR/CSS2/fonts.html#propdef-font-family">http://www.w3.org/TR/CSS2/fonts.html#propdef-font-family</a></li>
</ul>
<p><b>Note: </b>The font-size and font-family properties are mandatory and must be in the order they are shown in above. In addition, a font family with spaces in its name must be quoted.</p><p>The default font value is "10px sans-serif".</p>
</div></div><!-- @@@font -->
<br/>
<!-- $$$globalAlpha -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="globalAlpha-prop">
<td class="tblQmlPropNode"><p>
<a name="globalAlpha-prop"></a><span class="name">globalAlpha</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current alpha value applied to rendering operations. The value must be in the range from <code>0.0</code> (fully transparent) to <code>1.0</code> (fully opaque). The default value is <code>1.0</code>.</p>
</div></div><!-- @@@globalAlpha -->
<br/>
<!-- $$$globalCompositeOperation -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="globalCompositeOperation-prop">
<td class="tblQmlPropNode"><p>
<a name="globalCompositeOperation-prop"></a><span class="name">globalCompositeOperation</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current the current composition operation, from the list below:</p>
<ul>
<li>source-atop - A atop B. Display the source image wherever both images are opaque. Display the destination image wherever the destination image is opaque but the source image is transparent. Display transparency elsewhere.</li>
<li>source-in - A in B. Display the source image wherever both the source image and destination image are opaque. Display transparency elsewhere.</li>
<li>source-out - A out B. Display the source image wherever the source image is opaque and the destination image is transparent. Display transparency elsewhere.</li>
<li>source-over - (default) A over B. Display the source image wherever the source image is opaque. Display the destination image elsewhere.</li>
<li>destination-atop - B atop A. Same as source-atop but using the destination image instead of the source image and vice versa.</li>
<li>destination-in - B in A. Same as source-in but using the destination image instead of the source image and vice versa.</li>
<li>destination-out - B out A. Same as source-out but using the destination image instead of the source image and vice versa.</li>
<li>destination-over - B over A. Same as source-over but using the destination image instead of the source image and vice versa.</li>
<li>lighter - A plus B. Display the sum of the source image and destination image, with color values approaching 255 (100%) as a limit.</li>
<li>copy - A (B is ignored). Display the source image instead of the destination image.</li>
<li>xor - A xor B. Exclusive OR of the source image and destination image.</li>
</ul>
<p>Additionally, this property also accepts the compositon modes listed in <a href="../qtgui/qpainter.html#CompositionMode-enum">QPainter::CompositionMode</a>. According to the W3C standard, these extension composition modes are provided as "vendorName-operationName" syntax, for example: <a href="../qtgui/qpainter.html#CompositionMode-enum">QPainter::CompositionMode_Exclusion</a> is provided as "qt-exclusion".</p>
</div></div><!-- @@@globalCompositeOperation -->
<br/>
<!-- $$$lineCap -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lineCap-prop">
<td class="tblQmlPropNode"><p>
<a name="lineCap-prop"></a><span class="name">lineCap</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current line cap style. The possible line cap styles are:</p>
<ul>
<li>butt - the end of each line has a flat edge perpendicular to the direction of the line, this is the default line cap value.</li>
<li>round - a semi-circle with the diameter equal to the width of the line must then be added on to the end of the line.</li>
<li>square - a rectangle with the length of the line width and the width of half the line width, placed flat against the edge perpendicular to the direction of the line.</li>
</ul>
<p>Other values are ignored.</p>
</div></div><!-- @@@lineCap -->
<br/>
<!-- $$$lineJoin -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lineJoin-prop">
<td class="tblQmlPropNode"><p>
<a name="lineJoin-prop"></a><span class="name">lineJoin</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current line join style. A join exists at any point in a subpath shared by two consecutive lines. When a subpath is closed, then a join also exists at its first point (equivalent to its last point) connecting the first and last lines in the subpath.</p>
<p>The possible line join styles are:</p>
<ul>
<li>bevel - this is all that is rendered at joins.</li>
<li>round - a filled arc connecting the two aforementioned corners of the join, abutting (and not overlapping) the aforementioned triangle, with the diameter equal to the line width and the origin at the point of the join, must be rendered at joins.</li>
<li>miter - a second filled triangle must (if it can given the miter length) be rendered at the join, this is the default line join style.</li>
</ul>
<p>Other values are ignored.</p>
</div></div><!-- @@@lineJoin -->
<br/>
<!-- $$$lineWidth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lineWidth-prop">
<td class="tblQmlPropNode"><p>
<a name="lineWidth-prop"></a><span class="name">lineWidth</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current line width. Values that are not finite values greater than zero are ignored.</p>
</div></div><!-- @@@lineWidth -->
<br/>
<!-- $$$miterLimit -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="miterLimit-prop">
<td class="tblQmlPropNode"><p>
<a name="miterLimit-prop"></a><span class="name">miterLimit</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current miter limit ratio. The default miter limit value is 10.0.</p>
</div></div><!-- @@@miterLimit -->
<br/>
<!-- $$$shadowBlur -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="shadowBlur-prop">
<td class="tblQmlPropNode"><p>
<a name="shadowBlur-prop"></a><span class="name">shadowBlur</span> : <span class="type">real</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current level of blur applied to shadows</p>
</div></div><!-- @@@shadowBlur -->
<br/>
<!-- $$$shadowColor -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="shadowColor-prop">
<td class="tblQmlPropNode"><p>
<a name="shadowColor-prop"></a><span class="name">shadowColor</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current shadow color.</p>
</div></div><!-- @@@shadowColor -->
<br/>
<!-- $$$shadowOffsetX -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="shadowOffsetX-prop">
<td class="tblQmlPropNode"><p>
<a name="shadowOffsetX-prop"></a><span class="name">shadowOffsetX</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current shadow offset in the positive horizontal distance.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#shadowOffsetY-prop">shadowOffsetY</a>.</p>
</div></div><!-- @@@shadowOffsetX -->
<br/>
<!-- $$$shadowOffsetY -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="shadowOffsetY-prop">
<td class="tblQmlPropNode"><p>
<a name="shadowOffsetY-prop"></a><span class="name">shadowOffsetY</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current shadow offset in the positive vertical distance.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#shadowOffsetX-prop">shadowOffsetX</a>.</p>
</div></div><!-- @@@shadowOffsetY -->
<br/>
<!-- $$$strokeStyle -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="strokeStyle-prop">
<td class="tblQmlPropNode"><p>
<a name="strokeStyle-prop"></a><span class="name">strokeStyle</span> : <span class="type">variant</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current color or style to use for the lines around shapes, The style can be either a string containing a CSS color, a <a href="qml-qtquick-canvasgradient.html">CanvasGradient</a> or CanvasPattern object. Invalid values are ignored.</p>
<p>The default value is '#000000'.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#createLinearGradient-method">createLinearGradient()</a>, <a href="qml-qtquick-context2d.html#createRadialGradient-method">createRadialGradient()</a>, <a href="qml-qtquick-context2d.html#createPattern-method">createPattern()</a>, and <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
</div></div><!-- @@@strokeStyle -->
<br/>
<!-- $$$textAlign -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textAlign-prop">
<td class="tblQmlPropNode"><p>
<a name="textAlign-prop"></a><span class="name">textAlign</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current text alignment settings. The possible values are:</p>
<ul>
<li>start</li>
<li>end</li>
<li>left</li>
<li>right</li>
<li>center</li>
</ul>
<p>Other values are ignored. The default value is "start".</p>
</div></div><!-- @@@textAlign -->
<br/>
<!-- $$$textBaseline -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textBaseline-prop">
<td class="tblQmlPropNode"><p>
<a name="textBaseline-prop"></a><span class="name">textBaseline</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Holds the current baseline alignment settings. The possible values are:</p>
<ul>
<li>top</li>
<li>hanging</li>
<li>middle</li>
<li>alphabetic</li>
<li>ideographic</li>
<li>bottom</li>
</ul>
<p>Other values are ignored. The default value is "alphabetic".</p>
</div></div><!-- @@@textBaseline -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$arc -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="arc-method">
<td class="tblQmlFuncNode"><p>
<a name="arc-method"></a><span class="type">object</span> <span class="name">arc</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>radius</i>, <span class="type">real</span> <i>startAngle</i>, <span class="type">real</span> <i>endAngle</i>, <span class="type">bool</span> <i>anticlockwise</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds an arc to the current subpath that lies on the circumference of the circle whose center is at the point (<i>x</i>, <i>y</i>) and whose radius is <i>radius</i>.</p>
<p>Both <code>startAngle</code> and <code>endAngle</code> are measured from the x-axis in radians.</p>
<p class="centerAlign"><img src="images/qml-item-canvas-arc.png" alt="" /></p><p class="centerAlign"><img src="images/qml-item-canvas-startAngle.png" alt="" /></p><p>The <i>anticlockwise</i> parameter is <code>true</code> for each arc in the figure above because they are all drawn in the anticlockwise direction.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#arcTo-method">arcTo</a> and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-arc">W3C's 2D Context Standard for arc()</a>.</p>
</div></div><!-- @@@arc -->
<br/>
<!-- $$$arcTo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="arcTo-method">
<td class="tblQmlFuncNode"><p>
<a name="arcTo-method"></a><span class="type">object</span> <span class="name">arcTo</span>(<span class="type">real</span> <i>x1</i>, <span class="type">real</span> <i>y1</i>, <span class="type">real</span> <i>x2</i>, <span class="type">real</span> <i>y2</i>, <span class="type">real</span> <i>radius</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds an arc with the given control points and radius to the current subpath, connected to the previous point by a straight line. To draw an arc, you begin with the same steps you followed to create a line:</p>
<ul>
<li>Call the <a href="qml-qtquick-context2d.html#beginPath-method">beginPath()</a> method to set a new path.</li>
<li>Call the <a href="qml-qtquick-context2d.html#moveTo-method">moveTo</a>(<code>x</code>, <code>y</code>) method to set your starting position on the canvas at the point (<code>x</code>, <code>y</code>).</li>
<li>To draw an arc or circle, call the arcTo(<i>x1</i>, <i>y1</i>, <i>x2</i>, <i>y2</i>, <i>radius</i>) method. This adds an arc with starting point (<i>x1</i>, <i>y1</i>), ending point (<i>x2</i>, <i>y2</i>), and <i>radius</i> to the current subpath and connects it to the previous subpath by a straight line.</li>
</ul>
<p class="centerAlign"><img src="images/qml-item-canvas-arcTo.png" alt="" /></p><p><b>See also </b><a href="qml-qtquick-context2d.html#arc-method">arc</a> and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-arcto">W3C's 2D Context Standard for arcTo()</a>.</p>
</div></div><!-- @@@arcTo -->
<br/>
<!-- $$$beginPath -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="beginPath-method">
<td class="tblQmlFuncNode"><p>
<a name="beginPath-method"></a><span class="type">object</span> <span class="name">beginPath</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Resets the current path to a new path.</p>
</div></div><!-- @@@beginPath -->
<br/>
<!-- $$$bezierCurveTo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="bezierCurveTo-method">
<td class="tblQmlFuncNode"><p>
<a name="bezierCurveTo-method"></a><span class="type">object</span> <span class="name">bezierCurveTo</span>(<span class="type">real</span> <i>cp1x</i>, <span class="type">real</span> <i>cp1y</i>, <span class="type">real</span> <i>cp2x</i>, <span class="type">real</span> <i>cp2y</i>, <span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds a cubic bezier curve between the current position and the given endPoint using the control points specified by (<code>cp1x</code>, cp1y), and (<code>cp2x</code>, <code>cp2y</code>). After the curve is added, the current position is updated to be at the end point (<code>x</code>, <code>y</code>) of the curve. The following code produces the path shown below:</p>
<pre class="cpp">
ctx<span class="operator">.</span>strokeStyle <span class="operator">=</span> <span class="type">Qt</span><span class="operator">.</span>rgba(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span>);
ctx<span class="operator">.</span>lineWidth <span class="operator">=</span> <span class="number">1</span>;
ctx<span class="operator">.</span>beginPath();
ctx<span class="operator">.</span>moveTo(<span class="number">20</span><span class="operator">,</span> <span class="number">0</span>);<span class="comment">//start point</span>
ctx<span class="operator">.</span>bezierCurveTo(<span class="operator">-</span><span class="number">10</span><span class="operator">,</span> <span class="number">90</span><span class="operator">,</span> <span class="number">210</span><span class="operator">,</span> <span class="number">90</span><span class="operator">,</span> <span class="number">180</span><span class="operator">,</span> <span class="number">0</span>);
ctx<span class="operator">.</span>stroke();
</pre>
<p class="centerAlign"><img src="images/qml-item-canvas-bezierCurveTo.png" alt="" /></p><p><b>See also </b><a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-beziercurveto">W3C 2d context standard for bezierCurveTo</a> and <a href="http://www.openrise.com/lab/FlowerPower/">The beautiful flower demo by using bezierCurveTo</a>.</p>
</div></div><!-- @@@bezierCurveTo -->
<br/>
<!-- $$$clearRect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clearRect-method">
<td class="tblQmlFuncNode"><p>
<a name="clearRect-method"></a><span class="type">object</span> <span class="name">clearRect</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Clears all pixels on the canvas in the given rectangle to transparent black.</p>
</div></div><!-- @@@clearRect -->
<br/>
<!-- $$$clip -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clip-method">
<td class="tblQmlFuncNode"><p>
<a name="clip-method"></a><span class="type">object</span> <span class="name">clip</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates the clipping region from the current path. Any parts of the shape outside the clipping path are not displayed. To create a complex shape using the <code>clip()</code> method:</p>
<ol class="1" type="1"><li>Call the <code>context.beginPath()</code> method to set the clipping path.</li>
<li>Define the clipping path by calling any combination of the <code>lineTo</code>, <code>arcTo</code>, <code>arc</code>, <code>moveTo</code>, etc and <code>closePath</code> methods.</li>
<li>Call the <code>context.clip()</code> method.</li>
</ol>
<p>The new shape displays. The following shows how a clipping path can modify how an image displays:</p>
<p class="centerAlign"><img src="images/qml-item-canvas-clip-complex.png" alt="" /></p><p><b>See also </b><a href="qml-qtquick-context2d.html#beginPath-method">beginPath()</a>, <a href="qml-qtquick-context2d.html#closePath-method">closePath()</a>, <a href="qml-qtquick-context2d.html#stroke-method">stroke()</a>, <a href="qml-qtquick-context2d.html#fill-method">fill()</a>, and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-clip">W3C 2d context standard for clip</a>.</p>
</div></div><!-- @@@clip -->
<br/>
<!-- $$$closePath -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="closePath-method">
<td class="tblQmlFuncNode"><p>
<a name="closePath-method"></a><span class="type">object</span> <span class="name">closePath</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting a new path. The current point of the new path is the previous subpath's first point.</p>
<p><b>See also </b><a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-closepath">W3C 2d context standard for closePath</a>.</p>
</div></div><!-- @@@closePath -->
<br/>
<!-- $$$createConicalGradient -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createConicalGradient-method">
<td class="tblQmlFuncNode"><p>
<a name="createConicalGradient-method"></a><span class="type">object</span> <span class="name">createConicalGradient</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>angle</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns a <a href="qml-qtquick-canvasgradient.html">CanvasGradient</a> object that represents a conical gradient that interpolate colors counter-clockwise around a center point (<code>x</code>, <code>y</code>) with start angle <code>angle</code> in units of radians.</p>
<p><b>See also </b><a href="qml-qtquick-canvasgradient.html#addColorStop-method">CanvasGradient::addColorStop()</a>, <a href="qml-qtquick-context2d.html#createLinearGradient-method">createLinearGradient()</a>, <a href="qml-qtquick-context2d.html#createRadialGradient-method">createRadialGradient()</a>, <a href="qml-qtquick-context2d.html#createPattern-method">createPattern()</a>, <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>, and <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>.</p>
</div></div><!-- @@@createConicalGradient -->
<br/>
<!-- $$$createImageData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createImageData-method-2">
<td class="tblQmlFuncNode"><p>
<a name="createImageData-method-2"></a><span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <span class="name">createImageData</span>(<span class="type">Url</span> <i>imageUrl</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object with the given image loaded from <i>imageUrl</i>.</p>
<p><b>Note: </b>The <i>imageUrl</i> must be already loaded before this function call, otherwise an empty <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> obect will be returned.</p><p><b>See also </b><a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a>, <a href="qml-qtquick-canvas.html#unloadImage-method">QtQuick::Canvas::unloadImage()</a>, and <a href="qml-qtquick-canvas.html#isImageLoaded-method">QtQuick::Canvas::isImageLoaded</a>.</p>
</div></div><!-- @@@createImageData -->
<br/>
<!-- $$$createImageData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createImageData-method-1">
<td class="tblQmlFuncNode"><p>
<a name="createImageData-method-1"></a><span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <span class="name">createImageData</span>(<span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <i>imageData</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object with the same dimensions as the argument.</p>
</div></div><!-- @@@createImageData -->
<br/>
<!-- $$$createImageData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createImageData-method">
<td class="tblQmlFuncNode"><p>
<a name="createImageData-method"></a><span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <span class="name">createImageData</span>(<span class="type">real</span> <i>sw</i>, <span class="type">real</span> <i>sh</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object with the given dimensions(<i>sw</i>, <i>sh</i>).</p>
</div></div><!-- @@@createImageData -->
<br/>
<!-- $$$createLinearGradient -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createLinearGradient-method">
<td class="tblQmlFuncNode"><p>
<a name="createLinearGradient-method"></a><span class="type">object</span> <span class="name">createLinearGradient</span>(<span class="type">real</span> <i>x0</i>, <span class="type">real</span> <i>y0</i>, <span class="type">real</span> <i>x1</i>, <span class="type">real</span> <i>y1</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns a <a href="qml-qtquick-canvasgradient.html">CanvasGradient</a> object that represents a linear gradient that transitions the color along a line between the start point (<i>x0</i>, <i>y0</i>) and the end point (<i>x1</i>, <i>y1</i>).</p>
<p>A gradient is a smooth transition between colors. There are two types of gradients: linear and radial. Gradients must have two or more color stops, representing color shifts positioned from 0 to 1 between to the gradient's starting and end points or circles.</p>
<p><b>See also </b><a href="qml-qtquick-canvasgradient.html#addColorStop-method">CanvasGradient::addColorStop()</a>, <a href="qml-qtquick-context2d.html#createRadialGradient-method">createRadialGradient()</a>, <a href="qml-qtquick-context2d.html#createConicalGradient-method">createConicalGradient()</a>, <a href="qml-qtquick-context2d.html#createPattern-method">createPattern()</a>, <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>, and <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>.</p>
</div></div><!-- @@@createLinearGradient -->
<br/>
<!-- $$$createPattern -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createPattern-method-1">
<td class="tblQmlFuncNode"><p>
<a name="createPattern-method-1"></a><span class="type">variant</span> <span class="name">createPattern</span>(<span class="type"><a href="qml-qtquick-image.html">Image</a></span> <i>image</i>, <span class="type">string</span> <i>repetition</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns a CanvasPattern object that uses the given image and repeats in the direction(s) given by the repetition argument.</p>
<p>The <i>image</i> parameter must be a valid Image item, a valid <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object or loaded image url, if there is no image data, throws an INVALID_STATE_ERR exception.</p>
<p>The allowed values for <i>repetition</i> are:</p>
<ul>
<li>"repeat" - both directions</li>
<li>"repeat-x - horizontal only</li>
<li>"repeat-y" - vertical only</li>
<li>"no-repeat" - neither</li>
</ul>
<p>If the repetition argument is empty or null, the value "repeat" is used.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a> and <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
</div></div><!-- @@@createPattern -->
<br/>
<!-- $$$createPattern -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createPattern-method">
<td class="tblQmlFuncNode"><p>
<a name="createPattern-method"></a><span class="type">variant</span> <span class="name">createPattern</span>(<span class="type">color</span> <i>color</i>, <span class="type">enumeration</span> <i>patternMode</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This is a overload function. Returns a CanvasPattern object that uses the given <i>color</i> and <i>patternMode</i>. The valid pattern modes are:</p>
<ul>
<li>Qt.SolidPattern</li>
<li>Qt.Dense1Pattern</li>
<li>Qt.Dense2Pattern</li>
<li>Qt.Dense3Pattern</li>
<li>Qt.Dense4Pattern</li>
<li>Qt.Dense5Pattern</li>
<li>Qt.Dense6Pattern</li>
<li>Qt.Dense7Pattern</li>
<li>Qt.HorPattern</li>
<li>Qt.VerPattern</li>
<li>Qt.CrossPattern</li>
<li>Qt.BDiagPattern</li>
<li>Qt.FDiagPattern</li>
<li>Qt.DiagCrossPattern</li>
</ul>
<p><b>See also </b><a href="../qtcore/qt.html#BrushStyle-enum">Qt::BrushStyle</a>.</p>
</div></div><!-- @@@createPattern -->
<br/>
<!-- $$$createRadialGradient -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createRadialGradient-method">
<td class="tblQmlFuncNode"><p>
<a name="createRadialGradient-method"></a><span class="type">object</span> <span class="name">createRadialGradient</span>(<span class="type">real</span> <i>x0</i>, <span class="type">real</span> <i>y0</i>, <span class="type">real</span> <i>r0</i>, <span class="type">real</span> <i>x1</i>, <span class="type">real</span> <i>y1</i>, <span class="type">real</span> <i>r1</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns a <a href="qml-qtquick-canvasgradient.html">CanvasGradient</a> object that represents a radial gradient that paints along the cone given by the start circle with origin (x0, y0) and radius r0, and the end circle with origin (x1, y1) and radius r1.</p>
<p><b>See also </b><a href="qml-qtquick-canvasgradient.html#addColorStop-method">CanvasGradient::addColorStop()</a>, <a href="qml-qtquick-context2d.html#createLinearGradient-method">createLinearGradient()</a>, <a href="qml-qtquick-context2d.html#createConicalGradient-method">createConicalGradient()</a>, <a href="qml-qtquick-context2d.html#createPattern-method">createPattern()</a>, <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>, and <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>.</p>
</div></div><!-- @@@createRadialGradient -->
<br/>
<!-- $$$drawImage -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="drawImage-method-2">
<td class="tblQmlFuncNode"><p>
<a name="drawImage-method-2"></a><span class="name">drawImage</span>(<span class="type">variant</span> <i>image</i>, <span class="type">real</span> <i>sx</i>, <span class="type">real</span> <i>sy</i>, <span class="type">real</span> <i>sw</i>, <span class="type">real</span> <i>sh</i>, <span class="type">real</span> <i>dx</i>, <span class="type">real</span> <i>dy</i>, <span class="type">real</span> <i>dw</i>, <span class="type">real</span> <i>dh</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This is an overloaded function. Draws the given item as <i>image</i> from source point (<i>sx</i>, <i>sy</i>) and source width <i>sw</i>, source height <i>sh</i> onto the canvas at point (<i>dx</i>, <i>dy</i>) and with width <i>dw</i>, height <i>dh</i>.</p>
<p>Note: The <i>image</i> type can be an Image or Canvas item, an image url or a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a> method first. This image been drawing is subject to the current context clip path, even the given <code>image</code> is a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object.</p>
<p><b>See also </b><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a>, <a href="qtquick-imageelements-example.html#image">Image</a>, <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a>, <a href="qml-qtquick-canvas.html#isImageLoaded-method">Canvas::isImageLoaded</a>, <a href="qml-qtquick-canvas.html#imageLoaded-signal">Canvas::imageLoaded</a>, and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage">W3C 2d context standard for drawImage</a>.</p>
</div></div><!-- @@@drawImage -->
<br/>
<!-- $$$drawImage -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="drawImage-method-1">
<td class="tblQmlFuncNode"><p>
<a name="drawImage-method-1"></a><span class="name">drawImage</span>(<span class="type">variant</span> <i>image</i>, <span class="type">real</span> <i>dx</i>, <span class="type">real</span> <i>dy</i>, <span class="type">real</span> <i>dw</i>, <span class="type">real</span> <i>dh</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This is an overloaded function. Draws the given item as <i>image</i> onto the canvas at point (<i>dx</i>, <i>dy</i>) and with width <i>dw</i>, height <i>dh</i>.</p>
<p>Note: The <i>image</i> type can be an Image item, an image url or a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a> method first. This image been drawing is subject to the current context clip path, even the given <code>image</code> is a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object.</p>
<p><b>See also </b><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a>, <a href="qtquick-imageelements-example.html#image">Image</a>, <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a>, <a href="qml-qtquick-canvas.html#isImageLoaded-method">Canvas::isImageLoaded</a>, <a href="qml-qtquick-canvas.html#imageLoaded-signal">Canvas::imageLoaded</a>, and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage">W3C 2d context standard for drawImage</a>.</p>
</div></div><!-- @@@drawImage -->
<br/>
<!-- $$$drawImage -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="drawImage-method">
<td class="tblQmlFuncNode"><p>
<a name="drawImage-method"></a><span class="name">drawImage</span>(<span class="type">variant</span> <i>image</i>, <span class="type">real</span> <i>dx</i>, <span class="type">real</span> <i>dy</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Draws the given <i>image</i> on the canvas at position (<i>dx</i>, <i>dy</i>). Note: The <i>image</i> type can be an Image item, an image url or a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object. When given as Image item, if the image isn't fully loaded, this method draws nothing. When given as url string, the image should be loaded by calling Canvas item's <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage()</a> method first. This image been drawing is subject to the current context clip path, even the given <code>image</code> is a <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object.</p>
<p><b>See also </b><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a>, <a href="qtquick-imageelements-example.html#image">Image</a>, <a href="qml-qtquick-canvas.html#loadImage-method">Canvas::loadImage</a>, <a href="qml-qtquick-canvas.html#isImageLoaded-method">Canvas::isImageLoaded</a>, <a href="qml-qtquick-canvas.html#imageLoaded-signal">Canvas::imageLoaded</a>, and <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-drawimage">W3C 2d context standard for drawImage</a>.</p>
</div></div><!-- @@@drawImage -->
<br/>
<!-- $$$ellipse -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="ellipse-method">
<td class="tblQmlFuncNode"><p>
<a name="ellipse-method"></a><span class="type">object</span> <span class="name">ellipse</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates an ellipse within the bounding rectangle defined by its top-left corner at (<i>x</i>, y), width <i>w</i> and height <i>h</i>, and adds it to the path as a closed subpath.</p>
<p>The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).</p>
</div></div><!-- @@@ellipse -->
<br/>
<!-- $$$fill -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fill-method">
<td class="tblQmlFuncNode"><p>
<a name="fill-method"></a><span class="type">object</span> <span class="name">fill</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Fills the subpaths with the current fill style.</p>
<p><b>See also </b><a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-fill">W3C 2d context standard for fill</a> and <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
</div></div><!-- @@@fill -->
<br/>
<!-- $$$fillRect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fillRect-method">
<td class="tblQmlFuncNode"><p>
<a name="fillRect-method"></a><span class="type">object</span> <span class="name">fillRect</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Paint the specified rectangular area using the <a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a>.</p>
</div></div><!-- @@@fillRect -->
<br/>
<!-- $$$fillText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="fillText-method">
<td class="tblQmlFuncNode"><p>
<a name="fillText-method"></a><span class="type">object</span> <span class="name">fillText</span>(<i>text</i>, <i>x</i>, <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Fills the given text at the given position.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#font-prop">font</a>, <a href="qml-qtquick-context2d.html#textAlign-prop">textAlign</a>, <a href="qml-qtquick-context2d.html#textBaseline-prop">textBaseline</a>, and <a href="qml-qtquick-context2d.html#strokeText-method">strokeText</a>.</p>
</div></div><!-- @@@fillText -->
<br/>
<!-- $$$getImageData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="getImageData-method">
<td class="tblQmlFuncNode"><p>
<a name="getImageData-method"></a><span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <span class="name">getImageData</span>(<span class="type">real</span> <i>sx</i>, <span class="type">real</span> <i>sy</i>, <span class="type">real</span> <i>sw</i>, <span class="type">real</span> <i>sh</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns an <a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a> object containing the image data for the given rectangle of the canvas.</p>
</div></div><!-- @@@getImageData -->
<br/>
<!-- $$$isPointInPath -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isPointInPath-method">
<td class="tblQmlFuncNode"><p>
<a name="isPointInPath-method"></a><span class="type">object</span> <span class="name">isPointInPath</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns true if the given point is in the current path.</p>
<p><b>See also </b><a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-ispointinpath">W3C 2d context standard for isPointInPath</a>.</p>
</div></div><!-- @@@isPointInPath -->
<br/>
<!-- $$$lineTo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lineTo-method">
<td class="tblQmlFuncNode"><p>
<a name="lineTo-method"></a><span class="type">object</span> <span class="name">lineTo</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Draws a line from the current position to the point (x, y).</p>
</div></div><!-- @@@lineTo -->
<br/>
<!-- $$$measureText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="measureText-method">
<td class="tblQmlFuncNode"><p>
<a name="measureText-method"></a><span class="type">object</span> <span class="name">measureText</span>(<i>text</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns an object with a <code>width</code> property, whose value is equivalent to calling <a href="../qtgui/qfontmetrics.html#width-2">QFontMetrics::width()</a> with the given <i>text</i> in the current font.</p>
</div></div><!-- @@@measureText -->
<br/>
<!-- $$$moveTo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="moveTo-method">
<td class="tblQmlFuncNode"><p>
<a name="moveTo-method"></a><span class="type">object</span> <span class="name">moveTo</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Creates a new subpath with the given point.</p>
</div></div><!-- @@@moveTo -->
<br/>
<!-- $$$putImageData -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="putImageData-method">
<td class="tblQmlFuncNode"><p>
<a name="putImageData-method"></a><span class="type">object</span> <span class="name">putImageData</span>(<span class="type"><a href="qml-qtquick-canvasimagedata.html">CanvasImageData</a></span> <i>imageData</i>, <span class="type">real</span> <i>dx</i>, <span class="type">real</span> <i>dy</i>, <span class="type">real</span> <i>dirtyX</i>, <span class="type">real</span> <i>dirtyY</i>, <span class="type">real</span> <i>dirtyWidth</i>, <span class="type">real</span> <i>dirtyHeight</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Paints the data from the given ImageData object onto the canvas. If a dirty rectangle (<i>dirtyX</i>, <i>dirtyY</i>, <i>dirtyWidth</i>, <i>dirtyHeight</i>) is provided, only the pixels from that rectangle are painted.</p>
</div></div><!-- @@@putImageData -->
<br/>
<!-- $$$quadraticCurveTo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="quadraticCurveTo-method">
<td class="tblQmlFuncNode"><p>
<a name="quadraticCurveTo-method"></a><span class="type">object</span> <span class="name">quadraticCurveTo</span>(<span class="type">real</span> <i>cpx</i>, <span class="type">real</span> <i>cpy</i>, <span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds a quadratic bezier curve between the current point and the endpoint (<code>x</code>, <code>y</code>) with the control point specified by (<code>cpx</code>, <code>cpy</code>).</p>
<p>See <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-quadraticcurveto">W3C 2d context standard for quadraticCurveTo</a></p>
</div></div><!-- @@@quadraticCurveTo -->
<br/>
<!-- $$$rect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rect-method">
<td class="tblQmlFuncNode"><p>
<a name="rect-method"></a><span class="type">object</span> <span class="name">rect</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds a rectangle at position (<code>x</code>, <code>y</code>), with the given width <code>w</code> and height <code>h</code>, as a closed subpath.</p>
</div></div><!-- @@@rect -->
<br/>
<!-- $$$reset -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="reset-method">
<td class="tblQmlFuncNode"><p>
<a name="reset-method"></a><span class="type">object</span> <span class="name">reset</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Resets the context state and properties to the default values.</p>
</div></div><!-- @@@reset -->
<br/>
<!-- $$$resetTransform -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="resetTransform-method">
<td class="tblQmlFuncNode"><p>
<a name="resetTransform-method"></a><span class="type">object</span> <span class="name">resetTransform</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Reset the transformation matrix to the default value (equivalent to calling <a href="qml-qtquick-context2d.html#setTransform-method">setTransform</a>(<code>1</code>, <code>0</code>, <code>0</code>, <code>1</code>, <code>0</code>, <code>0</code>)).</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#transform-method">transform()</a>, <a href="qml-qtquick-context2d.html#setTransform-method">setTransform()</a>, and <a href="qml-qtquick-context2d.html#reset-method">reset()</a>.</p>
</div></div><!-- @@@resetTransform -->
<br/>
<!-- $$$restore -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="restore-method">
<td class="tblQmlFuncNode"><p>
<a name="restore-method"></a><span class="type">object</span> <span class="name">restore</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Pops the top state on the stack, restoring the context to that state.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#save-method">save()</a>.</p>
</div></div><!-- @@@restore -->
<br/>
<!-- $$$rotate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rotate-method">
<td class="tblQmlFuncNode"><p>
<a name="rotate-method"></a><span class="type">object</span> <span class="name">rotate</span>(<span class="type">real</span> <i>angle</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Rotate the canvas around the current origin by <i>angle</i> in radians and clockwise direction.</p>
<pre class="cpp">
ctx<span class="operator">.</span>rotate(Math<span class="operator">.</span>PI<span class="operator">/</span><span class="number">2</span>);
</pre>
<p class="centerAlign"><img src="images/qml-item-canvas-rotate.png" alt="" /></p><p>The rotation transformation matrix is as follows:</p>
<p class="centerAlign"><img src="images/qml-item-canvas-math-rotate.png" alt="" /></p><p>where the <i>angle</i> of rotation is in radians.</p>
</div></div><!-- @@@rotate -->
<br/>
<!-- $$$roundedRect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="roundedRect-method">
<td class="tblQmlFuncNode"><p>
<a name="roundedRect-method"></a><span class="type">object</span> <span class="name">roundedRect</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>, <span class="type">real</span> <i>xRadius</i>, <span class="type">real</span> <i>yRadius</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds the given rectangle rect with rounded corners to the path. The <code>xRadius</code> and <code>yRadius</code> arguments specify the radius of the ellipses defining the corners of the rounded rectangle.</p>
</div></div><!-- @@@roundedRect -->
<br/>
<!-- $$$save -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="save-method">
<td class="tblQmlFuncNode"><p>
<a name="save-method"></a><span class="type">object</span> <span class="name">save</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Pushes the current state onto the state stack.</p>
<p>Before changing any state attributes, you should save the current state for future reference. The context maintains a stack of drawing states. Each state consists of the current transformation matrix, clipping region, and values of the following attributes:</p>
<ul>
<li><a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a></li>
<li><a href="qml-qtquick-context2d.html#fillStyle-prop">fillStyle</a></li>
<li><a href="qml-qtquick-context2d.html#fillRule-prop">fillRule</a></li>
<li><a href="qml-qtquick-context2d.html#globalAlpha-prop">globalAlpha</a></li>
<li><a href="qml-qtquick-context2d.html#lineWidth-prop">lineWidth</a></li>
<li><a href="qml-qtquick-context2d.html#lineCap-prop">lineCap</a></li>
<li><a href="qml-qtquick-context2d.html#lineJoin-prop">lineJoin</a></li>
<li><a href="qml-qtquick-context2d.html#miterLimit-prop">miterLimit</a></li>
<li><a href="qml-qtquick-context2d.html#shadowOffsetX-prop">shadowOffsetX</a></li>
<li><a href="qml-qtquick-context2d.html#shadowOffsetY-prop">shadowOffsetY</a></li>
<li><a href="qml-qtquick-context2d.html#shadowBlur-prop">shadowBlur</a></li>
<li><a href="qml-qtquick-context2d.html#shadowColor-prop">shadowColor</a></li>
<li><a href="qml-qtquick-context2d.html#globalCompositeOperation-prop">globalCompositeOperation</a></li>
<li><a href="qml-qtquick-context2d.html#font-prop">font</a></li>
<li><a href="qml-qtquick-context2d.html#textAlign-prop">textAlign</a></li>
<li><a href="qml-qtquick-context2d.html#textBaseline-prop">textBaseline</a></li>
</ul>
<p>The current path is NOT part of the drawing state. The path can be reset by invoking the <a href="qml-qtquick-context2d.html#beginPath-method">beginPath()</a> method.</p>
</div></div><!-- @@@save -->
<br/>
<!-- $$$scale -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="scale-method">
<td class="tblQmlFuncNode"><p>
<a name="scale-method"></a><span class="type">object</span> <span class="name">scale</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Increases or decreases the size of each unit in the canvas grid by multiplying the scale factors to the current tranform matrix. <i>x</i> is the scale factor in the horizontal direction and <i>y</i> is the scale factor in the vertical direction.</p>
<p>The following code doubles the horizontal size of an object drawn on the canvas and halves its vertical size:</p>
<pre class="cpp">
ctx<span class="operator">.</span>scale(<span class="number">2.0</span><span class="operator">,</span> <span class="number">0.5</span>);
</pre>
<p class="centerAlign"><img src="images/qml-item-canvas-scale.png" alt="" /></p></div></div><!-- @@@scale -->
<br/>
<!-- $$$setTransform -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="setTransform-method">
<td class="tblQmlFuncNode"><p>
<a name="setTransform-method"></a><span class="type">object</span> <span class="name">setTransform</span>(<span class="type">real</span> <i>a</i>, <span class="type">real</span> <i>b</i>, <span class="type">real</span> <i>c</i>, <span class="type">real</span> <i>d</i>, <span class="type">real</span> <i>e</i>, <span class="type">real</span> <i>f</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Changes the transformation matrix to the matrix given by the arguments as described below.</p>
<p>Modifying the transformation matrix directly enables you to perform scaling, rotating, and translating transformations in a single step.</p>
<p>Each point on the canvas is multiplied by the matrix before anything is drawn. The <a href="http://www.w3.org/TR/2dcontext/#transformations">HTML Canvas 2D Context specification</a> defines the transformation matrix as:</p>
<p class="centerAlign"><img src="images/qml-item-canvas-math.png" alt="" /></p><p>where:</p>
<ul>
<li><code>a</code> is the scale factor in the horizontal (x) direction<p class="centerAlign"><img src="images/qml-item-canvas-scalex.png" alt="" /></p></li>
<li><code>c</code> is the skew factor in the x direction<p class="centerAlign"><img src="images/qml-item-canvas-skewx.png" alt="" /></p></li>
<li><code>e</code> is the translation in the x direction<p class="centerAlign"><img src="images/qml-item-canvas-translate.png" alt="" /></p></li>
<li><code>b</code> is the skew factor in the y (vertical) direction<p class="centerAlign"><img src="images/qml-item-canvas-skewy.png" alt="" /></p></li>
<li><code>d</code> is the scale factor in the y direction<p class="centerAlign"><img src="images/qml-item-canvas-scaley.png" alt="" /></p></li>
<li><code>f</code> is the translation in the y direction<p class="centerAlign"><img src="images/qml-item-canvas-translatey.png" alt="" /></p></li>
<li>the last row remains constant</li>
</ul>
<p>The scale factors and skew factors are multiples; <code>e</code> and <code>f</code> are coordinate space units, just like the units in the translate(x,y) method.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#transform-method">transform()</a>.</p>
</div></div><!-- @@@setTransform -->
<br/>
<!-- $$$shear -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="shear-method">
<td class="tblQmlFuncNode"><p>
<a name="shear-method"></a><span class="type">object</span> <span class="name">shear</span>(<span class="type">real</span> <i>sh</i>, <span class="type">real</span> <i>sv</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Shears the transformation matrix by <i>sh</i> in the horizontal direction and <i>sv</i> in the vertical direction.</p>
</div></div><!-- @@@shear -->
<br/>
<!-- $$$stroke -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="stroke-method">
<td class="tblQmlFuncNode"><p>
<a name="stroke-method"></a><span class="type">object</span> <span class="name">stroke</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Strokes the subpaths with the current stroke style.</p>
<p>See <a href="http://www.w3.org/TR/2dcontext/#dom-context-2d-stroke">W3C 2d context standard for stroke</a></p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>.</p>
</div></div><!-- @@@stroke -->
<br/>
<!-- $$$strokeRect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="strokeRect-method">
<td class="tblQmlFuncNode"><p>
<a name="strokeRect-method"></a><span class="type">object</span> <span class="name">strokeRect</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>, <span class="type">real</span> <i>w</i>, <span class="type">real</span> <i>h</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Stroke the specified rectangle's path using the <a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>, <a href="qml-qtquick-context2d.html#lineWidth-prop">lineWidth</a>, <a href="qml-qtquick-context2d.html#lineJoin-prop">lineJoin</a>, and (if appropriate) <a href="qml-qtquick-context2d.html#miterLimit-prop">miterLimit</a> attributes.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#strokeStyle-prop">strokeStyle</a>, <a href="qml-qtquick-context2d.html#lineWidth-prop">lineWidth</a>, <a href="qml-qtquick-context2d.html#lineJoin-prop">lineJoin</a>, and <a href="qml-qtquick-context2d.html#miterLimit-prop">miterLimit</a>.</p>
</div></div><!-- @@@strokeRect -->
<br/>
<!-- $$$strokeText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="strokeText-method">
<td class="tblQmlFuncNode"><p>
<a name="strokeText-method"></a><span class="type">object</span> <span class="name">strokeText</span>(<i>text</i>, <i>x</i>, <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Strokes the given text at the given position.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#font-prop">font</a>, <a href="qml-qtquick-context2d.html#textAlign-prop">textAlign</a>, <a href="qml-qtquick-context2d.html#textBaseline-prop">textBaseline</a>, and <a href="qml-qtquick-context2d.html#fillText-method">fillText</a>.</p>
</div></div><!-- @@@strokeText -->
<br/>
<!-- $$$text -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="text-method">
<td class="tblQmlFuncNode"><p>
<a name="text-method"></a><span class="type">object</span> <span class="name">text</span>(<span class="type">string</span> <i>text</i>, <span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Adds the given <code>text</code> to the path as a set of closed subpaths created from the current context font supplied. The subpaths are positioned so that the left end of the text's baseline lies at the point specified by (<code>x</code>, <code>y</code>).</p>
</div></div><!-- @@@text -->
<br/>
<!-- $$$transform -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="transform-method">
<td class="tblQmlFuncNode"><p>
<a name="transform-method"></a><span class="type">object</span> <span class="name">transform</span>(<span class="type">real</span> <i>a</i>, <span class="type">real</span> <i>b</i>, <span class="type">real</span> <i>c</i>, <span class="type">real</span> <i>d</i>, <span class="type">real</span> <i>e</i>, <span class="type">real</span> <i>f</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This method is very similar to <a href="qml-qtquick-context2d.html#setTransform-method">setTransform()</a>, but instead of replacing the old transform matrix, this method applies the given tranform matrix to the current matrix by multiplying to it.</p>
<p>The <a href="qml-qtquick-context2d.html#setTransform-method">setTransform</a>(a, b, c, d, e, f) method actually resets the current transform to the identity matrix, and then invokes the transform(a, b, c, d, e, f) method with the same arguments.</p>
<p><b>See also </b><a href="qml-qtquick-context2d.html#setTransform-method">setTransform()</a>.</p>
</div></div><!-- @@@transform -->
<br/>
<!-- $$$translate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="translate-method">
<td class="tblQmlFuncNode"><p>
<a name="translate-method"></a><span class="type">object</span> <span class="name">translate</span>(<span class="type">real</span> <i>x</i>, <span class="type">real</span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Translates the origin of the canvas by a horizontal distance of <i>x</i>, and a vertical distance of <i>y</i>, in coordinate space units.</p>
<p>Translating the origin enables you to draw patterns of different objects on the canvas without having to measure the coordinates manually for each shape.</p>
</div></div><!-- @@@translate -->
<br/>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|