diff options
Diffstat (limited to 'html/en/func')
-rw-r--r-- | html/en/func/attributes.html | 49 | ||||
-rw-r--r-- | html/en/func/client.html | 255 | ||||
-rw-r--r-- | html/en/func/clipping.html | 62 | ||||
-rw-r--r-- | html/en/func/color.html | 137 | ||||
-rw-r--r-- | html/en/func/control.html | 63 | ||||
-rw-r--r-- | html/en/func/coordinates.html | 148 | ||||
-rw-r--r-- | html/en/func/filled.html | 272 | ||||
-rw-r--r-- | html/en/func/init.html | 225 | ||||
-rw-r--r-- | html/en/func/lines.html | 147 | ||||
-rw-r--r-- | html/en/func/marks.html | 85 | ||||
-rw-r--r-- | html/en/func/other.html | 119 | ||||
-rw-r--r-- | html/en/func/polygon.html | 87 | ||||
-rw-r--r-- | html/en/func/region.html | 83 | ||||
-rw-r--r-- | html/en/func/server.html | 84 | ||||
-rw-r--r-- | html/en/func/text.html | 192 | ||||
-rw-r--r-- | html/en/func/vectortext.html | 133 | ||||
-rw-r--r-- | html/en/func/wd.html | 80 |
17 files changed, 2221 insertions, 0 deletions
diff --git a/html/en/func/attributes.html b/html/en/func/attributes.html new file mode 100644 index 0000000..60768e4 --- /dev/null +++ b/html/en/func/attributes.html @@ -0,0 +1,49 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>General Attributes</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">General Attributes</h2> + <pre class="function"><span class="mainFunction">long int <a name="cdForeground">cdCanvasForeground</a>(cdCanvas* canvas, long int color); [in C]</span> +void cdCanvasSetForeground(cdCanvas* canvas, long int color); [in C] + +canvas:Foreground(color: lightuserdata) -> (old_color: lightuserdata) [in Lua] +canvas:SetForeground(color: lightuserdata) [in Lua]</pre> + <p>Configures a new current foreground color and returns the previous one. This + color is used in all primitives (lines, areas, marks and text). Default value: <b> + <tt>CD_BLACK</tt></b>. Value <tt><b>CD_QUERY</b> </tt>simply returns the + current value.</p> + <p>Notice that CD_QUERY conflicts with color RGBA=(255,255,255,255) (full + transparent white). Use <strong>SetForeground</strong> to avoid the + conflict. See also <a href="color.html">Color Coding</a>.</p> + <pre class="function"><span class="mainFunction">long int <a name="cdBackground">cdCanvasBackground</a>(cdCanvas* canvas, long int color); [in C]</span> +void cdCanvasSetBackground(cdCanvas* canvas, long int color); [in C] + +canvas:Background(color: lightuserdata) -> (old_color: lightuserdata) [in Lua] +canvas:SetBackground(color: lightuserdata) [in Lua]</pre> + <p>Configures the new current background color and returns the previous one. + However, it does not automatically change the background of a canvas. For such, + it is necessary to call the <strong>Clear</strong> function. The + background color only makes sense for <strong>Clear</strong><tt><font> </font></tt>and for + primitives affected by the background opacity attribute. Default value: <b><tt>CD_WHITE</tt></b>. + Value <tt><b>CD_QUERY</b> </tt>simply returns the current value.</p> + <p>Notice that CD_QUERY conflicts with color RGBA=(255,255,255,255) (full + transparent white). Use <strong>SetBackground</strong> to avoid the + conflict. See also <a href="color.html">Color Coding</a>.</p> + <pre class="function"><span class="mainFunction">int <a name="cdWriteMode">cdCanvasWriteMode</a>(cdCanvas* canvas, int mode); [in C]</span> + +canvas:WriteMode(mode: number) -> (old_mode: number) [in Lua]</pre> + <p>Defines the writing type for all drawing primitives. Values: <b><tt>CD_REPLACE</tt></b>, + <b><tt>CD_XOR</tt></b> or <b><tt>CD_NOT_XOR</tt></b>. Returns the previous + value. Default value: <b><tt>CD_REPLACE</tt></b>. Value <tt><b>CD_QUERY</b> </tt> + simply returns the current value. + </p> + <p>Note: operation XOR is very useful, because, using white as the foreground + color and drawing the same image twice, you can go back to the original color, + before the drawing. This is commonly used for mouse selection feedback.</p> + </body> +</html> diff --git a/html/en/func/client.html b/html/en/func/client.html new file mode 100644 index 0000000..20a6c4e --- /dev/null +++ b/html/en/func/client.html @@ -0,0 +1,255 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Client Images</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">Client Images</h2> + <p>There are 2 kinds of client images: RGB and Indexed RGB (or MAP). The RGB + image is composed by 3 buffers: red, green and blue (more colors, more memory). + The MAP image is composed by 1 buffer of indices for a table and one table of + encoded RGB values (less colors, less memory). + </p> + <p>The image buffer is described by its width and height in pixels. The starting + point of the buffer is the origin of the image, which is located at its bottom + left corner. To retrieve a pixel in the image, use the formula <font>pixel(x,y)=buffer[y*width + + x]</font>. + </p> + <p>The Put functions may do zoom in or out; zero order interpolation is used to + scale the image. It is not possible to specify a part of the image to be drawn.</p> + <hr> + <pre class="function"><span class="mainFunction">void <a name="cdGetImageRGB">cdCanvasGetImageRGB</a>(cdCanvas* canvas, unsigned char *r, + unsigned char *g, + unsigned char *b, + int x, int y, int w, int h); [in C]</span> + +canvas:GetImageRGB(imagergb: cdImageRGB; x, y: number) [in Lua]</pre> + <p>Returns the red, green and blue components of each pixel in a server image. + The RGB components are provided in three matrices stored as byte arrays. The <strong> + <tt>(i,j)</tt></strong> component of these matrices is at the address <strong><tt> + (j*w+i)</tt></strong>. As occurs with all primitives from the Canvas Draw + library, the pixel <strong><tt>(0,0)</tt></strong> is at the bottom left + corner, and the pixel <strong><tt>(w-1,h-1)</tt></strong> is that the upper + right corner of the image rectangle.</p> + <pre class="function"><span class="mainFunction">void <a name="cdPutImageRectRGB">cdCanvasPutImageRectRGB</a>(cdCanvas* canvas, int iw, int ih, + const unsigned char *r, + const unsigned char *g, + const unsigned char *b, + int x, int y, int w, int h, + int xmin, int xmax, int ymin, int ymax); [in C]</span> +void wdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, + const unsigned char *r, + const unsigned char *g, + const unsigned char *b, + double x, double y, double w, double h, + int xmin, int xmax, int ymin, int ymax); (WC) [in C] + +canvas:PutImageRectRGB(imagergb: cdImageRGB; x, y, w, h, xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wPutImageRectRGB(imagergb: cdImageRGB; x, y, w, h, xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + <p>Puts, in a specified area of the canvas, an image with its red, green and blue + components defined in the three matrices stored in byte arrays. The <strong><tt>(i,j)</tt></strong> + component of these matrices is at the address <strong><tt>(j*iw+i)</tt></strong>. + The pixel <strong><tt>(0,0)</tt></strong> is at the bottom left corner, and the + pixel <strong><tt>(iw-1,ih-1)</tt></strong> is that the upper right corner of + the image rectangle. + </p> + <p>Parameters <strong><font>w</font></strong> and <font><strong>h</strong></font> + refer to the target rectangle of the canvas, so that it is possible to reduce + or expand the image drawn. If <strong><font>w</font></strong> and <strong><font>h</font></strong> + are 0, the size of the image is assumed (<strong><font>iw</font></strong> and <strong> + <font>ih</font></strong>). + </p> + <p>It also allows specifying a rectangle inside the image to be drawn, if <strong><font> + xmin</font>, <font>xmax</font>, <font>ymin</font> </strong>and <strong><font>ymax</font></strong> + are 0 then the whole image is assumed. + </p> + <p>If the driver has bpp <=8 or only 256 colors or less, then the image is + converted to 256 optimal colors using the function <strong><font>cdRGB2Map</font></strong> + and is drawn using <strong><font>cdPutImageRectMap</font></strong>.</p> + <pre class="function"><span class="mainFunction">void <a name="cdPutImageRectRGBA">cdCanvasPutImageRectRGBA</a>(cdCanvas* canvas, int iw, int ih, + const unsigned char *r, + const unsigned char *g, + const unsigned char *b, + const unsigned char *a, + int x, int y, int w, int h, + int xmin, int xmax, int ymin, int ymax); [in C]</span> +void wdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, + const unsigned char *r, + const unsigned char *g, + const unsigned char *b, + const unsigned char *a, + double x, double y, double w, double h, + int xmin, int xmax, int ymin, int ymax); (WC) [in C] + +canvas:PutImageRectRGBA(imagergba: cdImageRGBA; x, y, w, h, xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wPutImageRectRGBA(imagergba: cdImageRGBA; x, y, w, h, xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + <p>The same as function <font><strong>cdPutImageRectRGB</strong></font>, + except for the fact that it is possible to specify an alpha channel. The + resulting color is the image color weighted by the alpha value, using the + formula <strong><tt>result=(source * alpha + destiny * (255 - alpha))/255</tt></strong>. + This means that, if alpha is 0, the resulting color is the target color + (completely transparent), and, if alpha is 255, the resulting color is the + original image color (completely opaque).</p> + <p>If this function is not defined for a given driver or if alpha is <font>NULL</font>, + then the function <strong><font>cdPutImageRectRGB</font></strong> is used, as + long as it is defined.</p> + <pre class="function"><span class="mainFunction">void <a name="cdPutImageRectMap">cdCanvasPutImageRectMap</a>(cdCanvas* canvas, int iw, int ih, + const unsigned char *index, + const long int *colors, + int x, int y, int w, int h, + int xmin, int xmax, int ymin, int ymax); [in C]</span> +void wdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, + const unsigned char *index, + const long int *colors, + double x, double y, double w, double h, + int xmin, int xmax, int ymin, int ymax); (WC) [in C] + +canvas:PutImageRectMap(imagemap: cdImageMap; palette: cdPalette; x, y, w, h, xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wPutImageRectMap(imagemap: cdImageMap; palette: cdPalette; x, y, w, h, xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + <p>The same as function <font><strong>cdPutImageRectRGB</strong></font>, + except for the fact that the colors are provided by means of an index matrix + (map). The color corresponding to a given index is given in <font><b>colors[index]</b></font>. + The map is also a matrix stored as a byte vector. If the color vector is null, + then a vector with 256 gray tones is assumed.</p> + <pre class="function"><span class="mainFunction">void <a name="cdRGB2Map">cdRGB2Map</a>(int iw, int ih, + const unsigned char *r, + const unsigned char *g, + const unsigned char *b, + unsigned char *index, + int pal_size, long *color); [in C]</span> + +cd.RGB2Map(imagergb: cdImageRGB, imagemap: cdImageMap, palette: cdPalette) [in Lua]</pre> + <p>Converts an RGB image into an image with 256 indexed colors. The resulting + image must have the same size (width x length) as the RGB image. It is + necessary to allocate memory for the arrays <strong><font>map</font></strong> and + <strong><font>colors</font></strong>. This is the same algorithm used in the IM + library - in fact, the same code.</p> + <h3>Extras</h3> + <p>The following functions are used only for encapsulating the several types of + client images from the library in a single structure, simplifying their + treatment. </p> + <p>For such, a public structure was created, called <font><b>cdBitmap</b></font>, + which will store the image. From this structure, the following fields are + officially defined:</p> + <pre>cdBitmap: + int w /* image width */ + int h /* image heigth */ + int type /* image type: CD_RGBA, CD_RGB or CD_MAP */</pre> + <pre class="function"><span class="mainFunction">cdBitmap* <a name="cdCreateBitmap">cdCreateBitmap</a>(int w, int h, int type); [in C]</span> + +cd.CreateBitmap(w, h, type: number) -> (bitmap: cdBitmap) [in Lua]</pre> + <p>Creates an image with width <strong>w</strong>, and height <strong>h</strong> and + of type <strong>type</strong>. The type can be <font>CD_RGBA, CD_RGB or CD_MAP</font>. + However, <font>CD_MAP</font> only means that the image will have 256 colors if <strong> + type</strong> is greater than 0. It is assumed that the image will be MAP + with the same number of colors in the palette as <strong>type</strong>. + Internally, the color palette is always allocated with 256 entries, which may + or may not be totally fulfilled. In this case, the value of <strong>type</strong> + can be changed as wished.</p> + <pre class="function"><span class="mainFunction">cdBitmap* <a name="cdInitBitmap">cdInitBitmap</a>(int w, int h, int type, ...); [in C]</span> + +[There is no equivalent in Lua]</pre> + <p>Similar to <strong><font>cdCreateBitmap</font></strong>, but it accepts the + data area already allocated by the user. The parameters vary according to the + image type.</p> + <pre><font>CD_RGBA - (unsigned char* red, unsigned char* green, unsigned char* blue, unsigned char* alpha) +CD_RGB - (unsigned char* red, unsigned char* green, unsigned char* blue) +CD_MAP - (unsigned char* index, lont int* colors)</font></pre> + <pre class="function"><span class="mainFunction">void <a name="cdKillBitmap">cdKillBitmap</a>(cdBitmap* image); [in C]</span> + +cd.KillBitmap(bitmap: cdBitmap) [in Lua]</pre> + <p>Liberates the memory allocated for the image. If this function is not + called in Lua, the garbage collector will call it.</p> + <pre class="function"><span class="mainFunction">unsigned char* <a name="cdBitmapGetData">cdBitmapGetData</a>(cdBitmap* image, int dataptr); [in C]</span> + +cd.BitmapGetData(bitmap: cdBitmap; dataptr: number) -> (data: cdImageChannel) [in Lua]</pre> + <p>Returns a pointer to the image's data area according to <font><strong>dataptr</strong></font>. + The following values are defined for <font><strong>dataptr</strong>:</font></p> + <pre><strong>CD_IRED</strong> - red component of an RGB image. cdImageChannel in Lua. +<strong>CD_IGREEN</strong> - green component of an RGB image. cdImageChannel in Lua. +<strong>CD_IBLUE</strong> - blue component of an RGB image. cdImageChannel in Lua. +<strong>CD_IALPHA</strong> - alpha component of an RGBA image. cdImageChannel in Lua. +<strong>CD_INDEX</strong> - indices of a MAP image. cdImageChannel in Lua. +<strong>CD_COLORS</strong> - color table of a MAP image. In this case, a type conversion must be made to <strong>(long int*)</strong>. cdPalette in Lua.</pre> + <p>In Lua, channels are also available as tables, see <a href="#DataAccess">Data + Access</a>. + </p> + <pre class="function"><span class="mainFunction">void <a name="cdBitmapSetRect">cdBitmapSetRect</a>(cdBitmap* image, int xmin, int xmax, int ymin, int ymax); [in C]</span> + +cd.BitmapSetRect(bitmap: cdBitmap; xmin, xmax, ymin, ymax: number) [in Lua]</pre> + <p>Allows specifying a region of interest inside the image to be used by the + function <b><font>cdPutBitmap</font></b>. If no region was defined, the whole + image is used, that is, (0, w-1, 0, h-1).</p> + <pre class="function"><span class="mainFunction">void <a name="cdPutBitmap">cdCanvasPutBitmap</a>(cdCanvas* canvas, cdBitmap* image, int x, int y, int w, int h); [in C]</span> +void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* image, double x, double y, double w, double h); (WC) [in C] + +canvas:PutBitmap(image: cdBitmap; x, y, w, h: number) [in Lua] +canvas:wPutBitmap(bitmap: cdBitmap; x, y, w, h: number) (WC) [in Lua]</pre> + <p>Draws the image in the position (x,y), changing the scale. It + encapsulates <font><strong>cdPutImageRectRGB</strong>, <strong>cdPutImageRectRGBA</strong></font> + and <strong><font>cdPutImageRectMap</font></strong>. The region of the image + drawn depends on the rectangle defined by <strong><font>cdBitmapSetRect</font></strong>. + If no rectangle was defined, then the whole image is used.</p> + <p>The parameters <strong>w</strong> and <strong>h</strong> allow scaling the + image, increasing or decreasing its dimensions when drawn. If <strong>w</strong> + and/or <strong>h</strong> are 0, then no scale change is assumed. + </p> + <pre class="function"><span class="mainFunction">void <a name="cdGetBitmap">cdCanvasGetBitmap</a>(cdCanvas* canvas, cdBitmap* image, int x, int y); [in C]</span> + +canvas:GetBitmap(bitmap: cdBitmap; x, y: number) [in Lua]</pre> + <p>Encapsulates <strong><font>cdGetImageRGB</font></strong>. Nothing happens if + the image is MAP.</p> + <pre class="function"><span class="mainFunction">void <a name="cdBitmapRGB2Map">cdBitmapRGB2Map</a>(cdBitmap* image_rgb, cdBitmap* image_map); [in C]</span> + +cd.BitmapRGB2Map(bitmap_rgb: cdBitmap, bitmap_map: cdBitmap) [in Lua]</pre> + <p>Encapsulates <strong><font>cdRGB2Map</font></strong>. The images must be of + types <font>RGB(A)</font> and <font>MAP</font>, respectively.</p> + <h3>Extras in Lua (Deprecated)</h3> + <pre class="function"><a name="cdCreateImageRGB">cd.CreateImageRGB</a>(width, height: number) -> (imagergb: cdImageRGB)</pre> + <p>Creates an RGB image in Lua. Deprecated use <strong>cd.CreateBitmap</strong>.</p> + <pre class="function"><a name="cdKillImageRGB">cd.KillImageRGB</a>(imagergb: cdImageRGB)</pre> + <p>Destroys the created RGB image and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it. Deprecated use <strong> + cd.KillBitmap</strong>.</p> + <pre class="function"><a name="cdCreateImageRGBA">cd.CreateImageRGBA</a>(width, height: number) -> (imagergba: cdImageRGBA)</pre> + <p>Creates an RGBA image in Lua. Deprecated use <strong>cd.CreateBitmap</strong>.</p> + <pre class="function"><a name="cdKillImageRGBA">cd.KillImageRGBA</a>(imagergba: cdImageRGBA)</pre> + <p>Destroys the created RGBA image and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it. Deprecated use <strong> + cd.KillBitmap</strong>.</p> + <pre class="function"><a name="cdCreateImageMap">cd.CreateImageMap</a>(width, height: number) -> (imagemap: cdImageMap)</pre> + <p>Creates a Map image in Lua. Deprecated use <strong>cd.CreateBitmap</strong>.</p> + <pre class="function"><a name="cdKillImageMap">cd.KillImageMap</a>(imagemap: cdImageMap)</pre> + <p>Destroys the created Map image and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it. Deprecated use <strong> + cd.KillBitmap</strong>.</p> + <h3><a name="DataAccess">Data Access</a></h3> + <p>Data access in Lua is done directly using the operator "<font>[y*width + x]</font>" + in image channels. Each channel works as a value table which should be + consulted or modified in the following way:</p> + <pre><font>image = cd.CreateBitmap(100, 200) +... +image.r[y*100 + x] = 255 +image.g[y*100 + x] = 128 +image.b[y*100 + x] = 0 +... +green = image.g[y*100 + x] -- it will return 128</font></pre> + <p>The order of the tables <em>is</em> important, so that <font size="3">image[n].r</font> + has no meaning to CDLua and the expression will cause an error. Finally, + the user could expect the value of <font size="3">image[n]</font> to be of type <font> + lightuserdata</font>. Unfortunately, this is not the case, and such expression + will cause the same error.</p> + <p>In the old <font>cdImageMap </font>images, the channel must be not + specified: <font size="3">imagemap[y*100+x]</font>.</p> + <p>Known channel names are:</p> + <pre>r - red channel of RGB or RGBA images. +g - gree channel of RGB or RGBA images. +b - blue channel of RGB or RGBA images. +a - alpha channel of RGBA images. +m - indices channel of MAP images (valid only for cdBitmap objects). +p - colors table of MAP images (valid only for cdBitmap objects). It is a cdPalette object.</pre> + </body> +</html>
\ No newline at end of file diff --git a/html/en/func/clipping.html b/html/en/func/clipping.html new file mode 100644 index 0000000..b30db55 --- /dev/null +++ b/html/en/func/clipping.html @@ -0,0 +1,62 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Clipping</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">Clipping</h2> + <p>The clipping area is an area that limits the available drawing area inside the + canvas. Any primitive is drawn only inside the clipping area. It affects all + primitives.</p> + <p>You can set the clipping area by using the function <b>cdClipArea</b>, and + retrieve it using <b>cdGetClipArea</b>. The clipping area is a rectangle by + default, but it can has other shapes. In some drivers a polygon area can be + defined, and in display based drivers a complex region can be defined. The + complex region can be a combination of boxes, polygons, sectors, chords and + texts.</p> + <p>The <b>cdClip</b> function activates and deactivaes the clipping.</p> + <hr> + <pre class="function"><span class="mainFunction">int cdCanvasClip(cdCanvas* canvas, int mode); [in C]</span> + +canvas:Clip(mode: number) -> (old_mode: number) [in Lua]</pre> + <p>Activates or deactivates clipping. Returns the previous status. Values: <b>CD_CLIPAREA, + CD_CLIPPOLYGON, CD_CLIPREGION</b> or <b>CD_CLIPOFF</b>. The value <b>CD_QUERY</b> + simply returns the current status. Default value: <b>CD_CLIPOFF</b>.</p> + <p>The value <b>CD_CLIPAREA</b> activates a rectangular area as the clipping + region. + </p> + <p>The value <b>CD_CLIPPOLYGON</b> activates a polygon as a clipping region, but + works only in some drivers (please refer to the notes of each driver). The + clipping polygon must be defined before activating the polygon clipping; if it + is not defined, the current clipping state remains unchanged. See the + documentation of <a href="polygon.html">cdBegin/cdVertex/cdEnd</a> to create a + polygon.</p> + <p>The value <b>CD_CLIPREGION</b> activates a complex clipping region. See the + documentation of <a href="region.html">Regions</a>.</p> + <pre class="function"><span class="mainFunction">void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); [in C]</span> +void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); [in C] +void wdCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); (WC) [in C] + +canvas:ClipArea(xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wClipArea(xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + <p>Defines a rectangle for clipping. Only the points in the interval <i><b>xmin<= + x <= xmax</b></i> and<b> </b><i><b>ymin <= y <= ymax</b></i> will + be printed. Default region: (0, w-1, 0, h-1). + </p> + <pre class="function"><span class="mainFunction">int cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax); [in C]</span> +int cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax); [in C] +int wdCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax); (WC) [in C] + +canvas:GetClipArea() -> (xmin, xmax, ymin, ymax, status: number) [in Lua] +canvas:wGetClipArea() -> (xmin, xmax, ymin, ymax, status: number) (WC) [in Lua]</pre> + <p>Returns the rectangle and the clipping status. It is not necessary to provide + all return pointers, you can provide only the desired values and <i><b>NULL</b></i> + for the others.</p> + <h4><a name="Polygons">Polygons</a></h4> + <p>A polygon for clipping can be created using <font face="Courier"><strong>cdBegin(</strong>CD_CLIP<strong>)/cdVertex(x,y)/.../cdEnd()</strong></font>.</p> + <p>See the documentation of <a href="polygon.html">cdBegin/cdVertex/cdEnd</a>.</p> + </body> +</html> diff --git a/html/en/func/color.html b/html/en/func/color.html new file mode 100644 index 0000000..9ec9928 --- /dev/null +++ b/html/en/func/color.html @@ -0,0 +1,137 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Color Coding</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">Color Coding</h2> + <p>The library's color system is RGB. In order to simplify some functions, a + compact representation was created for the 3 values. To make a conversion from + this representation to the 3 separate values and vice-versa, use functions + <b> <font>cdDecodeColor</font></b> + and <b> <font>cdEncodeColor</font></b>. + </p> + <p>When the canvas used does not support more than 8 bpp of color resolution, you + can use function <b> <font>Palette</font></b> to give the driver an idea of which + colors to prioritize. <b> <font>Palette</font>'s</b> behavior is driver dependent.</p> + <p>There are some predefined colors:</p> + <pre>CD_RED = (255, 0, 0) +CD_DARK_RED = (128, 0, 0) +CD_GREEN = (0 ,255, 0) +CD_DARK_GREEN = ( 0,128, 0) +CD_BLUE = ( 0, 0,255) +CD_DARK_BLUE = ( 0, 0,128) +CD_YELLOW = (255,255, 0) +CD_DARK_YELLOW = (128,128, 0) +CD_MAGENTA = (255, 0,255) +CD_DARK_MAGENTA = (128, 0,128) +CD_CYAN = ( 0,255,255) +CD_DARK_CYAN = ( 0,128,128) +CD_WHITE = (255,255,255) +CD_BLACK = ( 0, 0 , 0) +CD_DARK_GRAY = (128,128,128) +CD_GRAY = (192,192,192) +</pre> + <hr> + <pre class="function"><span class="mainFunction">long int <a name="cdEncodeColor">cdEncodeColor</a>(unsigned char red, unsigned char green, unsigned char blue) [in C]</span> + +cd.EncodeColor(r, g, b: number) -> (old_color: lightuserdata) [in Lua]</pre> + <p>Returns a codified triple (<em>r,g,b</em>) in a long integer such as <b><tt>0x00RRGGBB</tt></b>, + where <tt><b>RR</b> </tt>are the red components, <b><tt>GG</tt></b> are the + green ones and <b><tt>BB</tt></b> are the blue ones. The code is used in the CD + library to define colors. It can be used without an active canvas.</p> + <pre class="function"><span class="mainFunction">void <a name="cdDecodeColor">cdDecodeColor</a>(long int color, unsigned char *red, unsigned char *green, unsigned char *blue) [in C]</span> + +cd.DecodeColor(color: lightuserdata) -> (r, g, b: number) [in Lua]</pre> + <p>Returns the red, green and blue components of a color in the CD library. Can + be used without an active canvas.</p> + <pre class="function"><span class="mainFunction">long int <a name="cdEncodeAlpha">cdEncodeAlpha</a>(long int color, unsigned char alpha) [in C]</span> + +cd.EncodeAlpha(color: lightuserdata, alpha: number) -> (color: lightuserdata) [in Lua]</pre> + <p>Returns the given color coded with the alpha information. ATENTION: At the + moment only the Win32 with GDI+ and the IMAGERGB drivers support alpha + components in color coding. Se in <a href="../drv/gdiplus.html">Windows Using + GDI+ Base Driver</a> and <a href="../drv/irgb.html">IMAGERGB driver</a>. The + internal representation of the component is inverted, because the default value + must be 0 and opaque for backward compatibility, so you should use the <strong>cdDecodeAlpha</strong> + function ot the <strong>cdAlpha</strong> macro to retrieve the alpha component.</p> + <pre class="function"><span class="mainFunction">unsigned char <a name="cdDecodeAlpha">cdDecodeAlpha</a>(long int color) [in C]</span> + +cd.DecodeAlpha(color: lightuserdata) -> (a: number) [in Lua]</pre> + <p>Returns the alpha component of a color in the CD library. Can be used without + an active canvas. 0 is transparent, 255 is opaque.</p> + <pre class="function"><span class="mainFunction">unsigned char <a name="cdRed0">cdAlpha</a>(long int color); [in C]</span> + +cd.Alpha(color: lightuserdata) -> (r: number) [in Lua]</pre> + <p>Macro that returns the alpha component of a color in the CD library. Can be + used without an active canvas.</p> + <pre class="function"><span class="mainFunction">unsigned char <a name="cdRed">cdRed</a>(long int color); [in C]</span> + +cd.Red(color: lightuserdata) -> (r: number) [in Lua]</pre> + <p>Macro that returns the red component of a color in the CD library. Can be used + without an active canvas.</p> + <pre class="function"><span class="mainFunction">unsigned char <a name="cdGreen">cdGreen</a>(long int color); [in C]</span> + +cd.Green(color: lightuserdata) -> (g: number) [in Lua]</pre> + <p>Macro that returns the green component of a color in the CD library. Can be + used without an active canvas.</p> + <pre class="function"><span class="mainFunction">unsigned char <a name="cdBlue">cdBlue</a>(long int color); [in C]</span> + +cd.Blue(color: lightuserdata) -> (b: number) [in Lua]</pre> + <p>Macro that returns the blue component of a color in the CD library. Can be + used without an active canvas.</p> + <hr> + <pre class="function"><span class="mainFunction">int <a name="cdGetColorPlanes">cdCanvasGetColorPlanes</a>(cdCanvas* canvas); [in C]</span> + +canvas:GetColorPlanes() -> (bpp: number) [in Lua]</pre> + <p>Returns a given number, for instance <i>p</i>, which defines the number of + colors supported by the current device as <i>2<sup>p</sup></i>, representing + the number of bits by pixel. + </p> + <pre class="function"><span class="mainFunction">void <a name="cdPalette">cdCanvasPalette</a>(cdCanvas* canvas, int n, const long int *color, int mode); [in C]</span> + +canvas:Palette(palette: cdPalette; mode: number) [in Lua]</pre> + <p>In systems limited to 256 palette colors, this function aims at adding <b><tt> + n</tt></b> colors to the system's palette. In such systems, the colors + demanded forward or backward which are not in the palette are approximated to + the closest available color. The type can be <tt><b>CD_FORCE</b> </tt>or <b><tt>CD_POLITE</tt></b>. + <b><tt>CD_FORCE</tt></b> ignores the system colors and interface elements, + since the menus and dialogues may be in illegible colors, but there will be + more colors available. <tt><b>CD_POLITE</b></tt> is the recommended type. It + must always be used before drawing. It cannot be queried.</p> + +<h3><a name="Palette">Palette</a></h3> + + <pre class="function"><a name="cdCreatePalette">cd.CreatePalette</a>(size: number) -> (palette: cdPalette) [in Lua Only]</pre> + <p>Creates a palette.</p> + <pre class="function"><a name="cdKillPalette">cd.KillPalette</a>(palette: cdPalette) [in Lua Only]</pre> + <p>Destroys the created palette and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it.</p> + +<h3>Palette <a name="DataAccess">Data Access</a></h3> + + <p>Data access in Lua is done directly using the array access operators. The + colors can have their values checked or changed directly as if they + were Lua tables:</p> + + <pre>palette[index] = cd.EncodeColor(r, g, b) +count = #palette +... +color = palette[index] +r, g, b = cd.DecodeColor(color)</pre> + + <p>Notice that the type of value returned or received by + <font size="3">palette[index]</font><font size="2"> </font>is a + <font>lightuserdata</font>, the same type used with functions <b> + <font size="3">cdEncodeColor</font></b>, <b> + <font size="3">cdDecodeColor</font></b>, <b> + <font size="3">cdPixel</font></b>, <b> + <font size="3">cdForeground</font></b><font size="2"> + </font>and <b> <font size="3">cdBackground</font></b>.</p> + + + </body> +</html>
\ No newline at end of file diff --git a/html/en/func/control.html b/html/en/func/control.html new file mode 100644 index 0000000..5ccdd1c --- /dev/null +++ b/html/en/func/control.html @@ -0,0 +1,63 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Canvas Control</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">Canvas Control</h2> + <pre class="function"><span class="mainFunction">void cdCanvasClear(cdCanvas* canvas); [in C]</span> + +canvas:Clear() [in Lua]</pre> + <p>Cleans the active canvas using the current background color. This action is + interpreted very differently by each driver. Many drivers simply draw a + rectangle with the current background color. It is NOT necessary to call <font>cdClear</font> + when the canvas has just been created, as at this moment it is already clean. + Most file-based drivers do not implement this function.</p> + <pre class="function"><span class="mainFunction">void cdCanvasFlush(cdCanvas* canvas); [in C]</span> + +canvas:Flush() [in Lua]</pre> + <p>Has a different meaning for each driver. It is useful to send information to + buffered devices and to move to a new page or layer. In all cases, the current + canvas attributes are preserved.</p> + <hr> + <pre class="function"><span class="mainFunction">cdState* <a name="cdSaveState">cdCanvasSaveState</a>(cdCanvas* canvas); [in C]</span> + +canvas:SaveState() -> (state: cdState) [in Lua]</pre> + <p>Saves the state of attributes of the active canvas. It does not save cdPlay + callbacks, polygon creation states (begin/vertex/vertex/...), the palette, + complex clipping regions and driver internal attributes.</p> + <pre class="function"><span class="mainFunction">void <a name="cdRestoreState">cdCanvasRestoreState</a>(cdCanvas* canvas, cdState* state); [in C]</span> + +canvas:RestoreState(state: cdState) [in Lua]</pre> + <p>Restores the attribute state of the active canvas. It can be used between + canvases of different contexts. It can be used several times for the same + state. </p> + <pre class="function"><span class="mainFunction">void <a name="cdReleaseState">cdReleaseState</a>(cdState* state); [in C]</span> + +cd.ReleaseState(state: cdState) [in Lua]</pre> + <p>Releases the memory allocated by the <strong><font>cdSaveState</font></strong> + function. If this function is not called in Lua, the garbage collector + will call it.</p> + <hr> + <pre class="function"><span class="mainFunction">void <a name="cdSetAttribute">cdCanvasSetAttribute</a>(cdCanvas* canvas, const char* name, char* data); [in C]</span> + +canvas:SetAttribute(name, data: string) [in Lua]</pre> + <p>Modifies a custom attribute directly in the driver of the active canvas. If + the driver does not have this attribute, the call is ignored.</p> + <pre class="function"><span class="mainFunction">void <a name="cdSetfAttribute">cdCanvasSetfAttribute</a>(cdCanvas* canvas, const char* name, const char* format, ...); [in C]</span> + +[There is no equivalent in Lua]</pre> + <p>Same as <strong><font>cdSetAttribute</font></strong>, used for the case in + which the parameter <b><font>data</font></b> is a string composed by several + parameters. It can be used with parameters equivalent to those of the <b><font> + printf</font></b> function from the standard C library.</p> + <pre class="function"><span class="mainFunction">char* <a name="cdGetAttribute">cdCanvasGetAttribute</a>(cdCanvas* canvas, const char* name); [in C]</span> + +canvas:SetAttribute(name: string) -> (data: string) [in Lua]</pre> + <p>Returns a custom attribute from the driver of the active canvas. If the driver + does not have this attribute, it returns <font>NULL</font>.</p> + </body> +</html>
\ No newline at end of file diff --git a/html/en/func/coordinates.html b/html/en/func/coordinates.html new file mode 100644 index 0000000..9f119bb --- /dev/null +++ b/html/en/func/coordinates.html @@ -0,0 +1,148 @@ +<!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>Coordinate System</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Coordinate System</h2> +<pre class="function"><span class="mainFunction">void <a name="cdGetCanvasSize">cdCanvasGetSize</a>(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm); [in C]</span> + +canvas:GetSize() -> (width, height, mm_width, mm_height: number) [in Lua]</pre> + + <p>Returns the canvas size in pixels and in millimeters. You can provide only + the desired values and <font>NULL</font> for the others.</p> + +<pre class="function"><span class="mainFunction">int <a name="cdUpdateYAxis">cdCanvasUpdateYAxis</a>(cdCanvas* canvas, int *y); [in C]</span> +double cdfCanvasUpdateYAxis(cdCanvas* canvas, double *y); [in C] +int cdCanvasInvertYAxis(cdCanvas* canvas, int y); [in C] +double cdfCanvasInvertYAxis(cdCanvas* canvas, double y); [in C] + +canvas:UpdateYAxis(yc: number) -> (yr: number) [in Lua] +canvas:InvertYAxis(yc: number) -> (yr: number) [in Lua]</pre> + + <p>In some graph systems, the origin is at the upper left corner of the + canvas, with the direction of the Y axis pointing down. In this case, the + function converts the coordinate system of the CD library into the internal + system of the active canvas' driver, and the other way round. If this is not + the case, nothing happens. This is just <font>"y = height-1 - + y"</font>. It returns the changed value. The "Invert" will always invert + the given value, the "Update" function will invert only if the canvas has the + Y axis inverted.</p> + +<pre class="function"><span class="mainFunction">void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy); [in C]</span> +void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy); [in C] + +canvas:MM2Pixel(mm_dx, mm_dy: number) -> (dx, dy: number) [in Lua] +canvas:fMM2Pixel(mm_dx, mm_dy: number) -> (dx, dy: number) [in Lua]</pre> + + <p>Converts sizes in millimeters into pixels (canvas coordinates). You can + provide only the desired values and <font>NULL</font> for the + others.</p> + +<pre class="function"><span class="mainFunction">void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy); [in C]</span> +void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy); [in C] + +canvas:Pixel2MM(dx, dy: number) -> (mm_dx, mm_dy: number) [in Lua] +canvas:fPixel2MM(dx, dy: number) -> (mm_dx, mm_dy: number) [in Lua]</pre> + + <p>Converts sizes in pixels (canvas coordinates) into millimeters. You can + provide only the desired values and <font>NULL</font> for the + others. Use this function to obtain the horizontal and vertical resolution of + the canvas by passing 1 as parameter in <font>dx</font> and + <font>dy</font>. The resolution value is obtained using the + formula <strong><font>res=1.0/mm</font></strong>.</p> + +<pre class="function"><span class="mainFunction">void cdCanvasOrigin(cdCanvas* canvas, int x, int y); [in C]</span> +void cdfCanvasOrigin(cdCanvas* canvas, double x, double y); [in C] + +canvas:Origin(x, y: number) [in Lua] +canvas:fOrigin(x, y: number) [in Lua]</pre> + + <p>Allows translating the origin - for instance, to the center of the canvas. + The function profits from the architecture of the library to simulate a + translation of the origin, which in fact is never actually passed to the + canvas in the respective driver. Default values: (0, 0)</p> + + +<pre class="function"><span class="mainFunction">void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y); [in C]</span> +void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y); [in C] + +canvas:GetOrigin() -> (x, y: number) [in Lua] +canvas:fGetOrigin() -> (x, y: number) [in Lua]</pre> + + <p>Returns the origin.</p> + + +<h3>Transformation Matrix</h3> + +<pre class="function"><span class="mainFunction">void <a name="cdTransform">cdCanvasTransform</a>(cdCanvas* canvas, const double* matrix); [in C]</span> + +canvas:Transform(matrix: table) [in Lua]</pre> + + <p>Defines a transformation matrix with 6 elements. If the matrix is NULL, + the + transformation is reset to the identity. Default value: NULL.</p> + <p>The matrix contains scale, rotation and translation elements as follows:</p> + <pre>|x'| |sx*cos(angle) -sin(angle) dx| |x| |0 2 4| +|y'| = | sin(angle) sy*cos(angle) dy| * |y| with indices |1 3 5| + |1|</pre> + <p>But notice that the indices are different of the <strong> + cdCanvasVectorTextTransform</strong>.</p> +<p>Functions that retrieve images from the canvas are not affected by the +transformation matrix, such as <strong>GetImage</strong>, <strong>GetImageRGB</strong> +and <strong>ScrollArea</strong>.</p> +<p>Transformation matrix is independent of the <strong>World Coordinate</strong> +and <strong>Origin</strong> +functions. And those are affected if a transformation is set, just like other +regular primitives.</p> + + +<pre class="function"><span class="mainFunction">double* <a name="cdGetTransform">cdCanvasGetTransform</a>(cdCanvas* canvas); [in C]</span> + +canvas:GetTransformation() -> (matrix: table) [in Lua]</pre> + + <p>Returns the transformation matrix. If the identity is set, returns NULL.</p> + + +<pre class="function"><span class="mainFunction">void <a name="cdTransformMultiply">cdCanvasTransforMultiply</a>(cdCanvas* canvas, const double* matrix); [in C]</span> + +canvas:TransformMultiply(matrix: table) [in Lua]</pre> + + <p>Left multiply the current transformation by the given transformation.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTransformTranslate">cdCanvasTransformTranslate</a>(cdCanvas* canvas, double dx, double dy); [in C]</span> + +canvas:TransformTranslate(dx, dy: number) [in Lua]</pre> + + <p>Applies a translation to the current transformation.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTransformScale">cdCanvasTransformScale</a>(cdCanvas* canvas, double sx, double sy); [in C]</span> + +canvas:TransformScale(sx, sy: number) [in Lua]</pre> + + <p>Applies a scale to the current transformation.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTransformRotate">cdCanvasTransformRotate</a>(cdCanvas* canvas, double angle); [in C]</span> + +canvas:TransformRotate(angle: number) [in Lua]</pre> + + <p>Applies a rotation to the current transformation. Angle is in degrees, + oriented counter-clockwise from the horizontal axis.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTransformPoint">cdCanvasTransformPoint</a>(cdCanvas* canvas, int x, int y, int *tx, int *ty); [in C]</span> +void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty); [in C] + +canvas:TransformPoint(x, y: number) -> (tx, ty: number) [in Lua] +canvas:fTransformPoint(x, y: number) -> (tx, ty: number) [in Lua]</pre> + + <p>Applies a transformation to a given point.</p> + +</body> + +</html>
\ No newline at end of file diff --git a/html/en/func/filled.html b/html/en/func/filled.html new file mode 100644 index 0000000..2ae1083 --- /dev/null +++ b/html/en/func/filled.html @@ -0,0 +1,272 @@ +<!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>Filled Areas</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Filled Areas</h2> + + <p>It is an area filled with the foreground color, but it depends on the + current interior style. The <font>SOLID</font> style + depends only on the foreground color. The <font>HATCH</font> + and + <font>STIPPLE </font> style depend on the foreground color, background color and on the back opacity attribute. The + hatch lines drawn with this style do not depend on the other line attributes. The + <font>PATTERN</font> style depends only on global canvas + attributes.</p> +<p>The filled area includes the line at the edge of the area. So if you draw a +filled rectangle, sector or polygon on top of a non filled one using the same +coordinates, no style and 1 pixel width, the non filled primitive should be +obscured by the filled primitive. But depending on the driver implementation +some pixels at the edges may be not included. IMPORTANT: In the Postscript and +PDF drivers the line at the edge is not included at all.</p> + <p>If + either the background or the foreground color are modified, the hatched and + monochromatic fillings must be modified again in order to be updated.</p> + <p>Note that when a Filling Attribute is modified, the active filling style is + now that of the modified attribute (hatch, stipple or pattern). Notice that + this is not true for the clipping area. When the clipping area is modified, + the clipping is only affected if it is active.</p> + +<hr> +<pre class="function"><span class="mainFunction">Filled <a name="Polygons">Polygons</a></span></pre> + + <p>Filled polygons can be created using <font><strong>cdBegin(</strong>CD_FILL<strong>)/cdVertex(x,y)/.../cdEnd()</strong></font>.</p> + <p>See the documentation of <a href="polygon.html">cdBegin/cdVertex/cdEnd</a>.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdBox">cdCanvasBox</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); [in C]</span> +void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); [in C] +void wdCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); (WC) [in C] + +canvas:Box(xmin, xmax, ymin, ymax: number) [in Lua] +canvas:fBox(xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wBox(xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + + <p>Fills a rectangle according to the current interior style. All points in + the interval <font><strong>x_min<=x<=x_max, y_min<=y<=y_max</strong></font> + will be painted. When the interior style <font>CD_HOLLOW</font> + is defined, the function behaves like its equivalent <strong> + <font>cdRect</font>.</strong></p> + +<pre class="function"><span class="mainFunction">void <a name="cdSector">cdCanvasSector</a>(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2); [in C]</span> +void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); [in C] +void wdCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); (WC) [in C] + +canvas:Sector(xc, yc, w, h, angle1, angle2: number) [in Lua] +canvas:fSector(xc, yc, w, h, angle1, angle2: number) [in Lua] +canvas:wSector(xc, yc, w, h, angle1, angle2: number) (WC) [in Lua]</pre> + + <p>Fills the arc of an ellipse aligned with the axis, according to the current + interior style, in the shape of a pie. 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>(xc+(w/2)*cos(angle1),yc+(h/2)*sin(angle1))</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 <tt><b>rangle = + atan2((h/2</b></tt><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>When the interior style <font><strong>CD_HOLLOW</strong></font> is defined, + the function behaves like its equivalent <strong><font>cdArc</font></strong>, + plus two lines connecting to the center.</p> + <p align="center"><font size="4">Sector Parameters</font><br> + <img src="../../img/sector.gif" border="2" width="161" height="160"></p> + +<pre class="function"><span class="mainFunction">void <a name="cdChord">cdCanvasChord</a>(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2); [in C]</span> +void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); [in C] +void wdCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2); (WC) [in C] + +canvas:Chord(xc, yc, w, h, angle1, angle2: number) [in Lua] +canvas:fChord(xc, yc, w, h, angle1, angle2: number) [in Lua] +canvas:wChord(xc, yc, w, h, angle1, angle2: number) (WC) [in Lua]</pre> + + <p>Fills the arc of an ellipse aligned with the axis, according to the current + interior style, the start and end points of the arc are connected. The + parameters are the same as the <strong><font>cdSector</font></strong>.</p> + <p>When the interior style <font><strong>CD_HOLLOW</strong></font> is defined, + the function behaves like its equivalent <strong><font>cdArc</font></strong>, + plus a line connecting the arc start and end points.</p> + <p align="center"><font size="4">Chord Parameters</font><br> + <img src="../../img/chord.gif" border="2" width="161" height="160"></p> + +<h3>Attributes</h3> +<pre class="function"><span class="mainFunction">int <a name="cdBackOpacity">cdCanvasBackOpacity</a>(cdCanvas* canvas, int opacity); [in C]</span> + +canvas:BackOpacity(opacity: number) -> (old_opacity: number) [in Lua]</pre> + + <p>Configures the background opacity to filling primitives based on the + foreground and background colors. Values: <font><b> + CD_TRANSPARENT</b></font> or <b>CD_OPAQUE</b>. If it is opaque + the primitive will erase whatever is in background with the background color. + If it is transparent, only the foreground color is painted. It returns the previous value. Default value: <b> + CD_TRANSPARENT</b>. Value <b><b>CD_QUERY</b> </b>simply returns the + current value. In some drivers is always opaque.</p> + <p align="center"><font size="4">Back Opacity Attribute<br> + </font><img src="../../img/opacity.gif" border="2" width="260" height="136"></p> + +<pre class="function"><span class="mainFunction">int <a name="cdFillMode">cdCanvasFillMode</a>(cdCanvas* canvas, int mode); [in C]</span> + +canvas:FillMode(mode: number) -> (old_mode: number) [in Lua]</pre> + + <p>Selects a predefined polygon fill rule (<b>CD_EVENODD</b> or <strong>CD_WINDING</strong>). Returns the previous value. Default value: <b> + CD_EVENODD</b>. Value <b><b>CD_QUERY</b> </b>simply returns the current + value.</p> + <p align="center"><font size="4">Fill Modes</font><br> + <img src="../../img/fillmode.gif" border="2" width="260" height="136"></p> + +<pre class="function"><span class="mainFunction">int <a name="cdInteriorStyle">cdCanvasInteriorStyle</a>(cdCanvas* canvas, int style); [in C]</span> + +canvas:InteriorStyle(style: number) -> (old_style: number) [in Lua]</pre> + + <p>Configures the current style for the area filling primitives: <b> + CD_SOLID</b>, <strong><b>CD_HOLLOW</b></strong>, <b>CD_HATCH</b>, + <b>CD_STIPPLE</b> or <b>CD_PATTERN</b>. Note that <b> + CD_HATCH</b> and <b>CD_STIPPLE</b> are affected by the backopacity. It returns the previous value. Default value: <b>CD_SOLID</b>. Value + <b><b>CD_QUERY</b> </b>simply returns the + current value.</p> + <p>If <i>a stipple</i> or <i>a pattern</i> were not defined, when they are + selected the state of the + attribute is not changed. </p> + <p>When the style <strong>CD_HOLLOW</strong> is defined, functions + <strong>cdBox</strong> and <strong>cdSector</strong> behave as their + equivalent <strong>cdRect</strong> and <strong>cdArc+Lines</strong>, and the + polygons with style <b>CD_FILL</b> behave like <b>CD_CLOSED_LINES</b>.</p> + +<pre class="function"><span class="mainFunction">int <a name="cdHatch">cdCanvasHatch</a>(cdCanvas* canvas, int style); [in C]</span> + +canvas:Hatch(style: number) -> (old_style: number) [in Lua]</pre> + + <p>Selects a predefined <i>hatch</i> style (<b>CD_HORIZONTAL</b>, <b>CD_VERTICAL</b>, + <b>CD_FDIAGONAL</b>, <b>CD_BDIAGONAL</b>, + <b>CD_CROSS</b> or <b>CD_DIAGCROSS</b>) and sets the + interior style to <b>CD_HATCH</b>. The lines are drawn with the foreground + color, and the background is drawn with the background color if back opacity + is opaque. Returns the previous value. + Default value: <b>CD_HORIZONTAL</b>. Value <b><b>CD_QUERY</b> </b> + simply returns the current value. The foreground and background colors must be + set before setting the style. In some drivers is always opaque.</p> + <p align="center"><font size="4">Hatch Styles</font><br> + <img src="../../img/hatch.gif" border="2" width="182" height="348"></p> + +<pre class="function"><span class="mainFunction">void <a name="cdStipple">cdCanvasStipple</a>(cdCanvas* canvas, int w, int h, const unsigned char *fgbg) [in C]</span> + +canvas:Stipple(stipple: cdStipple) [in Lua]</pre> + + <p>Defines a <b><b>wxh</b> </b>matrix of zeros (0) and ones (1). The zeros are + mapped to the background color or are transparent, according to the background + opacity attribute. The ones are mapped to the foreground color. The function + sets the interior style to <b>CD_STIPPLE</b>. To avoid having to deal + with matrices in C, the element <b>(i,j)</b> of <b>fgbg</b> + is stored as <b>fgbg[j*w+i]</b>. The origin is the left bottom corner + of the image. It does not need to be stored by the + application, as it is internally replicated by the library. In some + drivers is always opaque. The foreground and background colors must be set + before setting the style. </p> + +<pre class="function"><span class="mainFunction">void <a name="wdStipple">wdCanvasStipple</a>(cdCanvas* canvas, int w, int h, const unsigned char *fgbg, double w_mm, double h_mm); [in C]</span> + +canvas:wStipple(stipple: cdStipple, w_mm, h_mm: number) [in Lua]</pre> + + <p>Allows specifying the stipple in world coordinates. Another stipple will be + created with the size in pixels corresponding to the specified size in + millimeters. The new size in pixels will be an integer factor of the original + size that is closets to the size in millimeters. The use of this function may produce very large or very small + stipples.</p> + +<pre class="function"><span class="mainFunction">unsigned char* <a name="cdGetStipple">cdCanvasGetStipple</a>(cdCanvas* canvas, int* w, int* h); [in C]</span> + +canvas:GetStipple() - > (stipple: cdStipple) [in Lua]</pre> + + <p>Returns the current <i>stipple</i> and its dimensions. Returns NULL if no + <i>stipple</i> was defined.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdPattern">cdCanvasPattern</a>(cdCanvas* canvas, int w, int h, const long int *color); [in C]</span> + +canvas:Pattern(pattern: cdPattern) [in Lua]</pre> + + <p>Defines a new <b><b>wxh</b> </b>color matrix and sets the interior style + to <b>CD_PATTERN</b>. To avoid having to deal with matrices in C, the + color element <b>(i,j)</b> is stored as <b>color[j*w+i]</b>. + The origin is the left bottom corner of the image. It + does not need to be stored by the application, as it is internally replicated + by the library.</p> + +<pre class="function"><span class="mainFunction">void <a name="wdPattern">wdCanvasPattern</a>(cdCanvas* canvas, int w, int h, const long int *color, double w_mm, double h_mm); [in C]</span> + +canvas:wPattern(pattern: cdPattern, w_mm, h_mm: number) [in Lua]</pre> + + <p>Allows specifying the pattern in world coordinates. Another pattern will be + created with the size in pixels corresponding to the specified size in + millimeters. The new size in pixels will be an integer factor of the original + size that is closets to the size in millimeters. The use of this function may produce very large or very small + patterns.</p> + +<pre class="function"><span class="mainFunction">long int* <a name="cdGetPattern">cdCanvasGetPattern</a>(cdCanvas* canvas, int* w, int* h); [in C]</span> + +canvas:GetPattern() - > (pattern: cdPattern) [in Lua]</pre> + + <p>Returns the current <i>pattern</i> and its dimensions. Returns NULL if no + <i>pattern</i> was defined.</p> + +<h3>Extras in Lua</h3> +<pre class="function"><a name="cdCreatePattern">cd.CreatePattern</a>(width, height: number) -> (pattern: cdPattern)</pre> + + <p>Creates a pattern in Lua.</p> + +<pre class="function"><a name="cdKillPattern">cd.KillPattern</a>(pattern: cdPattern)</pre> + + <p>Destroys the created pattern and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it.</p> + +<pre class="function"><a name="cdCreateStipple">cd.CreateStipple</a>(width, height: number) -> (stipple: cdStipple)</pre> + + <p>Creates a stipple in Lua.</p> + +<pre class="function"><a name="cdKillStipple">cd.KillStipple</a>(stipple: cdStipple)</pre> + + <p>Destroys the created stipple and liberates allocated memory. If this + function is not called in Lua, the garbage collector will call it.</p> + +<h3><a name="DataAccess">Data Access</a></h3> + + <p>Data access in Lua is done directly using the operator "<font>[y*width + + x]</font>". </p> + <p>All new types can have their values checked or changed directly as if they + were Lua tables:</p> + + <pre>pattern[y*16 + x] = cd.EncodeColor(r, g, b) +... +color = pattern[y*16 + x] +r, g, b = cd.DecodeColor(color) +... +cd.Pattern(pattern)</pre> + + <p>Notice that the type of value returned or received by + <font size="3">pattern[i]</font><font size="2"> </font>is a + <font>lightuserdata</font>, the same type used with functions <b> + <font size="3">cdEncodeColor</font></b>, <b> + <font size="3">cdDecodeColor</font></b>, <b> + <font size="3">cdPixel</font></b>, <b> + <font size="3">cdForeground</font></b><font size="2"> + </font>and <b> <font size="3">cdBackground</font></b>. The value + returned or received by <font>stipple</font><font size="3">[i]</font> + is a number.</p> + + +</body> + +</html>
\ No newline at end of file diff --git a/html/en/func/init.html b/html/en/func/init.html new file mode 100644 index 0000000..c6e08b3 --- /dev/null +++ b/html/en/func/init.html @@ -0,0 +1,225 @@ +<!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>Canvas Initialization</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Canvas Initialization</h2> +<pre class="function"><span class="mainFunction">cdCanvas *<a name="cdCreateCanvas">cdCreateCanvas(cdContext* ctx, void *data)</a>; [in C]</span> + +cd.CreateCanvas(ctx: number, data: string or userdata) -> (canvas: cdCanvas) [in Lua]</pre> + + <p>Creates a CD canvas for a virtual visualization surface (VVS). A VVS may be the canvas of a user-interface window, + the page of a document sent to a printer, an offscreen image, the clipboard, a metafile, and so on. To create the + canvas, it is necessary to specify the driver in which each canvas is implemented. </p> + <p>The driver is set by the <b>driver</b> variable with additional information provided in the <tt> + <b>data</b></tt> + parameter. Even though it is possible to create more than one canvas with the same <tt> + <b>driver/data</b></tt> pair, + this is not recommended, and its behavior is not specified. Each canvas maintains its own features. </p> + <p>In case of failure, a <b>NULL</b> value is returned. The following predefined drivers are available:</p> + + + <p><b>Window-Base Drivers</b></p> + + + <ul> + <li><a href="../drv/iup.html"><b>CD_IUP</b></a> = IUP Canvas (<b>cdiup.h</b>).</li> + <li><a href="../drv/native.html"><b>CD_NATIVEWINDOW</b></a> = Native + Window (<b>cdnative.h</b>).</li> + </ul> + + + <p><b>Device-Based Drivers</b></p> + + + <ul> + <li><a href="../drv/clipbd.html"><b>CD_CLIPBOARD</b></a> = Clipboard (<b>cdclipbd.h</b>).</li> + <li><a href="../drv/printer.html"><b>CD_PRINTER</b></a> = Printer (<b>cdprint.h</b>).</li> + </ul> + <p><b>Image-Based Drivers</b> </p> + <ul> + <li><a href="../drv/image.html"><b>CD_IMAGE</b></a> = Server-Image + Drawing (<b>cdimage.h</b>).</li> + <li><a href="../drv/irgb.html"><b>CD_IMAGERGB</b></a> = Client-Image + Drawing (<b>cdirgb.h</b>).</li> + <li><a href="../drv/dbuf.html"><b>CD_DBUFFER</b></a> = Offscreen Drawing + (<b>cddbuf.h</b>).</li> + </ul> + <p><b>File-Based Drivers</b> </p> + <ul> + <li><a href="../drv/cgm.html"><b>CD_CGM</b></a> = Computer Graphics + Metafile ISO (<b>cdcgm.h</b>).</li> + <li><a href="../drv/dgn.html"><b>CD_DGN</b></a> = MicroStation Design + File (<b>cddgn.h</b>).</li> + <li><a href="../drv/dxf.html"><b>CD_DXF</b></a> = AutoCad Drawing + Interchange File (<b>cddxf.h</b>).</li> + <li><a href="../drv/emf.html"><b>CD_EMF</b></a> = Microsoft Windows + Enhanced Metafile (<b>cdemf.h</b>). Works only in MS Windows systems.</li> + <li><a href="../drv/mf.html"><b>CD_METAFILE</b></a> = Metafile Canvas + Draw (<b>cdmf.h</b>).</li> + <li><a href="../drv/ps.html"><b>CD_PS</b></a> = PostScript File (<b>cdps.h</b>).</li> + <li><a href="../drv/wmf.html"><b>CD_WMF</b></a> = Microsoft Windows + Metafile (<b>cdwmf.h</b>).</li> + </ul> + +<pre class="function"><span class="mainFunction">cdCanvas* <a name="cdCreateCanvasf">cdCreateCanvasf(cdContext *ctx, const char* format, ...)</a>; [in C] +</span><font> +</font>[There is no equivalent in Lua]</pre> + + <p>Same as <strong><font>cdCreateCanvas</font></strong>, used in the case that the parameter <b> + <font>data</font></b> is a string composed by several parameters. This function can be used with + parameters equivalent to the <b><font>printf</font></b> function from the default C library.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdKillCanvas">cdKillCanvas(cdCanvas *canvas)</a>; [in C]</span> + +cd.KillCanvas(canvas: cdCanvas) [in Lua]</pre> + + <p>Destroys a previously created canvas. If this function is not called in + Lua, the garbage collector will call it.</p> + +<pre class="function"><span class="mainFunction">int <a name="cdCanvasActivate">cdCanvasActivate</a>(cdCanvas *canvas); [in C]</span> + +canvas:Activate(canvas: cdCanvas) -> (status: number) [in Lua]</pre> + + <p>Activates a canvas for drawing. This is used only for a few drivers. Native + Window and IUP drivers will update the canvas size if the window size has + changed. Double Buffer driver will recreate the image buffer if the window + canvas size has changed. In these cases the function MUST be called, for other + drivers is useless. Returns CD_ERROR or CD_OK.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdCanvasDeactivate">cdCanvasDeactivate</a>(cdCanvas* canvas); [in C]</span> + +canvas:Deactivate(canvas: cdCanvas) [in Lua]</pre> + + <p>Called when the application has finished drawing in the canvas. It is + optional, but if used for the Native Window driver in Windows when the handle + can not be retained, the drawing can only be done again after a <strong> + cdCanvasActivate</strong>. On some drivers will simply call + <a href="control.html#cdFlush">Flush</a>.</p> +<pre class="function"><span class="mainFunction">int <a name="cdUseContextPlus">cdUseContextPlus</a>(int use); [in C]</span> + +cd.UseContextPlus(use: number) -> (old_use: number) [in Lua]</pre> +<p>Activates or deactivates the use of an external context for the next calls of the <font face="Courier"><b> + <a href="../func/init.html#cdCreateCanvas">cdCreateCanvas</a></b></font> + function.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdInitContextPlus">cdInitContextPlus</a>(void); [in C] +</span> +cd.InitContextPlus() [in Lua]</pre> +<p>Initializes the context driver to use another context replacing the standard drivers. +This functions is only available when a library containing a "ContextPlus" +context driver is used. See the <a href="../drv/gdiplus.html">GDI+</a> base +driver and the <a href="../drv/xrender.html">XRender</a> base driver.</p> +<p>In Lua, when using require"cdluacontextplus" this function will be +automatically called.</p> + +<hr> +<pre class="function"><span class="mainFunction">cdContext* cdCanvasGetContext(cdCanvas *canvas); [in C]</span> + +canvas:GetContext(canvas: cdCanvas) -> (ctx: number) [in Lua]</pre> + + <p>Returns the context of a given canvas, which can be compared with the predefined contexts, such as "CD_PS".</p> + +<pre class="function"><span class="mainFunction">int cdContextCaps(cdContext* ctx); [in C]</span> + +cd.ContextCaps(ctx: number) -> (caps: number) [in Lua]</pre> + + <p>Returns the resources available for that context. To verify if a given resource is available, perform a binary AND + ('&.html with the following values:</p> + + <p><font>CD_CAP_FLUSH<br> + CD_CAP_CLEAR <br> + CD_CAP_PLAY <br> + CD_CAP_YAXIS</font> - The Y axis has the same orientation as the CD axis.<br> + <font>CD_CAP_CLIPAREA <br> + CD_CAP_CLIPPOLY</font> - Usually is not implemented.<br> + <font>CD_CAP_MARK</font> - Marks are implemented directly in the driver (they are usually simulated).<br> + <font>CD_CAP_RECT</font> - Rectangles are implemented directly in the driver (they are usually + simulated).<br> + <font>CD_CAP_VECTORTEXT</font> - Vector text is implemented directly in the driver (it is usually + simulated).<br> + <font>CD_CAP_IMAGERGB <br> + CD_CAP_IMAGERGBA</font> - If this is not implemented, but <font>cdGetImageRGB</font> is, then it is + simulated using <font>cdGetImageRGB</font> and <font>cdPutImageRGB</font>.<br> + <font>CD_CAP_IMAGEMAP <br> + CD_CAP_GETIMAGERGB <br> + CD_CAP_IMAGESRV</font> - Usually is only implemented in contexts of window graphics systems (Native Window and IUP).<br> + <font>CD_CAP_BACKGROUND <br> + CD_CAP_BACKOPACITY <br> + CD_CAP_WRITEMODE <br> + CD_CAP_LINESTYLE <br> + CD_CAP_LINEWITH <br> + CD_CAP_WD</font> - Functions of world coordinates are implemented directly in the driver (they are usually + simulated).<br> + <font>CD_CAP_HATCH <br> + CD_CAP_STIPPLE <br> + CD_CAP_PATTERN <br> + CD_CAP_FONT <br> + CD_CAP_FONTDIM</font> - If not defined, the function is implemented using an internal heuristics of the library.<br> + <font>CD_CAP_TEXTSIZE</font> - If not defined, the function is implemented using an internal + heuristics of the library.<br> + <font>CD_CAP_TEXTORIENTATION</font> - Usually is not implemented.<br> + <font>CD_CAP_PALETTE</font> - Usually is only implemented in contexts of window graphics systems + (Native Window and IUP).</p> + + +<pre class="function"><span class="mainFunction">int cdCanvasSimulate(cdCanvas* canvas, int mode); [in C]</span> + +canvas:Simulate(mode: number) -> (old_mode: number) [in Lua]</pre> + + <p>Activates the simulation of one or more primitives. It is ignored for the canvas + in the ImageRGB context, because in this case everything is already simulated. It also has no effect for primitives that + are usually simulated. It returns the previous simulation, but does not include primitives that are usually simulated. + The simulation can be activated at any moment. For instance, if a line simulation is required only for a situation, + the simulation can be activated for the line to be drawn, and then deactivated.</p> +<p>If simulation is activated the driver transformation matrix is disabled.</p> + <p>See in the Simulation sub-driver the information on how each simulation is performed.</p> + <p>To activate a given simulation, perform a binary OR ('|.html using one or more of the following values (in Lua, the + values must be added '+.html:</p> + <p><font>CD_SIM_NONE</font> - Deactivates all kinds of simulation.<br> + <font>CD_SIM_LINE <br> + CD_SIM_RECT <br> + CD_SIM_BOX <br> + CD_SIM_ARC <br> + CD_SIM_SECTOR <br> + CD_SIM_CHORD <br> + CD_SIM_POLYLINE <br> + CD_SIM_POLYGON <br> + CD_SIM_TEXT <br> + CD_SIM_ALL</font> - Activates all simulation options. <br> + <font>CD_SIM_LINES</font> - Combination of <font>CD_SIM_LINE, CD_SIM_RECT, CD_SIM_ARC</font> + and <font>CD_SIM_POLYLINE</font>.<br> + <font>CD_SIM_FILLS</font> - Combination of <font>CD_SIM_BOX, CD_SIM_SECTOR, CD_SIM_</font>CHORD and + <font>CD_SIM_POLYGON</font>.<br> + </p> + +<h3>Extras</h3> +<pre class="function">int <strong><span style="font-size: 110%"><a name="cdlua_open">cdlua_open</a></span></strong>(lua_State* L); [for Lua 5]</pre> + + <p>Initializes the CDLua binding. In Lua 5 the binding is lua state safe, this means that several states can be + initialized any time.</p> + +<pre class="function">int <strong><span style="font-size: 110%"><a name="cdlua_close">cdlua_close</a></span></strong>(lua_State* L); [for Lua 5]</pre> + + <p>Releases the memory allocated by the CDLua binding.</p> + +<pre class="function">cdCanvas* <strong><span style="font-size: 110%"><a name="cdlua_getcanvas">cdlua_checkcanvas</a></span></strong>(lua_State* L, int pos); [for Lua 5]</pre> + + <p>Returns the canvas in the Lua stack at position pos. The function will call lua_error if there is not a valid canvas in + the stack at the given position.</p> + + +<pre class="function">void <strong><span style="font-size: 110%">cdlua_pushcanvas</span></strong>(lua_State* L, cdCanvas* canvas);</pre> +<p>Pushes the given canvas into the stack.</p> + + +</body> + +</html>
\ No newline at end of file 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> diff --git a/html/en/func/marks.html b/html/en/func/marks.html new file mode 100644 index 0000000..b68db35 --- /dev/null +++ b/html/en/func/marks.html @@ -0,0 +1,85 @@ +<!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>Marks</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Marks</h2> + + <p>A mark is a punctual representation. It can have different sizes and types. + All types are affected only by mark attributes and by the foreground color.</p> +<p>All marks in all drivers are simulated using other CD primitives, except +<strong>cdPixel</strong>.</p> + +<hr> +<pre class="function"><span class="mainFunction">void <a name="cdPixel">cdCanvasPixel</a>(cdCanvas* canvas, int x, int y, long int color); [in C]</span> +void wdCanvasPixel(cdCanvas* canvas, double x, double y, long int color); (WC) [in C] + +canvas:Pixel(x, y: number, color: lightuserdata) [in Lua] +canvas:wPixel(x, y: number, color: lightuserdata) (WC) [in Lua]</pre> + + <p>Configures the pixel <b>(x,y)</b> with the color defined by <b>color</b>. It is the smallest element of the canvas. It depends only + on global attributes of the canvas.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdMark">cdCanvasMark</a>(cdCanvas* canvas, int x, int y); [in C]</span> +void wdCanvasMark(cdCanvas* canvas, double x, double y); (WC) [in C] + +canvas:Mark(x, y: number) [in Lua] +canvas:wMark(x, y: number) (WC) [in Lua]</pre> + + <p>Draws a mark in <b><b>(x,y)</b> </b>using the current foreground color. + It is not possible to use this function between a call to functions + <font><b>cdBegin</b></font> and <font><b>cdEnd</b></font> + if the type of mark is set to <b>CD_DIAMOND</b>. If the active driver + does not include this primitive, it will be simulated using other primitives + from the library, such as <strong><font>cdLine</font></strong>.</p> + <p>If you will call function <strong><font>cdMark</font></strong> + or <strong><font>wdMark</font></strong> several times in a + sequence, then it is recommended that the application changes the filling and + line attributes to those used by the <strong><font>cdMark</font></strong> + function:</p> + +<pre>cdInteriorStyle(CD_SOLID); +cdLineStyle(CD_CONTINUOUS); +cdLineWidth(1);</pre> + + <p>This will greatly increase this function's performance. Also in this case, + if the mark is very small, we suggest using the <font>cdPixel</font> + function so that the application itself draws the mark. In many cases, this + also increases this function's performance.</p> + +<h3>Attributes</h3> +<pre class="function"><span class="mainFunction">int <a name="cdMarkType">cdCanvasMarkType</a>(cdCanvas* canvas, int type); [in C]</span> + +canvas:MarkType(type: number) -> (old_type: number) [in Lua]</pre> + + <p>Configures the current mark type for: <b>CD_PLUS</b>, <b> + CD_STAR</b>, <b>CD_CIRCLE</b>, <b>CD_X</b>, <b> + CD_BOX</b>, <b>CD_DIAMOND</b>, <b>CD_HOLLOW_CIRCLE</b>, + <b>CD_HOLLOW_BOX</b> or <b>CD_HOLLOW_DIAMOND</b>. Returns + the previous value. Default value: <b>CD_STAR</b>. Value <b><b> + CD_QUERY</b> </b>simply returns the current value.</p> + <p align="center"><font size="4">Mark Types</font><br> + <img src="../../img/marks.gif" border="2" width="148" height="193"></p> + +<pre class="function"><span class="mainFunction">int <a name="cdMarkSize">cdCanvasMarkSize</a>(cdCanvas* canvas, int size); [in C]</span> +double wdCanvasMarkSize(cdCanvas* canvas, double size); (WC) [in C] + +canvas:MarkSize(size: number) -> (old_size: number) [in Lua] +canvas:wMarkSize(size: number) -> (old_size: number) (WC) [in Lua]</pre> + + <p>Configures the mark size in pixels. Returns the previous value. Default + value: 10. 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> + + +</body> + +</html> diff --git a/html/en/func/other.html b/html/en/func/other.html new file mode 100644 index 0000000..f0d7284 --- /dev/null +++ b/html/en/func/other.html @@ -0,0 +1,119 @@ +<!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>Other</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">System</h2> +<pre class="function"><span class="mainFunction">char* <a name="cdVersion">cdVersion</a>(void); [in C]</span> + +cd.Version() -> (version: string) [in Lua]</pre> + + <p>Returns the current version number of the library. The string with the + version number has a format "<font>major.minor.build</font>". + For instance, the string "2.1.3" has number 2 as the main (major) version + number, 1 as the secondary (minor) version number, and 3 as the build number. + The major version number represents a change in the structure or behavior of + functions; the minor version number represents one or more new drivers and + functions added to the library; and the build version number represents one or + more corrected bugs.</p> + +<pre class="function"><span class="mainFunction">char* cdVersionDate(void); [in C] +</span> +cd.VersionDate() -> (versiondate: string) [in Lua]</pre> +<p>Returns the release date of the current version of the library.</p> +<pre class="function"><span class="mainFunction">int cdVersionNumber(void); [in C] +</span> +cd.VersionNumber() -> (version: number) [in Lua]</pre> +<p>Returns the current version number of the library.</p> +<pre class="function">[in C] +<span class="mainFunction">CD_NAME</span> "CD - Canvas Draw" +<span class="mainFunction">CD_DESCRIPTION</span> "A 2D Graphics Library" +<span class="mainFunction">CD_COPYRIGHT</span> "Copyright (C) 1994-2007 Tecgraf/PUC-Rio and PETROBRAS S/A" +<span class="mainFunction">CD_VERSION</span> "5.0.0" +<span class="mainFunction">CD_VERSION_DATE</span> "2007/04/09" +<span class="mainFunction">CD_VERSION_NUMBER</span> 500000 + +[in Lua] +cd._NAME +cd._DESCRIPTION +cd._COPYRIGHT +cd._VERSION +cd._VERSION_DATE +cd._VERSION_NUMBER</pre> + + <p>Usefull definitions. They have the same value returned by <b>cdVersion</b>* + functions.</p> + +<hr> +<h2 align="center">Metafile Interpretation</h2> +<pre class="function"><span class="mainFunction">int cdCanvasPlay(cdCanvas* canvas, cdContext* ctx, int xmin, int xmax, int ymin, int ymax, void *data); [in C]</span> + +canvas:Play(ctx, xmin, xmax, ymin, ymax: number, data: string) -> (status: number) [in Lua]</pre> + + <p>Interprets the graphical contents (primitives and attributes) in a given + driver and calls equivalent functions of the CD library using the given + canvas. The primitives are drawn inside the region defined by the given + limits. If <font>limits are 0 (xmin</font>, <font>xmax</font>, + <font>ymin</font> and <font>ymax)</font> the primitives will be drawn with their coordinates having the original + values in the file. </p> + + <p>Only some drivers implement this function:</p> + + + <ul> + <li><a href="../drv/clipbd.html"><b> + CD_CLIPBOARD</b></a> = Clipboard, <font>data</font> is + ignored. </li> + <li><a href="../drv/wmf.html"><b> + CD_WMF</b></a> = Windows Metafile, <font>data</font> is + a <b>char*</b> for the string ''<i>filename</i>''. Works only in + the MS Windows system.</li> + <li><a href="../drv/emf.html"><b> + CD_EMF</b></a> = Windows Enhanced Metafile, <font>data</font> + is a <b>char*</b> for the string ''<i>filename</i>''. Works only in + the MS Windows system.</li> + <li><a href="../drv/cgm.html"><b> + CD_CGM</b></a> = Computer Graphics Metafile ISO, <font> + data</font> is a <b>char*</b> for the string ''<i>filename</i>''.</li> + <li><a href="../drv/mf.html"><b> + CD_METAFILE</b></a> = CD Metafile, <font>data</font> + is a <b>char*</b> for the string ''<i>filename</i>''.</li> + <li><a href="../drv/picture.html"><b> + CD_PICTURE</b></a> = CD Picture, <font>data</font> + is a <strong>cdCanvas</strong><b>*</b> of the Picture canvas.</li> + </ul> + +<pre class="function"><span class="mainFunction">int cdContextRegisterCallback(cdContext *ctx, int cb, int(*func)(cdCanvas* canvas, ...)); [in C]</span> + +cd.ContextRegisterCallback(ctx, cb: number, func: function) -> (status: number) [in Lua]</pre> + + <p>Used to customize the behavior of the <b><font>Play</font></b> + function. If you register a known callback function, it will be called during + the processing loop of <font>cdPlay</font>.</p> + <p>The callback should return <font>CD_CONTINUE</font>, if it + returns <font>CD_ABORT</font>, the <font>cdPlay</font> + function is aborted. The callback identifiers of a given driver must be in the + header file relative to that driver, with prefix "<font>CD_XXYYYCB</font>", + where <font>XX</font> identifies that driver and + <font>YYY</font> identifies the callback name.</p> + <p>There is a default callback common to all implementations of + <font>cdPlay</font>, <b>CD_SIZECB</b>. Its definition + is:</p> +<pre>int cdResizeCB(cdCanvas* canvas, int width, int height, double mm_width, double mm_height)</pre> +<p>It returns the size of the image in the + file before any function in the CD library is called, so that you can call the + <font>cdPlay</font> function without an active canvas and + create the canvas inside the callback. It works as a <b> + <font>cdCanvasGetSize</font></b> function.</p> + + +</body> + +</html>
\ No newline at end of file diff --git a/html/en/func/polygon.html b/html/en/func/polygon.html new file mode 100644 index 0000000..4e18664 --- /dev/null +++ b/html/en/func/polygon.html @@ -0,0 +1,87 @@ +<!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>Polygons</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Open, Closed and Filled Polygons,<br> +Bezier Lines and<br> +Regions Creation</h2> + + <p>The functions <font><strong>cdBegin</strong></font>, + <font><strong>cdVertex</strong></font> and <font> + <strong>cdEnd</strong></font> are use for many situations. + <font><strong>cdBegin</strong></font> is called once, + <font><strong>cdVertex</strong></font> can be called many + times, and <font><strong>cdEnd</strong></font> is called once + to actually do something. If you call <font><strong>cdBegin</strong></font> + again before <font><strong>cdEnd</strong></font> the process is + restarted, except for <strong><font>cdBegin(</font></strong><b>CD_REGION</b><strong><font>)</font></strong> + that can contains one or more polygons inside. </p> + +<hr> +<pre class="function"><span class="mainFunction">void <a name="cdBegin">cdCanvasBegin</a>(cdCanvas* canvas, int mode); [in C]</span> + +canvas:Begin(mode: number) [in Lua]</pre> + + <p>Starts defining a polygon to be drawn (or filled) according to the mode: + <b>CD_CLOSED_LINES</b>, <b>CD_OPEN_LINES</b>, <b>CD_FILL</b><strong><b>, + </b></strong><b>CD_CLIP, CD_REGION</b> or <strong><b>CD_BEZIER</b></strong>. + Do not create embedded polygons, that is, do not call function + <font><strong>cdBegin</strong></font> twice without a call to + <font><strong>cdEnd</strong></font> in between.</p> + +<ul> + <li><strong>CD_OPEN_LINES</strong><b>:</b> connects all the points at cdEnd. Depends + on line width and line style attributes. </li> + <li><b><b>CD_CLOSED_LINES:</b> </b>connects all the points at cdEnd and + connects the last point to the first. Depends on line width and line + style attributes. </li> + <li><b>CD_FILL:</b> connects the last point to the first and fills + the resulting polygon according to the current interior style. When the + interior style <strong><b>CD_HOLLOW</b></strong> is defined the it behaves + as if the mode were <b>CD_CLOSED_LINES</b><strong>.</strong></li> + <li><b>CD_CLIP: i</b>nstead of creating a polygon to be drawn, + creates a polygon to define a polygonal clipping region. </li> + <li><strong><b>CD_BEZIER:</b></strong><b> </b>defines the points of a bezier + curve. There must be at least 4 points: <i>start</i>, <i>control</i>, <i> + control</i> and <i>end</i>. To specify a sequence of curves use 3 more points + for each curve: <i>control</i>, <i>control</i>, <i>end</i>, <i>control</i>, <i> + control</i>, <i>end</i>, ... The end point is used as start point for the next + curve.</li> + <li><strong><b>CD_REGION</b></strong>: starts the creation of a complex + region for clipping. All calls to <font><strong>cdBox</strong></font>, + <font><strong>cdSector</strong></font>, <font> + <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> +</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> +<p align="center"><font size="4">Bezier Lines<br> +</font><img src="../../img/bezier.gif" border="2" width="241" height="220"></p> +<pre class="function"><span class="mainFunction">void <a name="cdVertex">cdCanvasVertex</a>(cdCanvas* canvas, int x, int y); [in C]</span> +void cdfCanvasVertex(cdCanvas* canvas, double x, double y); [in C] +void wdCanvasVertex(cdCanvas* canvas, double x, double y); (WC) [in C] + +canvas:Vertex(x, y: number) [in Lua] +canvas:wVertex(x, y: number) (WC) [in Lua]</pre> + + <p>Adds a vertex to the polygon definition.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdEnd">cdCanvasEnd</a>(cdCanvas* canvas); [in C]</span> + +canvas:End() [in Lua]</pre> + + <p>Ends the polygon's definition and draws it.</p> + + +</body> + +</html> diff --git a/html/en/func/region.html b/html/en/func/region.html new file mode 100644 index 0000000..e503733 --- /dev/null +++ b/html/en/func/region.html @@ -0,0 +1,83 @@ +<!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>Complex Clipping Regions</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Complex Clipping Regions</h2> + + <p>A complex region can composed of boxes, sectors, chords, polygons and + texts. It is implemented only in the Windows GDI, GDI+ and X-Windows base drivers.</p> + + <p>Complex clipping regions can be created using <font><strong> + cdBegin(</strong></font><b><tt>CD_REGION</tt></b><font><strong>)/(filled + primtives)/.../cdEnd()</strong></font>. For more about cdBegin and cdEnd see + <a href="polygon.html">Polygons</a>.</p> + <p>Between a <strong><font>cdBegin(</font></strong><b><tt>CD_REGION</tt></b><strong><font>)</font></strong> + and a <strong><font>cdEnd()</font></strong>, all calls to + <font><strong>cdBox</strong></font>, <font> + <strong>cdSector</strong></font>, <font><strong>cdChord, + cdBegin(CD_FILL)/cdVertex(x,y)/.../cdEnd()</strong></font> and + <font><strong>cdText</strong></font> will be composed in a + region for clipping. This is the only exception when you can call a + <font><strong>cdBegin</strong></font> after another + <font><strong>cdBegin</strong></font>.</p> + <p>When you call <font><strong>cdBegin(</strong></font><b><tt>CD_REGION</tt></b><strong><font>)</font></strong> + a new empty region will be created. So for the first operation you should use + <b><tt>CD_UNION</tt></b> or <b><tt>CD_NOTINTERSECT</tt></b> combine modes. + When you finished to compose the region call <font><strong> + cdEnd()</strong></font>.</p> + <p>To make the region active you must call <strong><font> + cdClip(</font></strong><b><tt>CD_CLIPREGION</tt></b><strong><font>)</font></strong>. + For other clipping regions see <a href="clipping.html">Clipping</a>.</p> +<p>Complex clipping regions are not saved by <strong>cdSaveState</strong>.</p> + +<hr> +<pre class="function"><span class="mainFunction">int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode); [in C]</span> + +canvas:RegionCombineMode(mode: number) -> (old_mode: number) [in Lua]</pre> + + <p>Changes the way regions are combined when created. Returns the previous + status. Values: <b><tt>CD_UNION, CD_INTERSECT, CD_DIFFERENCE or + CD_NOTINTERSECT</tt></b>. The value <b><tt>CD_QUERY</tt></b> simply returns + the current status. Default value: <b><tt>CD_UNION</tt></b>.</p> + <p align="center"><font size="4">Combine Modes<br> + </font><img src="../../img/regions.gif" border="2" width="297" height="361"></p> + +<pre class="function"><span class="mainFunction">int cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y); [in C]</span> + +canvas:IsPointInRegion(x, y: number) -> (status: number) [in Lua]</pre> + + <p>Returns a non zero value if the point is contained inside the current + region.</p> + +<pre class="function"><span class="mainFunction">void cdCanvasOffsetRegion(cdCanvas* canvas, int dx, int dy); [in C]</span> +void wdCanvasOffsetRegion(cdCanvas* canvas, double dx, double dy); (WC) [in C] + +canvas:OffsetRegion(dx, dy: number) [in Lua] +canvas:wOffsetRegion(dx, dy: number) (WC) [in Lua]</pre> + + <p>Moves the current region by the given offset. In X-Windows, if the region + moves to outside the canvas border, the part moved outside will be lost, the + region will need to be reconstruted.</p> + +<pre class="function"><span class="mainFunction">void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax); [in C]</span> +void wdCanvasGetRegionBox(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax); (WC) [in C] + +canvas:GetRegionBox() -> (xmin, xmax, ymin, ymax, status: number) [in Lua] +canvas:wGetRegionBox() -> (xmin, xmax, ymin, ymax, status: number) (WC) [in Lua]</pre> + + <p>Returns the rectangle of the bounding box of the current region. It is not + necessary to provide all return pointers, you can provide only the desired + values and <i><tt>NULL</tt></i> for the others.</p> + + +</body> + +</html> diff --git a/html/en/func/server.html b/html/en/func/server.html new file mode 100644 index 0000000..6663de5 --- /dev/null +++ b/html/en/func/server.html @@ -0,0 +1,84 @@ +<!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>Server Images</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Server Images</h2> + + <p>It is a high performance image compatible with a specific canvas. It is + faster than user image functions, but less flexible. It is commonly used for + off-screen drawing in Window Systems. </p> + <p>You can make gets and puts on several canvases but they must be created + using the same driver. It is possible to specify a part of the image to be + drawn, but it is not possible to zoom.</p> + <p>It is called "server" images because the data is stored in a system private + format, that the application (or the client) does not have access.</p> + <p>To create a server image there must be an active canvas of a driver with + server image support.</p> + +<hr> +<pre class="function"><span class="mainFunction">cdImage* <a name="cdCreateImage">cdCanvasCreateImage</a>(cdCanvas* canvas, int w, int h); [in C]</span> + +canvas:CreateImage(w, h: number) -> (image: cdImage) [in Lua]</pre> + + <p>Creates a compatible image with size = <b><tt>w x h</tt></b> pixels. A + compatible image has the same color representation (number of bits per pixel) + of the active canvas. Once the server image is created it is independent of + the active canvas. The server image can only be used with an other canvas of + the same type as the canvas that was active when the image was created. The + default background is the same as the canvas, <strong><tt>CD_WHITE</tt></strong>.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdKillImage">cdKillImage</a>(cdImage* image); [in C]</span> + +image:KillImage() [in Lua]</pre> + + <p>Liberates memory allocated for the image. If this function is not called in + Lua, the garbage collector will call it.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdGetImage">cdCanvasGetImage</a>(cdCanvas* canvas, cdImage* image, int x, int y); [in C]</span> + +canvas:GetImage(image: cdImage; x, y: number) [in Lua]</pre> + + <p>Copies a rectangular region from the current rectangular context to the + memory <strong>(</strong><b><tt>image</tt></b><strong>)</strong>. <b><tt>(x,y)</tt></b> + is the coordinate of the bottom left corner of the rectangular region. The + width and length of the rectangular region are defined in the image structure + (when the image is created).</p> + +<pre class="function"><span class="mainFunction">void <a name="cdPutImageRect">cdCanvasPutImageRect</a>(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax); [in C]</span> +void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax); (WC) [in C] + +canvas:PutImageRect(image: cdImage; x, y, xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wPutImageRect(image: cdImage; x, y, xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + + <p>Copies an image in a rectangular region of the canvas with the bottom left + corner in <tt><b>(x,y)</b></tt>. Allows specifying a rectangle inside the + image to be drawn, if <strong><font>xmin</font>, + <font>xmax</font>, <font>ymin</font> </strong> + and <strong><font>ymax</font></strong> are 0, then the whole + image is assumed.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdScrollArea">cdCanvasScrollArea</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy); [in C]</span> + +canvas:ScrollArea(xmin, xmax, ymin, ymax, dx, dy: number) [in Lua]</pre> + + <p>Copies the rectangle defined by the coordinates <b><tt>(xmin,ymin)</tt></b> + and <b><tt>(xmax,ymax)</tt></b> to the rectangle defined by <b><tt> + (xmin+dx,ymin+dy)</tt></b> and <b><tt>(xmax+dx,ymax+dy)</tt></b>. It has the + same effect as <b><tt>cdGetImage</tt></b> followed by <tt><b>cdPutImage</b></tt>, + but it should be faster and does not require the explicit creation of an image + to be executed. Note that the region belonging to the first rectangle, but not + to the second, remains unchanged (the function does not clean this region). + </p> + + +</body> + +</html>
\ No newline at end of file diff --git a/html/en/func/text.html b/html/en/func/text.html new file mode 100644 index 0000000..6243325 --- /dev/null +++ b/html/en/func/text.html @@ -0,0 +1,192 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<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>Text</title> +<link rel="stylesheet" type="text/css" href="../../style.css"> +</head> + +<body> + +<h2 align="center">Text</h2> + + <p>A raster text using a font with styles. The position the text is drawn depends on the text alignment attribute. </p> + <p>The library has at least 4 standard typefaces: "System" (which depends on the driver and platform), + "Courier" (mono spaced + with serif), "Times" (proportional with serif) and "Helvetica" (proportional without serif). Each typeface can have + some styles: Plain, <strong>Bold</strong>, <em>Italic</em> and a combination of <em><strong>Bold and Italic</strong></em>. + As an alternative to the standard typefaces, you can use other typefaces or native driver typefaces with the function + <strong>NativeFont</strong>, but they may work in a reduced set of drivers. + </p> + <p>You may retrieve the dimensions of the selected font with function <font> + <strong>GetFontDim</strong></font>. Also you + may retrieve the bounding box of a specific text before drawing by using the + <font><strong>GetTextSize</strong></font> + and <font><strong>GetTextBox</strong></font> functions. </p> + <p>The text is drawn using a reference point; you can change the alignment relative to this point using the + <font><strong>TextAligment</strong></font> function. </p> + +<hr> +<pre class="function"><span class="mainFunction">void <a name="cdText">cdCanvasText</a>(cdCanvas* canvas, int x, int y, const char* text); [in C]</span> +void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* text); [in C] +void wdCanvasText(cdCanvas* canvas, double x, double y, const char* text); (WC) [in C] + +canvas:Text(x, y: number, text: string) [in Lua] +canvas:fText(x, y: number, text: string) [in Lua] +canvas:wText(x, y: number, text: string) (WC) [in Lua]</pre> + + <p>Inserts a text in <b><tt>(x,y)</tt></b> according to the current font and + text alignment. It expects an ANSI string with no line breaks.</p> + +<h3>Attributes</h3> +<pre class="function"><span class="mainFunction">void <a name="cdFont">cdCanvasFont</a>(cdCanvas* canvas, const char* typeface, int style, int size); [in C]</span> +void wdCanvasFont(cdCanvas* canvas, const char* typeface, int style, double size); (WD) [in C] + +canvas:Font(typeface, style, size: number) [in Lua] +canvas:wFont(typeface, style, size: number) (WD) [in Lua]</pre> + + <p>Selects a text font. The font type can be one of the standard type faces or + other driver dependent type face. Since font face names are not a standard + between drivers, a few names are specially handled to improve application + portability. If you want to use names that work for all systems we recommend + using: "<strong>Courier</strong>", "<strong>Times</strong>" and "<strong>Helvetica</strong>".</p> +<p>The style can be a combination of: <strong>CD_PLAIN</strong>, + <strong>CD_BOLD</strong>, <strong>CD_ITALIC</strong>, <strong>CD_UNDERLINE</strong> + or <strong>CD_STRIKEOUT</strong>. Only the Windows and PDF drivers support underline and + strikeout. The size is provided in points (1/72 inch) or in pixels (using + negative values). </p> + <p>Default values: "<strong>System</strong>", <b>CD_PLAIN</b>, 12. </p> + <p>You can specify partial parameters using NULL, -1 and 0 for typeface, style + and size. When these parameters are specified the current font parameter is + used. For example: <b>CanvasFont(NULL, -1, 10)</b> will only change the font + size.</p> + <p>To convert between pixels and points use the function <strong> + <font>cdPixel2MM</font> + </strong>to convert from pixels to millimeters and use the formula "<strong>(value in <em>points</em>) = CD_MM2PT * + (value in millimeters)</strong>".</p> + <p>In WC, the size is specified in millimeters, but is internally converted to points.</p> +<p>Fonts can heavily benefit from the ANTIALIAS attribute where available in the +driver.</p> + <div align="center"> + <center> + <table border="0" cellpadding="5" cellspacing="8" style="border-collapse: collapse" bordercolor="#111111"> + <tr> + <td> + <p align="center"><font size="4">Type Faces</font><br> + <img src="../../img/fonts.gif" border="2" width="140" height="125"> </td> + <td> + <p align="center"><font size="4">Font Styles</font><br> + <img src="../../img/font_style.gif" border="2" width="135" height="122"> </td> + </tr> + </table> + </center> + </div> + +<pre class="function"><span class="mainFunction">void <a name="cdGetFont">cdCanvasGetFont</a>(cdCanvas* canvas, char* typeface, int *style, int *size); [in C]</span> +void wdCanvasGetFont(cdCanvas* canvas, char* typeface, int *style, double *size); (WC) [in C] + +canvas:GetFont() -> (typeface: string, style, size: number) [in Lua] +canvas:wGetFont() -> (typeface: string, style, size: number) (WC) [in Lua]</pre> + + <p>Returns the values of the current font. It is not necessary to provide all + return pointers; you can provide only the desired values.</p> + <p>In WC, the size is returned in millimeters.</p> + +<pre class="function"><span class="mainFunction">char* <a name="cdNativeFont">cdCanvasNativeFont</a>(cdCanvas* canvas, const char* nativefont); [in C]</span> + +canvas:NativeFont(font: string) -> (old_font: string) [in Lua]</pre> + + <p>Selects a font based on a string description. The description can depend on the driver + and the platform, but a common definition is available for all drivers. It + does not need to be stored by the application, as it is internally replicated + by the library. The string is case sensitive. It returns the previous string. </p> +<p>The string is parsed and the font typeface, style and size are set according +to the parsed values, as if <strong>cdCanvasFont</strong> was called. The native font string is +cleared when a font is set +using <strong>cdCanvasFont</strong>.</p> +<p>The common format definition is similar to the the <a href="http://www.pango.org/"> +Pango</a> library Font Description, used by GTK+2. It is defined as having 3 parts: <font +family>, <font styles> <font size>. For ex: "Times, Bold 18", or +"Arial,Helvetica, Italic Underline -24". The supported styles include: +Bold, Italic, Underline and Strikeout. Underline, Strikeout, and negative +pixel values are not supported by the standard Pango Font Description. The Pango +format include many other definitions not supported by the CD format, they are +just ignored.</p> +<p>The IUP "FONT" attribute internal formats are also accepted in all drivers +and platforms.</p> + <p>Using "NULL" as a parameter, it only returns the previous string and does not change the font. The value returned + is the last attributed value, which may not correspond exactly to the font selected by the driver.</p> + + <p>Using "(char*)CD_QUERY" as a parameter, it returns the current selected + font in the common format definition.</p> + +<pre class="function"><span class="mainFunction">int <a name="cdTextAlignment">cdCanvasTextAlignment</a>(cdCanvas* canvas, int alignment); [in C]</span> + +canvas:TextAlignment(alignment: number) -> (old_alignment: number) [in Lua]</pre> + + <p>Defines the vertical and horizontal alignment of a text as: <b><tt>CD_NORTH</tt></b>, <b><tt>CD_SOUTH</tt></b>, <b> + <tt>CD_EAST</tt></b>, <b><tt>CD_WEST</tt></b>, <b><tt>CD_NORTH_EAST</tt></b>, <b><tt>CD_NORTH_WEST</tt></b>, <b><tt> + CD_SOUTH_EAST</tt></b>, <b><tt>CD_SOUTH_WEST</tt></b>, <b><tt>CD_CENTER</tt></b>, <b><tt>CD_BASE_LEFT</tt></b>, <b> + <tt>CD_BASE_CENTER</tt></b>, or <b><tt>CD_BASE_RIGHT</tt></b>. Returns the previous value. Default value: <b><tt> + CD_BASE_LEFT</tt></b>. Value <tt><b>CD_QUERY</b> </tt>simply returns the current value.</p> + <p align="center"><font size="4">Text Alignment</font><br> + <img src="../../img/align.gif" border="2" width="273" height="227"></p> + +<pre class="function"><span class="mainFunction">double <a name="cdTextOrientation">cdCanvasTextOrientation</a>(cdCanvas* canvas, double angle); [in C]</span> + +canvas:TextOrientation(angle: number) -> (old_angle: number) [in Lua]</pre> + + <p>Defines the text orientation, which is an angle provided in degrees relative to the horizontal line according to + which the text is drawn. Returns the previous value. Value <tt><b>CD_QUERY</b> </tt>simply returns the current value. + The default value is 0.</p> + +<h3>Properties</h3> +<pre class="function"><span class="mainFunction">void <a name="cdFontDim">cdCanvasGetFontDim</a>(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent); [in C]</span> +void wdCanvasGetFontDim(cdCanvas* canvas, double *max_width, double *height, double *ascent, double *descent); (WC) [in C] + +canvas:GetFontDim() -> (max_width, height, ascent, descent: number) [in Lua] +canvas:wGetFontDim() -> (max_width, height, ascent, descent: number) (WC) [in Lua]</pre> + + <p>Returns the maximum width of a character, the line's height, the <i>ascent</i> and <i>descent</i> of the + characters of the currently selected font. The line's height is the sum of the <i> + ascent</i> and <i>descent</i> of a + given additional space (if this is the case). All values are given in pixels + and are positive. It is not necessary to provide all return pointers, you can provide only + the desired values and <i><tt>NULL</tt></i> for the others.</p> + <p align="center"><font size="4">Font Dimension Attributes<br> + </font><img src="../../img/font_dim.gif" border="2" width="300" height="139"></p> + +<pre class="function"><span class="mainFunction">void <a name="cdTextSize">cdCanvasGetTextSize</a>(cdCanvas* canvas, const char* text, int *width, int *height); [in C]</span> +void wdCanvasGetTextSize(cdCanvas* canvas, const char* text, double *width, double *height); (WC) [in C] + +canvas:GetTextSize(text: string) -> (width, heigth: number) [in Lua] +canvas:wGetTextSize(text: string) -> (width, heigth: number) (WC) [in Lua]</pre> + + <p>Returns the width and height of a text's minimum box with the currently selected font. If the driver does not + support this kind of query, the values will be given 0 (zero). It is not necessary to provide all return pointers, you + can provide only the desired values and <i><tt>NULL</tt></i> for the others.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTextBox">cdCanvasGetTextBox</a>(cdCanvas* canvas, int x, int y, const char* text, int *xmin, int *xmax, int *ymin, int *ymax); [in C]</span> +void wdCanvasGetTextBox(cdCanvas* canvas, double x, double y, const char* text, double *xmin, double *xmax, double *ymin, double *ymax); (WC) [in C] + +canvas:GetTextBox(x, y: number, text: string) -> (xmin, xmax, ymin, ymax: number) [in Lua] +canvas:wGetTextBox(x, y: number, text: string) -> (xmin, xmax, ymin, ymax: number) (WC) [in Lua]</pre> + + <p>Returns the horizontal bounding rectangle of a text box, even if the text has an orientation. It is not necessary + to provide all return pointers, you can provide only the desired values and <i><tt>NULL</tt></i> for the others.</p> + +<pre class="function"><span class="mainFunction">void <a name="cdTextBounds">cdCanvasGetTextBounds</a>(cdCanvas* canvas, int x, int y, const char *text, int *rect); [in C]</span> +void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char* text, double *rect); (WC) [in C] + +canvas:GetTextBounds(x, y: number, text: string) -> (rect0, rect1, rect2, rect3, rect4, rect5, rect6, rect7: number) [in Lua] +canvas:wGetTextBounds(x, y: number, text: string) -> (rect0, rect1, rect2, rect3, rect4, rect5, rect6, rect7: number) (WC) [in Lua]</pre> + + <p>Returns the oriented bounding rectangle of a text box. The rectangle corners are returned in counter-clock wise + order starting with the bottom left corner, (x,y) arranged (x0,y0,x1,y1,x2,y2,x3,y3).</p> + + +</body> + +</html>
\ No newline at end of file diff --git a/html/en/func/vectortext.html b/html/en/func/vectortext.html new file mode 100644 index 0000000..e1b1d6e --- /dev/null +++ b/html/en/func/vectortext.html @@ -0,0 +1,133 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>Vector Text</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">Vector Text</h2> + <p>It is a text that uses a font created only with line segments. It is very + useful to be scaled and very fast. You must set the text size before drawing + any text. The functions ignore the new line character "\n"; only the <font>wdMultiLineVectorText</font> + function will consider this character. The default direction is horizontal from + left to right.</p> + <p align="center"><font size="4">Vector Text Parameters</font><br> + <img src="../../img/vector_text.gif" align="middle" border="2" width="101" height="91"></p> + <p>All vector text drawing in all drivers are simulated using other CD + primitives.</p> + <hr> + <pre class="function"><span class="mainFunction">void <a name="cdVectorText">cdCanvasVectorText</a>(cdCanvas* canvas, int x, int y, const char* text); [in C]</span> +void wdCanvasVectorText(cdCanvas* canvas, double x, double y, const char* text); (WC) [in C] + +canvas:VectorText(x, y: number, text: string) [in Lua] +canvas:wVectorText(x, y: number, text: string) (WC) [in Lua]</pre> + <p>Draws a vector text in position <tt><b>(x,y)</b></tt>, respecting the + alignment defined by <font><strong>cdTextAlignment</strong></font>. It ignores + the configuration <font><strong>cdBackOpacity</strong></font>, being always + transparent. It also ignores strings with multiple lines. It is ESSENTIAL to + call <font><strong>cdVectorTextSize</strong></font> or <font><strong>cdVectorCharSize</strong></font> + before using <font><strong>cdVectorText</strong></font> or <font><strong>cdMultiLineVetorText</strong></font>.</p> + <pre class="function"><span class="mainFunction">void <a name="cdMultiLineVectorText">cdCanvasMultiLineVectorText</a>(cdCanvas* canvas, int x, int y, const char* text); [in C]</span> +void wdCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const char* text); (WC) [in C] + +canvas:MultiLineVectorText(x, y: number, text: string) [in Lua] +canvas:wMultiLineVectorText(x, y: number, text: string) (WC) [in Lua]</pre> + <p>Draws a vector text with several lines in position <b><tt>(x,y)</tt></b>, + respecting the alignment defined by <font><strong>cdTextAlignment</strong></font>. + It ignores the configuration <font><strong>cdBackOpacity</strong></font>, being + always transparent. Lines are broken by characters <font>"\n"</font>. Each line + respects the scale defined in <font><strong>cdVectorTextSize</strong></font> or <font> + <strong>cdVectorCharSize</strong></font>. This function's purpose is to make + function <strong><font>cdVectorText</font></strong> more efficient, not being + concerned with multiple lines.</p> + <h3>Attributes</h3> + <pre class="function"><span class="mainFunction">void <a name="cdVectorTextDirection">cdCanvasVectorTextDirection</a>(cdCanvas* canvas, int x1, int y1, int x2, int y2); [in C]</span> +void wdCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2); (WC) [in C] + +canvas:VectorTextDirection(x1, y1, x2, y2: number) [in Lua] +canvas:wVectorTextDirection(x1, y1, x2, y2: number) (WC) [in Lua]</pre> + <p>Defines the text direction by means of two points, <b><tt>(x1,y1)</tt></b> and <b> + <tt>(x2,y2)</tt></b>. The default direction is horizontal from left to right.</p> + <pre class="function"><span class="mainFunction">double* <a name="cdVectorTextTransform">cdCanvasVectorTextTransform</a>(cdCanvas* canvas, const double* matrix); [in C]</span> + +canvas:VectorTextTransform(matrix: table) -> (old_matrix: table) [in Lua] </pre> + <p>Defines a transformation matrix with 6 elements. If the matrix is NULL, no + transformation is set. The default direction is no transformation. The origin + is the left bottom corner of matrix. It returns the previous matrix, and the + returned vector is only valid until the following call to the function.</p> + <p>The matrix contains scale, rotation and translation elements. It is applied after + computing the position and orientation normal to the vector text. We can + describe the elements as follows:</p> + <pre>|x'| | scl_x*cos(ang) -sin(ang) trans_x | |x| | 3 4 5| +|y'| = | sin(ang) scl_y*cos(ang) trans_y | * |y| with indices | 0 1 2| + |1|</pre> + <pre class="function"><span class="mainFunction">void <a name="cdVectorTextSize">cdCanvasVectorTextSize</a>(cdCanvas* canvas, int w, int h, const char * text); [in C]</span> +void wdCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const char* text); (WC) [in C] + +canvas:VectorTextSize(w, h: number, text: string) [in Lua] +canvas:wVectorTextSize(w, h: number, text: string) (WC) [in Lua]</pre> + <p>Modifies the scale of the vector text so that it corresponds to the string of + the bounding box defined by <b><tt>w</tt></b> and <b><tt>h</tt></b>. It ignores + strings with multiple lines.</p> + <pre class="function"><span class="mainFunction">double <a name="cdVectorCharSize">cdCanvasVectorCharSize</a>(cdCanvas* canvas, int size); [in C]</span> +double wdCanvasVectorCharSize(double size); (WC) [in C] + +canvas:VectorCharSize(size: number) -> (old_size: number) [in Lua] +canvas:wVectorCharSize(size: number) -> (old_size: number) (WC) [in Lua]</pre> + <p>Sets the height of the characters and adjusts the width according to it. + Returns the previous value. <strong><tt>CD_QUERY</tt></strong> returns the + current value.</p> + <pre class="function"><span class="mainFunction">char* <a name="cdVectorFont">cdCanvasVectorFont</a>(cdCanvas* canvas, const char *filename); [in C]</span> + +canvas:VectorFont(filename: string) -> (fontname: string) [in Lua]</pre> + <p>Replaces the current vector font with a font stored in a file with a given + name. Returns the name of the font loaded or NULL, if it fails. If <font>filename</font> + is NULL, it activates the default font "<b>Simplex II</b>" (There is no file + associated to this font, it is an embedded font). The library will attempt to + load a font from the current directory, if it fails then it will try the + directory defined by the environment variable "<strong><tt>CDDIR</tt></strong>", + if it fails, it will attempt to + load it using the <font>filename</font> as a string containing the font as + if the file was loaded into that string, if it fails again the font is reset + to the default font and returns NULL. The file format is + compatible with the GKS file format (text mode).</p> + <h3>Properties</h3> + <pre class="function"><span class="mainFunction">void <a name="cdGetVectorTextSize">cdCanvasGetVectorTextSize</a>(cdCanvas* canvas, const char* text, int *w, int *h); [in C]</span> +void wdCanvasGetVectorTextSize(cdCanvas* canvas, const char* text, double *x, double *y); (WC) [in C] + +canvas:GetVectorTextSize(text: string) -> (w, h: number) [in Lua] +canvas:wGetVectorTextSize(text: string) -> (w, h: number) (WC) [in Lua]</pre> + <p>Queries the string's bounding box. Ignores strings with multiple lines. It is + not necessary to provide all return pointers, you can provide only the desired + values and <font>NULL</font> for the others.</p> + <pre class="function"><span class="mainFunction">void <a name="cdGetVectorTextBounds">cdCanvasGetVectorTextBounds</a>(cdCanvas* canvas, char* text, int px, int py, int *rect); [in C]</span> +void wdCanvasGetVectorTextBounds(cdCanvas* canvas, char* text, double x, double y, double *rect); (WC) [in C] + +canvas:GetVectorTextBounds(text: string, px,py: number) -> (rect: table) [in Lua] +canvas:wGetVectorTextBounds(text: string, px,py: number) -> (rect: table) (WC) [in Lua] </pre> + <p>Returns the bounding rectangle of the text specified in the current vector + font, alignment and direction. Eight values are returned, corresponding to + pairs (x,y) of the rectangle's vertices ordered conter-clockwise, starting by + the bottom left corner.</p> + <h3>Character Codes</h3> + <p>The old GKS format contains ASCII codes so a convertion from ANSI to ASCII is + done when possible, unmapped characters are left unchanged, but some rearrage + was necessary to acomodate the convertion. + </p> + <p>The default vector font was changed from the original Simplex II to contain + all ANSI accented characters. So some ASCII characters were replaced.</p> + <p>Bellow is the character code table of the default font.</p> + <p style="TEXT-ALIGN: center"> + <img src="../../img/vectorfont_default.png" width="717" height="977"><br> + <strong>Default Font</strong></p> + <p>The original Simplex II font is available in the file + "cd/etc/vectorfont00.txt". Bellow is the character code table of the original + font (the table displays the characters after the convertion from ANSI to + ASCII):</p> + <p style="TEXT-ALIGN: center"> + <img src="../../img/vectorfont_simplex2.png" width="723" height="978"><br> + <strong>Original Simplex II</strong></p> + </body> +</html>
\ No newline at end of file diff --git a/html/en/func/wd.html b/html/en/func/wd.html new file mode 100644 index 0000000..9c83ec5 --- /dev/null +++ b/html/en/func/wd.html @@ -0,0 +1,80 @@ +<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> + <head> + <title>World Coordinates</title> + <meta http-equiv="Content-Language" content="en-us"> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <link rel="stylesheet" type="text/css" href="../../style.css"> + </head> + <body> + <h2 align="center">World Coordinates</h2> + <p>Allows the use of a World Coordinate System. In this system you can attribute + coordinates to any unit you want. After you define a window (rectangular + region) in your world, each given coordinate is then mapped to canvas + coordinates to draw the primitives. You can define a viewport in your canvas to + change the coordinate mapping from world to canvas. The image below shows the + relation between Window and Viewport.</p> + <p align="center"><font size="4">Window x Viewport</font><br> + <img src="../../img/wc-dc.gif" border="2" width="330" height="182"></p> + <p>If you want to map coordinates from one system to another, use the <font>wdWorld2Canvas</font> + e <font>wdCanvas2World</font> functions. + </p> + <p>The quality of the picture depends on the conversion from World to Canvas, so + if the canvas has a small size the picture quality will be poor. To increase + picture quality create a canvas with a larger size, if possible.</p> + <p>All World Coordinate drawing in all drivers are simulated using other CD + primitives.</p> + <hr> + <pre class="function"><span class="mainFunction">void <a name="wdWindow">wdCanvasWindow</a>(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax); [in C]</span> + +canvas:wWindow(xmin, xmax, ymin, ymax: number) [in Lua]</pre> + <p>Configures a window in the world coordinate system to be used to convert world + coordinates (with values in real numbers) into canvas coordinates (with values + in integers). The default window is the size in millimeters of the whole + canvas.</p> + <pre class="function"><span class="mainFunction">void <a name="wdGetWindow">wdCanvasGetWindow</a>(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax); [in C]</span> + +canvas:wGetWindow() -> (xmin, xmax, ymin, ymax: number) [in Lua]</pre> + <p>Queries the current window in the world coordinate system being used to + convert world coordinates into canvas coordinates (and the other way round). It + is not necessary to provide all return pointers, you can provide only the + desired values.</p> + <pre class="function"><span class="mainFunction">void <a name="wdViewport">wdCanvasViewport</a>(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax); [in C]</span> + +canvas:wViewport(xmin, xmax, ymin, ymax: number) [in Lua]</pre> + <p>Configures a viewport in the canvas coordinate system to be used to convert + world coordinates (with values in real numbers) into canvas coordinates (with + values in integers). The default viewport is the whole canvas <font>(0,w-1,0,h-1)</font>. + If the canvas size is changed, the viewport will not be automatically updated. + </p> + <pre class="function"><span class="mainFunction">void <a name="wdGetViewport">wdCanvasGetViewport</a>(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax); [in C]</span> + +canvas:wGetViewport() -> (xmin, xmax, ymin, ymax: number) [in Lua]</pre> + <p>Queries the current viewport in the world coordinate system being used to + convert world coordinates into canvas coordinates (and the other way round). It + is not necessary to provide all return pointers, you can provide only the + desired values and <font>NULL</font> for the others.</p> + <pre class="function"><span class="mainFunction">void <a name="wdWorld2Canvas">wdCanvasWorld2Canvas</a>(cdCanvas* canvas, double xw, double yw, int *xv, int *yv); [in C]</span> + +canvas:wWorld2Canvas(xw, yw: number) -> (xv, yv: number) [in Lua]</pre> + <p>Converts world coordinates into canvas coordinates. It is not necessary to + provide all return pointers, you can provide only the desired values and <font>NULL</font> + for the others.</p> + <pre class="function"><span class="mainFunction">void <a name="wdCanvas2World">wdCanvasCanvas2World</a>(cdCanvas* canvas, int xv, int yv, double *xw, double *yw); [in C]</span> + +canvas:wCanvas2World(xv, yv: number) -> (xw, yw: number) [in Lua]</pre> + <p>Converts canvas coordinates into world coordinates. It is not necessary to + provide all return pointers, you can provide only the desired values and <font>NULL</font> + for the others.</p> + <h3>Extra</h3> + <pre class="function"><span class="mainFunction">void <a name="wdHardcopy">wdCanvasHardcopy</a>(cdCanvas *canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy)); [in C]</span> + +canvas:wCanvasHardcopy(ctx: number, data: string or userdata, draw_func: function) [in Lua]</pre> + <p>Creates a new canvas, prepares Window and Viewport according to + the provided canvas, maintaining the aspect ratio and making the drawing occupy + the largest possible area of the new canvas, calls the drawing function (which + must use routines in WC) and, finally, removes the new canvas.</p> + <p>It is usually used for "hard copies" of drawings (print equivalent copy). The + most common used contexts are Printer, PS and PDF.</p> + </body> +</html> |