diff options
Diffstat (limited to 'html/en/func/lines.html')
-rw-r--r-- | html/en/func/lines.html | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/html/en/func/lines.html b/html/en/func/lines.html new file mode 100644 index 0000000..33dd7e4 --- /dev/null +++ b/html/en/func/lines.html @@ -0,0 +1,147 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + +<head> +<meta http-equiv="Content-Language" content="en-us"> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<title>Lines</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Lines</h2> + + <p>Line are segments that connects 2 or more points. The <strong>Line</strong> + function includes the 2 given points and draws the line using the foreground + color. Line thickness is controlled by the <strong>LineWidth</strong> function. + By using function <strong>LineStyle</strong> you can draw dashed lines with some + variations. Lines with a style other than continuous are affected by the back + opacity attribute and by the background color.</p> + +<hr> +<pre class="function"><span class="mainFunction">void <a name="cdLine">cdCanvasLine</a>(cdCanvas* canvas, int x1, int y1, int x2, int y2); [in C] +</span>void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2); [in C]<br>void wdCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2); (WC) [in C] + +canvas:Line(x1, y1, x2, y2: <em>number</em>) [in Lua] +canvas:fLine(x1, y1, x2, y2: <em>number</em>) [in Lua] +canvas:wLine(x1, y1, x2, y2: <em>number</em>)<font><font> (WC) [in Lua]</font></font></pre> + + <p>Draws a line from <b>(x1,y1)</b> to <tt><b>(x2,y2)</b></tt> using + the current foreground color and line width and style. Both points are + included in the line. </p> + +<pre class="function"><a name="Polygons"><strong>Polygons</strong></a><strong> and Bezier Lines</strong></pre> + + <p>Open polygons can be created using <font><strong>cdBegin(</strong></font><b>CD_OPEN_LINES</b><font><strong>)/cdVertex(x,y)/.../cdEnd()</strong></font>.</p> + <p>Closed polygons use the same number of vertices but the last point is + automatically connected to the first point. Closed polygons can be created + using <font><strong>cdBegin(</strong></font><tt><b>CD_CLOSED_LINES</b></tt><font><strong>)/cdVertex(x,y)/.../cdEnd()</strong></font>.</p> + <p>Bezier lines can be created using <font><strong>cdBegin(</strong></font><b>CD_BEZIER</b><font><strong>)/cdVertex(x,y)/.../cdEnd()</strong></font>. + At least 4 vertices must be defined. The two vertices of the middle are the + control vertices. A sequence of bezier lines can be defined using more 3 + vertices, two control points and an end point, the last point of the previous + bezier will be used as the start point.</p> + <p>See the documentation of <a href="polygon.html">cdBegin/cdVertex/cdEnd</a>.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdRect">cdCanvasRect</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); [in C]<br></span>void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); [in C] +void wdCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); (WC) [in C] + +canvas:Rect(xmin, xmax, ymin, ymax: <em>number</em>) [in Lua] +canvas:fRect(xmin, xmax, ymin, ymax: <em>number</em>) [in Lua]<br>canvas:wRect(xmin, xmax, ymin, ymax: <em>number</em>)<font><font> (WC) [in Lua]</font></font></pre> + + <p>Draws a rectangle with no filling. All points in the limits of interval + <font><strong>x_min<=x<=x_max, y_min<=y<=y_max</strong></font> + will be painted. It is affected by line attributes and the foreground color. + If the active driver does not include this primitive, it will be simulated + using the <strong><font>cdLine</font></strong> primitive.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdArc">cdCanvasArc</a></span><span class="mainFunction">(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2); [in C]<br></span>void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); [in C]<strong> +</strong>void wdCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); (WC) [in C] + +canvas:Arc(xc, yc, w, h, angle1, angle2: <em>number</em>) [in Lua] +canvas:fArc(xc, yc, w, h, angle1, angle2: <em>number</em>) [in Lua] +canvas:wArc(xc, yc, w, h, angle1, angle2: <em>number</em>)<font><font> (WC) [in Lua]</font></font></pre> + + <p>Draws the arc of an ellipse aligned with the axis, using the current + foreground color and line width and style. It is drawn counter-clockwise. The + coordinate <b>(xc,yc)</b> defines the center of the ellipse. + Dimensions <b>w</b> and <b>h</b> define the elliptic axes X + and Y, respectively. </p> + <p>Angles <b>angle1</b> and <b>angle2</b>, in degrees define + the arc's beginning and end, but they are not the angle relative to the + center, except when w==h and the ellipse is reduced to a circle. The arc + starts at the point <b><b>(xc+(w/2)*cos(angle1),yc+(h/2)*sin(angle1))</b> + </b>and ends at <b>(xc+(w/2)*cos(angle2),yc+(h/2)*sin(angle2))</b>. A + complete ellipse can be drawn using 0 and 360 as the angles. </p> + <p>The angles are specified so if the size of the ellipse (w x h) is changed, + its shape is preserved. So the angles relative to the center are dependent + from the ellipse size. The actual angle can be obtained using <b>rangle = + atan2((h/2</b><b>)*sin(angle),(w/2)*cos(angle))</b>.</p> + <p>The angles are given in degrees. To specify the angle in radians, you can + use the definition <font size="2"><strong>CD_RAD2DEG</strong></font> + to multiply the value in radians before passing the angle to CD.</p> + <p align="center"><font size="4">Arc Parameters<br> + </font> <img src="../../img/arc.gif" border="2" width="161" height="160"></p> + +<h3>Attributes</h3> +<pre class="function"><span class="mainFunction">int <a name="cdLineStyle">cdCanvasLineStyle</a>(cdCanvas* canvas, int style); [in C]</span> + +canvas:LineStyle(style: <em>number</em>) -> (old_style: <em>number</em>) [in Lua]</pre> + + <p>Configures the current line style for: <b>CD_CONTINUOUS</b>, <b>CD_DASHED</b>, + <b>CD_DOTTED</b>, <b>CD_DASH_DOT,</b> <b>CD_DASH_DOT_DOT,</b> or <tt><b>CD_CUSTOM</b></tt>. Returns the + previous value. Default value: <b>CD_CONTINUOUS</b>. Value <b><b> + CD_QUERY</b> </b>simply returns the current value. When <b>CD_CUSTOM</b> + is used the <b>cdLineStyleDahes</b> function must be called before to + initialize the custom dashes. The spaces are drawn with the background color, + except when back opacity is transparent then the background is left unchanged. + See <a href="filled.html#cdBackOpacity">BackOpacity</a>.</p> + <p align="center"><font size="4">Line Styles</font><br> + <img src="../../img/lines.gif" border="2" width="243" height="62"></p> + +<pre class="function"><span class="mainFunction">void <a name="cdLineStyleDashes">cdCanvasLineStyleDashes</a>(cdCanvas* canvas, const int* dashes, int count); [in C]</span> + +canvas:LineStyleDashes(dashes: table, count: number) -> (old_style: number) [in Lua]</pre> + + <p>Defines the custom line style dashes. The first value is the lenght of the + first dash, the second value is the leght of the first space, and so on. For + example: "10 2 5 2" means dash size 10, space size 2, dash size 5, space size + 2, and repeats the pattern. </p> + +<pre class="function"><span class="mainFunction">int <a name="cdLineWidth">cdCanvasLineWidth</a>(cdCanvas* canvas, int width); [in C]<br></span>double wdCanvasLineWidth(double width_mm); (WC) [in C] + +canvas:LineWidth(width: number) -> (old_width: number) [in Lua] +canvas:wLineWidth(width_mm: number) -> (old_width_mm: number) (WC) [in Lua]</pre> + + <p>Configures the width of the current line (in pixels). Returns the previous + value. Default value: 1. Value <b><b>CD_QUERY</b> </b>simply returns the + current value. Valid width interval: >= 1.</p> + <p>In WC, it configures the current line width in millimeters. </p> + +<pre class="function"><span class="mainFunction">int <a name="cdLineJoin">cdCanvasLineJoin</a>(cdCanvas* canvas, int style); [in C]</span> + +canvas:LineJoin(style: number) -> (old_style: number) [in Lua]</pre> + + <p>Configures the current line style for: <b>CD_MITER</b>, <b> + CD_BEVEL</b> or <tt><b>CD_ROUND</b></tt>. Returns the previous value. + Default value: <b>CD_MITER</b>. Value <b><b>CD_QUERY</b> </b>simply + returns the current value.</p> + <p align="center"><font size="4">Line Joins</font><br> + <img src="../../img/linejoin.gif" border="2" width="111" height="138"></p> + +<pre class="function"><span class="mainFunction">int <a name="cdLineCap">cdCanvasLineCap</a>(cdCanvas* canvas, int style); [in C]</span> + +canvas:LineCap(style: number) -> (old_style: number) [in Lua]</pre> + + <p>Configures the current line style for: <b>CD_CAPFLAT</b>, <b> + CD_CAPSQUARE</b> or <tt><b>CD_CAPROUND</b></tt>. Returns the previous + value. Default value: <b>CD_CAPFLAT</b>. Value <b><b>CD_QUERY</b> + </b>simply returns the current value.</p> + <p align="center"><font size="4">Line Caps</font><br> + <img src="../../img/linecap.gif" border="2" width="211" height="166"></p> + + +</body> + +</html> |