/usr/share/qt5/doc/qtquick/qtquick-canvas-example.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- canvas.qdoc -->
<title>Qt Quick Examples - Canvas | Qt Quick 5.5</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li>Qt Quick Examples - Canvas</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</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="#running-the-example">Running the Example</a></li>
<li class="level1"><a href="#red-heart">Red Heart</a></li>
<li class="level1"><a href="#talk-bubble">Talk Bubble</a></li>
<li class="level1"><a href="#squircle">Squircle</a></li>
<li class="level1"><a href="#rounded-rectangle">Rounded Rectangle</a></li>
<li class="level1"><a href="#smile-face">Smile Face</a></li>
<li class="level1"><a href="#clip">Clip</a></li>
<li class="level1"><a href="#tiger">Tiger</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Qt Quick Examples - Canvas</h1>
<span class="subtitle"></span>
<!-- $$$canvas-description -->
<div class="descr"> <a name="details"></a>
<p class="centerAlign"><img src="images/qml-canvas-example.png" alt="" /></p><p><i>Canvas</i> is a collection of small QML examples relating to the <a href="qml-qtquick-canvas.html">Canvas</a> type. Each example is a small QML file emphasizing a particular type or feature.</p>
<a name="running-the-example"></a>
<h2 id="running-the-example">Running the Example</h2>
<p>To run the example from Qt Creator, open the <b>Welcome</b> mode and select the example from <b>Examples</b>. For more information, visit Building and Running an Example.</p>
<a name="red-heart"></a>
<h2 id="red-heart">Red Heart</h2>
<p><i>Red heart</i> uses the bezier curve API to stroke and fill a red heart.</p>
<pre class="qml"><span class="name">ctx</span>.<span class="name">beginPath</span>();
<span class="name">ctx</span>.<span class="name">moveTo</span>(<span class="number">75</span>,<span class="number">40</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">75</span>,<span class="number">37</span>,<span class="number">70</span>,<span class="number">25</span>,<span class="number">50</span>,<span class="number">25</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">20</span>,<span class="number">25</span>,<span class="number">20</span>,<span class="number">62.5</span>,<span class="number">20</span>,<span class="number">62.5</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">20</span>,<span class="number">80</span>,<span class="number">40</span>,<span class="number">102</span>,<span class="number">75</span>,<span class="number">120</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">110</span>,<span class="number">102</span>,<span class="number">130</span>,<span class="number">80</span>,<span class="number">130</span>,<span class="number">62.5</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">130</span>,<span class="number">62.5</span>,<span class="number">130</span>,<span class="number">25</span>,<span class="number">100</span>,<span class="number">25</span>);
<span class="name">ctx</span>.<span class="name">bezierCurveTo</span>(<span class="number">85</span>,<span class="number">25</span>,<span class="number">75</span>,<span class="number">37</span>,<span class="number">75</span>,<span class="number">40</span>);
<span class="name">ctx</span>.<span class="name">closePath</span>();</pre>
<a name="talk-bubble"></a>
<h2 id="talk-bubble">Talk Bubble</h2>
<p><i>Talk bubble</i> uses the quadraticCurveTo() API to stroke and fill a customized talk bubble:</p>
<pre class="qml"><span class="name">ctx</span>.<span class="name">beginPath</span>();
<span class="name">ctx</span>.<span class="name">moveTo</span>(<span class="number">75</span>,<span class="number">25</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">25</span>,<span class="number">25</span>,<span class="number">25</span>,<span class="number">62.5</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">25</span>,<span class="number">100</span>,<span class="number">50</span>,<span class="number">100</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">50</span>,<span class="number">120</span>,<span class="number">30</span>,<span class="number">125</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">60</span>,<span class="number">120</span>,<span class="number">65</span>,<span class="number">100</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">125</span>,<span class="number">100</span>,<span class="number">125</span>,<span class="number">62.5</span>);
<span class="name">ctx</span>.<span class="name">quadraticCurveTo</span>(<span class="number">125</span>,<span class="number">25</span>,<span class="number">75</span>,<span class="number">25</span>);
<span class="name">ctx</span>.<span class="name">closePath</span>();</pre>
<p>This example also demonstrates the fillText() API:</p>
<pre class="qml"><span class="name">ctx</span>.<span class="name">fillStyle</span> <span class="operator">=</span> <span class="string">"white"</span>;
<span class="name">ctx</span>.<span class="name">font</span> <span class="operator">=</span> <span class="string">"bold 17px sans-serif"</span>;
<span class="name">ctx</span>.<span class="name">fillText</span>(<span class="string">"Qt Quick"</span>, <span class="number">40</span>, <span class="number">70</span>);</pre>
<a name="squircle"></a>
<h2 id="squircle">Squircle</h2>
<p><i>Squircle</i> uses a collection of simple moveTo() and lineTo() path APIs to draw a smooth squircle.</p>
<a name="rounded-rectangle"></a>
<h2 id="rounded-rectangle">Rounded Rectangle</h2>
<p><i>Rounded rectangle</i> uses a collection of lineTo() and arcTo() path APIs to draw a rounded rectangle.</p>
<a name="smile-face"></a>
<h2 id="smile-face">Smile Face</h2>
<p><i>Smile face</i> uses several paths to draw and fill a smiling face.</p>
<a name="clip"></a>
<h2 id="clip">Clip</h2>
<p><i>Clip</i> uses the clip API to clip a given image.</p>
<pre class="qml"><span class="name">ctx</span>.<span class="name">clip</span>();
<span class="name">ctx</span>.<span class="name">drawImage</span>(<span class="name">canvas</span>.<span class="name">imagefile</span>, <span class="number">0</span>, <span class="number">0</span>);</pre>
<a name="tiger"></a>
<h2 id="tiger">Tiger</h2>
<p><i>Tiger</i> uses the SVG path API to draw a tiger with a collection of SVG path strings.</p>
<pre class="qml"><span class="keyword">for</span> (<span class="keyword">var</span> <span class="name">i</span> = <span class="number">0</span>; <span class="name">i</span> <span class="operator"><</span> <span class="name">Tiger</span>.<span class="name">tiger</span>.<span class="name">length</span>; i++) {
<span class="keyword">if</span> (<span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">width</span> <span class="operator">!=</span> <span class="name">undefined</span>)
<span class="name">ctx</span>.<span class="name">lineWidth</span> <span class="operator">=</span> <span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">width</span>;
<span class="keyword">if</span> (<span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">path</span> <span class="operator">!=</span> <span class="name">undefined</span>)
<span class="name">ctx</span>.<span class="name">path</span> <span class="operator">=</span> <span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">path</span>;
<span class="keyword">if</span> (<span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">fill</span> <span class="operator">!=</span> <span class="name">undefined</span>) {
<span class="name">ctx</span>.<span class="name">fillStyle</span> <span class="operator">=</span> <span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">fill</span>;
<span class="name">ctx</span>.<span class="name">fill</span>();
}
<span class="keyword">if</span> (<span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">stroke</span> <span class="operator">!=</span> <span class="name">undefined</span>) {
<span class="name">ctx</span>.<span class="name">strokeStyle</span> <span class="operator">=</span> <span class="name">Tiger</span>.<span class="name">tiger</span>[<span class="name">i</span>].<span class="name">stroke</span>;
<span class="name">ctx</span>.<span class="name">stroke</span>();
}
}</pre>
<p>Files:</p>
<ul>
<li><a href="qtquick-canvas-canvas-qml.html">canvas/canvas.qml</a></li>
<li><a href="qtquick-canvas-beziercurve-beziercurve-qml.html">canvas/bezierCurve/bezierCurve.qml</a></li>
<li><a href="qtquick-canvas-clip-clip-qml.html">canvas/clip/clip.qml</a></li>
<li><a href="qtquick-canvas-quadraticcurveto-quadraticcurveto-qml.html">canvas/quadraticCurveTo/quadraticCurveTo.qml</a></li>
<li><a href="qtquick-canvas-roundedrect-roundedrect-qml.html">canvas/roundedrect/roundedrect.qml</a></li>
<li><a href="qtquick-canvas-smile-smile-qml.html">canvas/smile/smile.qml</a></li>
<li><a href="qtquick-canvas-squircle-squircle-qml.html">canvas/squircle/squircle.qml</a></li>
<li><a href="qtquick-canvas-tiger-tiger-js.html">canvas/tiger/tiger.js</a></li>
<li><a href="qtquick-canvas-tiger-tiger-qml.html">canvas/tiger/tiger.qml</a></li>
<li><a href="qtquick-canvas-main-cpp.html">canvas/main.cpp</a></li>
<li><a href="qtquick-canvas-canvas-pro.html">canvas/canvas.pro</a></li>
<li><a href="qtquick-canvas-canvas-qrc.html">canvas/canvas.qrc</a></li>
</ul>
</div>
<!-- @@@canvas -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 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>
|