blob: 807f7e4cb538e15e54380d4f2a340f3fc922fad7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>SGL: SkPath.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.0 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">include</a>&nbsp;/&nbsp;<a class="el" href="dir_000001.html">skia</a></div>
<h1>SkPath.h</h1><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef SkPath_DEFINED</span>
00002 <span class="preprocessor"></span><span class="preprocessor">#define SkPath_DEFINED</span>
00003 <span class="preprocessor"></span>
00004 <span class="preprocessor">#include "SkMatrix.h"</span>
00005 <span class="preprocessor">#include "SkTDArray.h"</span>
00006
<a name="l00012"></a><a class="code" href="classSkPath.html">00012</a> <span class="keyword">class </span><a class="code" href="classSkPath.html">SkPath</a> {
00013 <span class="keyword">public</span>:
00014 <a class="code" href="classSkPath.html">SkPath</a>();
00015 <a class="code" href="classSkPath.html">SkPath</a>(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;);
00016 ~<a class="code" href="classSkPath.html">SkPath</a>();
00017
00018 <a class="code" href="classSkPath.html">SkPath</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;);
00019
<a name="l00020"></a><a class="code" href="classSkPath.html#w12">00020</a> <span class="keyword">enum</span> <a class="code" href="classSkPath.html#w12">FillType</a> {
00021 <a class="code" href="classSkPath.html#w12w0">kWinding_FillType</a>,
00022 <a class="code" href="classSkPath.html#w12w1">kEvenOdd_FillType</a>
00023 };
<a name="l00027"></a><a class="code" href="classSkPath.html#a4">00027</a> <a class="code" href="classSkPath.html#w12">FillType</a> <a class="code" href="classSkPath.html#a4">getFillType</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="classSkPath.html#w12">FillType</a>)fFillType; }
<a name="l00031"></a><a class="code" href="classSkPath.html#a5">00031</a> <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a5">setFillType</a>(FillType ft) { fFillType = SkToU8(ft); }
00032
00036 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a6">reset</a>();
00039 <span class="keywordtype">bool</span> <a class="code" href="classSkPath.html#a7">isEmpty</a>() <span class="keyword">const</span>;
00046 <span class="keywordtype">bool</span> <a class="code" href="classSkPath.html#a8">isRect</a>(SkRect* rect) <span class="keyword">const</span>;
00052 <span class="keywordtype">int</span> <a class="code" href="classSkPath.html#a9">getPoints</a>(SkPoint points[], <span class="keywordtype">int</span> max) <span class="keyword">const</span>;
00054 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a10">swap</a>(<a class="code" href="classSkPath.html">SkPath</a>&amp; other);
00055
<a name="l00056"></a><a class="code" href="classSkPath.html#w13">00056</a> <span class="keyword">enum</span> <a class="code" href="classSkPath.html#w13">BoundsType</a> {
00057 <a class="code" href="classSkPath.html#w13w2">kFast_BoundsType</a>,
00058 <a class="code" href="classSkPath.html#w13w3">kExact_BoundsType</a>
00059 };
00063 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a11">computeBounds</a>(SkRect* bounds, BoundsType btype) <span class="keyword">const</span>;
00064
00065 <span class="comment">// Construction methods</span>
00066
00067 <span class="keywordtype">void</span> incReserve(U16CPU extraPtCount);
00068
00071 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a13">moveTo</a>(SkScalar x, SkScalar y);
00075 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a14">rMoveTo</a>(SkScalar x, SkScalar y);
00079 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a15">lineTo</a>(SkScalar x, SkScalar y);
00083 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a16">rLineTo</a>(SkScalar x, SkScalar y);
00088 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a17">quadTo</a>(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2);
00092 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a18">rQuadTo</a>(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2);
00097 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a19">cubicTo</a>(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3);
00101 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a20">rCubicTo</a>(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3);
00105 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a21">close</a>();
00106
00107 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a13">moveTo</a>(<span class="keyword">const</span> SkPoint&amp; p)
00108 {
00109 this-&gt;<a class="code" href="classSkPath.html#a13">moveTo</a>(p.fX, p.fY);
00110 }
00111 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a15">lineTo</a>(<span class="keyword">const</span> SkPoint&amp; p1)
00112 {
00113 this-&gt;<a class="code" href="classSkPath.html#a15">lineTo</a>(p1.fX, p1.fY);
00114 }
00115 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a17">quadTo</a>(<span class="keyword">const</span> SkPoint&amp; p1, <span class="keyword">const</span> SkPoint&amp; p2)
00116 {
00117 this-&gt;<a class="code" href="classSkPath.html#a17">quadTo</a>(p1.fX, p1.fY, p2.fX, p2.fY);
00118 }
00119 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a19">cubicTo</a>(<span class="keyword">const</span> SkPoint&amp; p1, <span class="keyword">const</span> SkPoint&amp; p2, <span class="keyword">const</span> SkPoint&amp; p3)
00120 {
00121 this-&gt;<a class="code" href="classSkPath.html#a19">cubicTo</a>(p1.fX, p1.fY, p2.fX, p2.fY, p3.fX, p3.fY);
00122 }
00123
<a name="l00124"></a><a class="code" href="classSkPath.html#w14">00124</a> <span class="keyword">enum</span> <a class="code" href="classSkPath.html#w14">Direction</a> {
00125 <a class="code" href="classSkPath.html#w14w4">kCW_Direction</a>,
00126 <a class="code" href="classSkPath.html#w14w5">kCCW_Direction</a>
00127 };
00130 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a26">addRect</a>(<span class="keyword">const</span> SkRect&amp;, Direction dir = kCW_Direction);
00133 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a27">addOval</a>(<span class="keyword">const</span> SkRect&amp;, Direction dir = kCW_Direction);
00136 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a28">addCircle</a>(SkScalar x, SkScalar y, SkScalar radius, Direction dir = kCW_Direction);
00139 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a29">addRoundRect</a>(<span class="keyword">const</span> SkRect&amp;, SkScalar rx, SkScalar ry, Direction dir = kCW_Direction);
00142 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a30">addPath</a>(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp; src, SkScalar dx, SkScalar dy);
<a name="l00145"></a><a class="code" href="classSkPath.html#a31">00145</a> <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a30">addPath</a>(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp; src) { SkMatrix m; m.reset(); this-&gt;<a class="code" href="classSkPath.html#a30">addPath</a>(src, m); }
00148 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a30">addPath</a>(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp; src, <span class="keyword">const</span> SkMatrix&amp; matrix);
00149
00152 <span class="keywordtype">bool</span> <a class="code" href="classSkPath.html#a33">offset</a>(SkScalar dx, SkScalar dy);
00156 <span class="keywordtype">bool</span> <a class="code" href="classSkPath.html#a34">transform</a>(<span class="keyword">const</span> SkMatrix&amp;, <a class="code" href="classSkPath.html">SkPath</a>* dst) <span class="keyword">const</span>;
<a name="l00160"></a><a class="code" href="classSkPath.html#a35">00160</a> <span class="keywordtype">bool</span> <a class="code" href="classSkPath.html#a34">transform</a>(<span class="keyword">const</span> SkMatrix&amp; map)
00161 {
00162 <span class="keywordflow">return</span> this-&gt;<a class="code" href="classSkPath.html#a34">transform</a>(map, <span class="keyword">this</span>);
00163 }
00164
00167 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a36">getLastPt</a>(SkPoint* lastPt) <span class="keyword">const</span>;
00170 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a37">setLastPt</a>(SkScalar x, SkScalar y);
00171 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a37">setLastPt</a>(<span class="keyword">const</span> SkPoint&amp; pt) { this-&gt;<a class="code" href="classSkPath.html#a37">setLastPt</a>(pt.fX, pt.fY); }
00172
<a name="l00173"></a><a class="code" href="classSkPath.html#w15">00173</a> <span class="keyword">enum</span> <a class="code" href="classSkPath.html#w15">Verb</a> {
00174 <a class="code" href="classSkPath.html#w15w6">kMove_Verb</a>,
00175 <a class="code" href="classSkPath.html#w15w7">kLine_Verb</a>,
00176 <a class="code" href="classSkPath.html#w15w8">kQuad_Verb</a>,
00177 <a class="code" href="classSkPath.html#w15w9">kCubic_Verb</a>,
00178 <a class="code" href="classSkPath.html#w15w10">kClose_Verb</a>,
00179 <a class="code" href="classSkPath.html#w15w11">kDone_Verb</a>
00180 };
<a name="l00184"></a><a class="code" href="classSkPath_1_1Iter.html">00184</a> <span class="keyword">class </span><a class="code" href="classSkPath_1_1Iter.html">Iter</a> {
00185 <span class="keyword">public</span>:
00186 <a class="code" href="classSkPath_1_1Iter.html">Iter</a>();
00187 <a class="code" href="classSkPath_1_1Iter.html">Iter</a>(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;, <span class="keywordtype">bool</span> forceClose);
00188 <span class="keywordtype">void</span> setPath(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;, <span class="keywordtype">bool</span> forceClose);
00189
00190 Verb next(SkPoint pts[4]);
00191
<a name="l00198"></a><a class="code" href="classSkPath_1_1Iter.html#a4">00198</a> <span class="keywordtype">bool</span> <a class="code" href="classSkPath_1_1Iter.html#a4">isCloseLine</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> SkToBool(fCloseLine); }
00199
00200 <span class="comment">//* returns true if the current contour is closed (has a kClose_Verb)</span>
00201 <span class="keywordtype">bool</span> isClosedContour() <span class="keyword">const</span>;
00202
00203 <span class="keyword">private</span>:
00204 <span class="keyword">const</span> SkPoint* fPts;
00205 <span class="keyword">const</span> U8* fVerbs;
00206 <span class="keyword">const</span> U8* fVerbStop;
00207 SkPoint fMoveTo;
00208 SkPoint fLastPt;
00209 U8 fForceClose;
00210 U8 fNeedClose;
00211 U8 fNeedMoveTo;
00212 U8 fCloseLine;
00213
00214 <span class="keywordtype">bool</span> cons_moveTo(SkPoint pts[1]);
00215 Verb autoClose(SkPoint pts[2]);
00216 };
00217
00218 <span class="preprocessor">#ifdef SK_DEBUG</span>
00219 <span class="preprocessor"></span>
00220 <span class="keywordtype">void</span> dump(<span class="keywordtype">bool</span> forceClose, <span class="keyword">const</span> <span class="keywordtype">char</span> title[] = nil) <span class="keyword">const</span>;
00221 <span class="keyword">static</span> <span class="keywordtype">void</span> UnitTest();
00223 <span class="preprocessor">#endif</span>
00224 <span class="preprocessor"></span>
00230 U32 <a class="code" href="classSkPath.html#a39">flatten</a>(<span class="keywordtype">void</span>* bufferOrNil) <span class="keyword">const</span>;
00231 <span class="keywordtype">void</span> unflatten(<span class="keyword">const</span> <span class="keywordtype">void</span>* buffer);
00232
00237 <span class="keywordtype">void</span> <a class="code" href="classSkPath.html#a41">subdivide</a>(SkScalar dist, <span class="keywordtype">bool</span> bendLines, <a class="code" href="classSkPath.html">SkPath</a>* dst = nil) <span class="keyword">const</span>;
00238
00239 <span class="keyword">private</span>:
00240 SkTDArray&lt;SkPoint&gt; fPts;
00241 SkTDArray&lt;U8&gt; fVerbs;
00242 U8 fFillType;
00243
00244 <span class="keyword">friend</span> <span class="keyword">class </span>Iter;
00245 <span class="keywordtype">void</span> cons_moveto();
00246
00247 <span class="keyword">friend</span> <span class="keyword">class </span>SkPathStroker;
00248 <span class="comment">/* Append the first contour of path, ignoring path's initial point.</span>
00249 <span class="comment"> If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).</span>
00250 <span class="comment"> */</span>
00251 <span class="keywordtype">void</span> pathTo(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp; path);
00252 <span class="comment">/* Append, in reverse order, the first contour of path, ignoring path's last point.</span>
00253 <span class="comment"> If no moveTo() call has been made for this contour, the first point is automatically set to (0,0).</span>
00254 <span class="comment"> */</span>
00255 <span class="keywordtype">void</span> reversePathTo(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;);
00256
00257 <span class="keyword">friend</span> <span class="keyword">const</span> SkPoint* sk_get_path_points(<span class="keyword">const</span> <a class="code" href="classSkPath.html">SkPath</a>&amp;, <span class="keywordtype">int</span> index);
00258 };
00259
00260 <span class="preprocessor">#endif</span>
00261 <span class="preprocessor"></span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Tue May 9 14:35:23 2006 for SGL by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.0 </small></address>
</body>
</html>