diff options
author | scuri <scuri> | 2010-05-22 00:14:01 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-05-22 00:14:01 +0000 |
commit | a089059af0f396f778df1b56e0e292416bc35d6b (patch) | |
tree | 07a83c2eb23a9fa47dd0d722d92363c517d1f32e /html/en/func | |
parent | 95a0b9f784c2c4eddd86e51eac3a1ae9394cdf49 (diff) |
*** empty log message ***
Diffstat (limited to 'html/en/func')
-rw-r--r-- | html/en/func/polygon.html | 85 |
1 files changed, 58 insertions, 27 deletions
diff --git a/html/en/func/polygon.html b/html/en/func/polygon.html index 4ab5834..3a0b9c0 100644 --- a/html/en/func/polygon.html +++ b/html/en/func/polygon.html @@ -1,16 +1,11 @@ <!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> +<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Polygons</title> <link rel="stylesheet" type="text/css" href="../../style.css"> -<style type="text/css"> -.style1 { - font-family: Courier; -} -</style> </head> <body> @@ -66,6 +61,10 @@ canvas:Begin(mode: number) [in Lua]</pre> <strong>cdChord, Filled</strong></font> <font><strong>Polygons</strong></font> and <font><strong>cdText</strong></font> will be composed in a region for clipping. See <a href="region.html">Regions</a> documentation.</li> + <li><strong>CD_PATH</strong>: creates a path composed of several primitives + that can be line draw, filled or used as clipping. Must call <strong> + cdCanvasPathSet</strong> to configure the action between sequences of + <strong>cdCanvasVertex</strong>.</li> </ul> <p align="center"><font size="4">Open, Closed and Filled Polygons<br> </font><img src="../../img/polygon.gif" border="2" width="249" height="116"></p> @@ -87,31 +86,63 @@ canvas:End() [in Lua]</pre> <p>Ends the polygon's definition and draws it.</p> -<p> </p> -"<span class="style1"><strong>PATH</strong></span>": allows to create - a complex path using CD primitives and then fill, stroke or clip using the - new path. Must be used with the following parameters:<ul> - <li>"BEGIN" - creates a new empty path, must be the first call</li> - <li>cdCanvasPixel, cdCanvasLine, cdCanvasArc - add elements to the path - instead of drawing to the canvas</li> - <li>"FILL" - closes the path, and fills it with the current fill attributes, - then the path is discarded</li> - <li>"STROKE" - strokes the path with the current line attributes, then the - path is discarded</li> - <li>"CLOSESTROKE" - closes the path, and strokes it with the current line - attributes, then the path is discarded</li> - <li>"FILLSTROKE" - closes the path, and fills it with the current fill +<pre class="function"><span class="mainFunction">void <a name="cdEnd0">cdCanvasPathSet</a>(cdCanvas* canvas, int action); [in C]</span> + +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> CD_PATH_NEW - 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. + 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 + the given coordinates. The current position is updated to the 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 + 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 + angles must be multiplied by 1000.</li> + <li>CD_PATH_CURVETO - 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 + with the first point of the path, closing it.</li> + <li>CD_PATH_FILL - 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 + path is discarded.</li> + <li>CD_PATH_FILLSTROKE - fills the path with the current fill attributes, strokes the path with the current line attributes, then the path - is discarded</li> - <li>"CLIP" - closes the path, and use it as a clipping area to be - intersected with the current clipping area, then the path is discarded</li> - <li>"NULL" - discards the path and ends the process without any output.</li> - <li>ARC - If there is a current point an additional straight line is drawn - from the current point to the starting point of the arc. The endpoint of the - arc becomes the new current point. </li> + is discarded.</li> + <li>CD_PATH_CLIP - use the path as a clipping area to be + intersected with the current clipping area, then the path is discarded.</li> </ul> +<p>So the normal path creation to draw a line will do:</p> +<pre>cdCanvasBegin(canvas, CD_PATH); +cdCanvasPathSet(canvas, CD_PATH_MOVETO); +cdCanvasVertex(canvas, x1, y1); +cdCanvasPathSet(canvas, CD_PATH_LINETO); +cdCanvasVertex(canvas, x2, y2); +cdCanvasPathSet(canvas, CD_PATH_STROKE); +cdCanvasEnd(canvas);</pre> + + </body> </html> |