Go to the first, previous, next, last section, table of contents.


EZD -- Base Class for EZD Graphic Objects

SYNOPSIS

#include <CNCL/EZD.h>

TYPE

CN_EZD

BASE CLASSES

CNNamed

DERIVED CLASSES

EZDDrawing, EZDObject, EZDPushButton, ...

RELATED CLASSES

None

DESCRIPTION


EZD is the base class for EZD graphic objects. It manages the access to EZD's I/O streams and provides the EZD drawing primitives. For additional information about EZD, refer to the manual pages of EZD.
Constructors:

EZD();
EZD(CNParam *param);
EZD(const CNStringR name);
Initializes and opens the pipe to the EZD process.


In addition to the member functions required by CNCL, EZD provides:

static ostream & out();
Connects the stream from the program to the EZD process.
static istream & in();
Connects the stream from the EZD process to the program.
static void draw_point(int x, int y, const CNStringR col)
Draws a point at position (x,y) in color col.
static void draw_line(int x1, int y1, int x2, int y2, const CNStringR col, int width = -1);
static void draw_dash_line(int x1, int y1, int x2, int y2, const CNStringR col, int width = -1);
Draws a (dashed) line from point (x1,y1) to point (x2,y2) in color col and width pixels wide. If width is <= 0, the minimum of one pixel is used for it.
static void draw_arc(int x, int y, int w, int h, int a1, int a2, const CNStringR col,
int width = -1);
Draws an unfilled arc. (x,y) are the minimum coordinates of the rectangle defining the arc. The arc's rectangle size is width w by height h. The arc starts at a1 degrees and spans a2 degrees - all angles are measured in the positive mathematical sense, the positive x-axis is the reference axis. The drawing color is col and the line width is width. If width <= 0 EZD's default value (1 pixel) is used.
static void draw_fill_arc(int x, int y, int w, int h, int a1, int a2, const CNStringR col);
Draws a filled arc (end-point to end-point of the arc). (x,y) are the minimum coordinates of the rectangle defining the arc. The arcs rectangle size is width w by heigth h. The arc starts at a1 degrees and spans a2 degrees - all angles measured in positive mathematical sense, the positive x-axis is the reference axis. The drawing color is col.
static void draw_pie_arc(int x, int y, int w, int h, int a1, int a2, const CNStringR col);
Draws an arc (the arc is closed by drawing a line from each arc end point to the center of the rectangle defining the arc). (x,y) are the minimum coordinates of the rectangle defining the arc. The arcs rectangle size is width w by heigth h. The arc starts at a1 degrees and spans a2 degrees - all angles measured in positive mathematical sense, the positive x-axis is the reference axis. The drawing color is col.
static void draw_rectangle(int x, int y, int w, int h, const CNStringR col, int width = -1);
Draws an unfilled rectangle. (x,y) are the minimum coordinates. The size is defined by its width w and its heigth h. The drawing color is col and the line width is width. If width is <= 0 EZD's default value (1 pixel) is used.
static void draw_fill_rectangle(int x, int y, int w, int h, const
CNStringR col);
static void draw_fill_rectangle(int x, int y, int w, int h, const CNStringR col,
CNStringR stipple);
Draws a filled rectangle. (x,y) are the minimum coordinates. The size is defined by its width w and its heigth h. The drawing color is col.
static void draw_text(int x, int y, const CNStringR text, const CNStringR col,
const CNStringR font);
static void draw_text(int x, int y, int w, int h, const CNStringR align, const CNStringR text,
const CNStringR col, const CNStringR font);
Writes text in the current drawing. (x,y) are the minimum coordinates of the rectangle containing the text. col and font describe color and font of the text. The optional width w, heigth h and alignment information describe the size of this rectangle and how the text has to be positioned in it. If the text does not fit in, no text is displayed at all.
NOTE: Alternate functions with const char * args instead of CNStringR are supplied for g++ 2.5.8, because g++ 2.5.8 generates buggy code at least for calls to the 2nd draw_text() with string constants "abc" args. Some of the temporary CNStrings are freed twice.
static void draw_bitmap(int x, int y, CNStringR filename, CNStringR color1 = "black",
CNStringR color2= "");
static void draw_bitmap(int x, int y, int w, int h, CNStringR filename,
CNStringR color1 = "black", CNStringR color2= "");
Draws the bitmap for the file filename at position x,y in width w and height h. The bits that are on are drawn in color1, those which are off in color2.
NOTE: The file must contain an X11 bitmap, a monochrome portable bitmap (PBM, type P1), a gray scale portable bitmap (PGM, type P2), or a color portable bitmap (PPM, type P3).
NOTE: Same problem with g++ 2.5.8 as described at the method draw_text().
static void draw_now();
Causes any buffered changes to be drawn immideately.
static void draw_clear();
Clears the current drawing.
static void pause(int msec);
Forces out any buffered changes and stops reading commands from stdin until either msec milliseconds pass or some event action issues a quit command.
static CNString event();
Reads event from pipe in EZD.
static bool test_event();
Returns true if there are ready descriptors in the I/O descriptor sets (see also: CNSelect or man pages to "select(2)" system call)
static void set_scale(const float xscale_x, const float xscale_y, const int xorigin_x,
const int xorigin_y);
static int x2pix(const float x);
static int y2pix(const float y);
In some applications it is necessary to map a drawing with a cartesian coordinate system onto a window which uses pixels. set_scale specifies the scale factor (default: scale (x,y) = (1.0,1.0), origin (x,y) = (0,0)). x2pix and y2pix evaluate the coordinate transformation for the given values (x,y) by the formula (value * scale + origin), rounded to an integer.
static void print_window(CNStringR winname, CNStringR dateiname);
Prints the window named winname to disk. The file dateiname is in postscript format.
static void save_drawing();
static void restore_drawing();
Saves/restores the current drawing.


Go to the first, previous, next, last section, table of contents.