summaryrefslogtreecommitdiff
path: root/html/en/func/polygon.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/en/func/polygon.html')
-rw-r--r--html/en/func/polygon.html31
1 files changed, 20 insertions, 11 deletions
diff --git a/html/en/func/polygon.html b/html/en/func/polygon.html
index 3a0b9c0..c2acb9a 100644
--- a/html/en/func/polygon.html
+++ b/html/en/func/polygon.html
@@ -93,42 +93,43 @@ canvas:PathSet(action: number) [in Lua]</pre>
<p>Configures the action between sequences of <strong>cdCanvasVertex</strong>.
<strong>action</strong> can be:</p>
<ul>
- <li>&nbsp;CD_PATH_NEW - creates a new empty path. Useful if more than one
+ <li>&nbsp;<strong>CD_PATH_NEW</strong> - creates a new empty path. Useful if more than one
path is configured. <strong>cdCanvasBegin</strong>(CD_PATH) already creates
a new path.</li>
- <li>CD_PATH_MOVETO - moves the current position to the given coordinates.
+ <li><strong>CD_PATH_MOVETO</strong> - moves the current position to the given coordinates.
Must be followed by 1 call to <strong>cdCanvasVertex</strong>, <strong>
cdfCanvasVertex</strong>, or <strong>wdCanvasVertex</strong>.</li>
- <li>CD_PATH_LINETO - adds a line to the path from the current position to
+ <li><strong>CD_PATH_LINETO</strong> - adds a line to the path from the current position to
the given coordinates. The current position is updated to the&nbsp; given
coordinates. If there is no current position, nothing is connected and only
the current position is updated. Must be followed by 1 call to <strong>
cdCanvasVertex</strong>, <strong>cdfCanvasVertex</strong>, or <strong>
wdCanvasVertex</strong>.</li>
- <li>CD_PATH_ARC - adds an arc to the path. If there is a current position
+ <li><strong>CD_PATH_ARC</strong> - adds an arc to the path. If there is a current position
adds also a line from the current position to the start of the arc. The end
of the arc becomes the current position. Must be followed by 3 calls to
<strong>cdCanvasVertex</strong>, <strong>cdfCanvasVertex</strong>, or
<strong>wdCanvasVertex</strong>. One for the center of the arc (xc,yc), one
for the bounding rectangle size (w,h), and one for the start and end angles
- (angle1,angle2). Angles are in degrees. When using integer coordinates
+ (angle1,angle2). Angles are in degrees and oriented counter-clockwise, but
+ angle2 can be smaller than angle1 to describe a clockwise arc. When using integer coordinates
angles must be multiplied by 1000.</li>
- <li>CD_PATH_CURVETO - adds a bezier curve to the path. If there is no
+ <li><strong>CD_PATH_CURVETO</strong> - adds a bezier curve to the path. If there is no
current position, the first point will be used twice. The end point becomes
the current position. Must be followed by 3 calls to <strong>cdCanvasVertex</strong>,
<strong>cdfCanvasVertex</strong>, or <strong>wdCanvasVertex</strong>. Must
be first control point (x1,y1) + second control point (x2,y2) + end point
(x3,y3).</li>
- <li>CD_PATH_CLOSE - adds a line to the path that connects the last point
+ <li><strong>CD_PATH_CLOSE</strong> - adds a line to the path that connects the last point
with the first point of the path, closing it.</li>
- <li>CD_PATH_FILL - fills the path with the current fill attributes,
+ <li><strong>CD_PATH_FILL</strong> - fills the path with the current fill attributes,
then the path is discarded.</li>
- <li>CD_PATH_STROKE - strokes the path with the current line attributes, then the
+ <li><strong>CD_PATH_STROKE</strong> - strokes the path with the current line attributes, then the
path is discarded.</li>
- <li>CD_PATH_FILLSTROKE - fills the path with the current fill
+ <li><strong>CD_PATH_FILLSTROKE</strong> - fills the path with the current fill
attributes, strokes the path with the current line attributes, then the path
is discarded.</li>
- <li>CD_PATH_CLIP - use the path as a clipping area to be
+ <li><strong>CD_PATH_CLIP</strong> - use the path as a clipping area to be
intersected with the current clipping area, then the path is discarded.</li>
</ul>
@@ -139,6 +140,14 @@ cdCanvasPathSet(canvas, CD_PATH_MOVETO);
cdCanvasVertex(canvas, x1, y1);
cdCanvasPathSet(canvas, CD_PATH_LINETO);
cdCanvasVertex(canvas, x2, y2);
+cdCanvasPathSet(canvas, CD_PATH_CURVETO);
+cdCanvasVertex(canvas, x3, y3); /* control point for start point */
+cdCanvasVertex(canvas, x4, y4); /* control point for end point */
+cdCanvasVertex(canvas, x5, y5); /* end point */
+cdCanvasPathSet(canvas, CD_PATH_ARC);
+cdCanvasVertex(canvas, x6, y6); /* center */
+cdCanvasVertex(canvas, x7, y7); /* width, height */
+cdCanvasVertex(canvas, x8, y8); /* start angle, end angle (degrees / 1000) */
cdCanvasPathSet(canvas, CD_PATH_STROKE);
cdCanvasEnd(canvas);</pre>