Primitives
void
cdPixel(int x, int y, long int color); [in C]
void wdPixel(double x, double y, long int color); (WC) [in
C]
cdPixel(x, y: number, color: color_tag) [in Lua]
wdPixel(x, y: number, color: color_tag)
(WC) [in Lua]
Configures the pixel (x,y) with the color defined by color.
void
cdMark(int x, int y); [in C]
void wdMark(double x, double y); (WC) [in C]
cdMark(x, y: number) [in Lua]
wdMark(x, y: number)
(WC) [in Lua]
Draws a mark in (x,y) using the current foreground color. It is not possible to use this function between a call to functions cdBegin and cdEnd if the type of mark is set to CD_DIAMOND. If the active driver does not include this primitive, it will be simulated using other primitives from the library, such as cdLine.
If you will call function cdMark or wdMark several times in a sequence, then it is recommended that the application changes the filling and line attributes to those used by the cdMark function:
cdInteriorStyle(CD_SOLID);
cdLineStyle(CD_CONTINUOUS);
cdLineWidth(1);This will greatly increase this function's performance. Also in this case, if the mark is very small, we suggest using the cdPixel function so that the application itself draws the mark. In many cases, this also increases this function's performance.
void
cdLine(int x1, int y1, int x2, int y2); [in C]
void wdLine(double x1, double y1, double x2, double y2);
(WC) [in C]
cdLine(x1, y1, x2, y2: number) [in Lua]
wdLine(x1, y1, x2, y2: number)
(WC) [in Lua]
Draws a line from (x1,y1) to (x2,y2) using the current foreground color and line width and style. Both points are included in the line.
void
cdBegin(int mode); [in C]
cdBegin(mode: number) [in Lua]
Starts defining a polygon to be drawn (or filled) according to the mode: CD_CLOSED_LINES, CD_OPEN_LINES, CD_FILL or CD_CLIP. Do not create embedded polygons, that is, do not call function cdBegin twice without a call to cdEnd in between.
The CD_CLOSED_LINES mode connects the last point to the first.
Mode CD_FILL connects the last point to the first and fills the resulting polygon according to the current interior style. The other two styles depend on line width and style attributes.
Instead of creating a polygon to be drawn, CD_CLIP creates a polygon to define a non-rectangular clipping region. This works only in some systems that include this feature.
When the interior style CD_HOLLOW is defined and the mode is CD_FILL, then the function behaves as if the mode were CD_CLOSED_LINES.
void
cdVertex(int x, int y); [in C]
void wdVertex(double x, double y); (WC) [in C]
cdVertex(x, y: number) [in Lua]
wdVertex(x, y: number)
(WC) [in Lua]
Adds a vertex to the polygon definition.
void cdEnd(void);
[in C]
cdEnd() [in Lua]
Ends the polygon's definition and draws (or fills) it.
void
cdRect(int xmin, int xmax, int ymin, int ymax);
[in C]
void wdRect(double xmin, double xmax, double ymin, double
ymax); (WC) [in C]
cdRect(xmin, xmax, ymin, ymax: number) [in Lua]
wdRect(xmin, xmax, ymin, ymax: number)
(WC) [in Lua]
Draws a rectangle with no filling. All points in the limits of interval x_min<=x<=x_max, y_min<=y<=y_max 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 cdLine primitive.
void cdBox(int
xmin, int xmax, int ymin, int ymax); [in C]
void wdBox(double xmin, double xmax, double ymin, double
ymax); (WC) [in C]
cdBox(xmin, xmax, ymin, ymax: number) [in Lua]
wdBox(xmin, xmax, ymin, ymax: number) (WC)
[in Lua]
Fills a rectangle according to the current interior style. All points in the interval x_min<=x<=x_max, y_min<=y<=y_max will be painted. When the interior style CD_HOLLOW is defined, the function behaves like its equivalent cdRect.
void cdArc(int
xc, int yc, int w, int h, double angle1, double angle2); [in C]
void wdArc(double xc, double yc, double w, double h,
double angle1, double angle2); (WC) [in C]
cdArc(xc, yc, w, h, angle1, angle2: number) [in Lua]
wdArc(xc, yc, w, h, angle1, angle2: number)
(WC) [in Lua]
Draws the arc of an ellipse aligned with the axis, using the current foreground color and line width and style. The coordinate (xc,yc) defines the center of the ellipse. Dimensions w and h define the elliptic axes X and Y, respectively. Angles angle1 and angle2, in degrees define the arc's beginning and end. The arc starts at the point (xc+(w/2)*cos(angle1),yc+(h/2)*sin(angle1)) and ends at (xc+(w/2)*cos(angle2),yc+(h/2)*sin(angle2)). A complete ellipse can be drawn using 0 and 360 as the angles. To specify the angle in radians, you can use the definition CD_RAD2DEG to multiply the value in radians before passing the angle to CD.
void
cdSector(int xc, int yc, int w, int h, double
angle1, double angle2); [in C]
void wdSector(double xc, double yc, double w, double h,
double angle1, double angle2); (WC) [in C]
cdSector(xc, yc, w, h, angle1, angle2: number) [in Lua]
wdSector(xc, yc, w, h, angle1, angle2: number)
(WC) [in Lua]
Fills the arc of an ellipse aligned with the axis, according to the current interior style. The coordinate (xc,yc) defines the center of the ellipse. Dimensions w and h define the elliptic axes X and Y, respectively. Angles angle1 and angle2, in degrees, define the arc's beginning and end. The arc starts at the point (xc+(w/2)*cos(angle1),yc+(h/2)*sin(angle1)) and ends at (xc+(w/2)*cos(angle2),yc+(h/2)*sin(angle2)). The angles are given in degrees. A complete ellipse can be drawn using 0 and 360 as the angles. To specify the angle in radians, you can use the definition CD_RAD2DEG to multiply the value in radians before passing the angle to CD. When the interior style CD_HOLLOW is defined, the function behaves like its equivalent cdArc.
void
cdText(int x, int y, char *text); [in C]
void wdText(double x, double y, char *s); (WC) [in C]
cdText(x, y: number, text: string) [in Lua]
wdText(x, y: number, text: string)
(WC) [in Lua]
Inserts a text in (x,y) according to the current background opacity, font and text alignment. Ignores characters "\n" to create multiple lines. In all cases, the text's drawing functions wait for a string in ANSI standard (Windows, MAC and UNIX). Strings with ASCII codes over 128 will appear with the wrong characters.
Vector Text
void
cdVectorText(int x, int y,
const char *text); [in C]
void wdVectorText(double x, double y, char * s); (WC) [in
C]
cdVectorText(x, y: number, text: string) [in Lua]
wdVectorText(x, y: number, text: string)
(WC) [in Lua]
Draws a vector text in position (x,y), respecting the alignment defined by cdTextAlignment. It ignores the configuration cdBackOpacity, being always transparent. It also ignores strings with multiple lines. It is ESSENTIAL to call cdVectorTextSize or cdVectorCharSize before using cdVectorText or cdMultiLineVetorText.
void
cdMultiLineVectorText(int
x, int y, const char *text); [in C]
void wdMultiLineVectorText(double x, double y, char * s);
(WC) [in C]
cdMultiLineVectorText(x, y: number, text: string) [in Lua]
wdMultiLineVectorText(x, y: number, text: string)
(WC) [in Lua]
Draws a vector text with several lines in position (x,y), respecting the alignment defined by cdTextAlignment. It ignores the configuration cdBackOpacity, being always transparent. Lines are broken by characters "\n". Each line respects the scale defined in cdVectorTextSize or cdVectorCharSize. This function's purpose is to make function cdVectorText more efficient, not being concerned with multiple lines.