struct _cdCanvas
{
char signature[2]; /* must be "CD" */
/* can NOT be NULL */
void (*cxPixel)(cdCtxCanvas* ctxcanvas, int x, int y, long color);
void (*cxLine)(cdCtxCanvas* ctxcanvas, int x1, int y1, int x2, int y2);
void (*cxPoly)(cdCtxCanvas* ctxcanvas, int mode, cdPoint* points, int n);
void (*cxRect)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxBox)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxArc)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxSector)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxChord)(cdCtxCanvas* ctxcanvas, int xc, int yc, int w, int h, double angle1, double angle2);
void (*cxText)(cdCtxCanvas* ctxcanvas, int x, int y, const char *s, int len);
void (*cxKillCanvas)(cdCtxCanvas* ctxcanvas);
int (*cxFont)(cdCtxCanvas* ctxcanvas, const char *type_face, int style, int size);
void (*cxPutImageRectMap)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char *index, const long *colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
/* default implementation uses the simulation driver */
void (*cxGetFontDim)(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent);
void (*cxGetTextSize)(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height);
/* all the following function pointers can be NULL */
void (*cxFlush)(cdCtxCanvas* ctxcanvas);
void (*cxClear)(cdCtxCanvas* ctxcanvas);
void (*cxFPixel)(cdCtxCanvas* ctxcanvas, double x, double y, long color);
void (*cxFLine)(cdCtxCanvas* ctxcanvas, double x1, double y1, double x2, double y2);
void (*cxFPoly)(cdCtxCanvas* ctxcanvas, int mode, cdfPoint* points, int n);
void (*cxFRect)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
void (*cxFBox)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
void (*cxFArc)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFSector)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFChord)(cdCtxCanvas* ctxcanvas, double xc, double yc, double w, double h, double angle1, double angle2);
void (*cxFText)(cdCtxCanvas* ctxcanvas, double x, double y, const char *s, int len);
int (*cxClip)(cdCtxCanvas* ctxcanvas, int mode);
void (*cxClipArea)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax);
void (*cxFClipArea)(cdCtxCanvas* ctxcanvas, double xmin, double xmax, double ymin, double ymax);
int (*cxBackOpacity)(cdCtxCanvas* ctxcanvas, int opacity);
int (*cxWriteMode)(cdCtxCanvas* ctxcanvas, int mode);
int (*cxLineStyle)(cdCtxCanvas* ctxcanvas, int style);
int (*cxLineWidth)(cdCtxCanvas* ctxcanvas, int width);
int (*cxLineJoin)(cdCtxCanvas* ctxcanvas, int join);
int (*cxLineCap)(cdCtxCanvas* ctxcanvas, int cap);
int (*cxInteriorStyle)(cdCtxCanvas* ctxcanvas, int style);
int (*cxHatch)(cdCtxCanvas* ctxcanvas, int style);
void (*cxStipple)(cdCtxCanvas* ctxcanvas, int w, int h, const unsigned char *stipple);
void (*cxPattern)(cdCtxCanvas* ctxcanvas, int w, int h, const long *pattern);
int (*cxNativeFont)(cdCtxCanvas* ctxcanvas, const char* font);
int (*cxTextAlignment)(cdCtxCanvas* ctxcanvas, int alignment);
double (*cxTextOrientation)(cdCtxCanvas* ctxcanvas, double angle);
void (*cxPalette)(cdCtxCanvas* ctxcanvas, int n, const long *palette, int mode);
long (*cxBackground)(cdCtxCanvas* ctxcanvas, long color);
long (*cxForeground)(cdCtxCanvas* ctxcanvas, long color);
void (*cxTransform)(cdCtxCanvas* ctxcanvas, const double* matrix);
void (*cxGetImageRGB)(cdCtxCanvas* ctxcanvas, unsigned char *r, unsigned char *g, unsigned char *b, int x, int y, int w, int h);
void (*cxPutImageRectRGB)(cdCtxCanvas* ctxcanvas, 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);
void (*cxPutImageRectRGBA)(cdCtxCanvas* ctxcanvas, 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);
void (*cxFPutImageRectRGB)(cdCtxCanvas* ctxcanvas, 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);
void (*cxFPutImageRectRGBA)(cdCtxCanvas* ctxcanvas, 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);
void (*cxFPutImageRectMap)(cdCtxCanvas* ctxcanvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
void (*cxScrollArea)(cdCtxCanvas* ctxcanvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
cdCtxImage* (*cxCreateImage)(cdCtxCanvas* ctxcanvas, int w, int h);
void (*cxKillImage)(cdCtxImage* ctximage);
void (*cxGetImage)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y);
void (*cxPutImageRect)(cdCtxCanvas* ctxcanvas, cdCtxImage* ctximage, int x, int y, int xmin, int xmax, int ymin, int ymax);
void (*cxNewRegion)(cdCtxCanvas* ctxcanvas);
int (*cxIsPointInRegion)(cdCtxCanvas* ctxcanvas, int x, int y);
void (*cxOffsetRegion)(cdCtxCanvas* ctxcanvas, int x, int y);
void (*cxGetRegionBox)(cdCtxCanvas* ctxcanvas, int *xmin, int *xmax, int *ymin, int *ymax);
int (*cxActivate)(cdCtxCanvas* ctxcanvas);
void (*cxDeactivate)(cdCtxCanvas* ctxcanvas);
/* the driver must update these, when the canvas is created and
whenever the canvas change its size or bpp. */
int w,h; /* size in pixels */ /**** pixel = mm * res ****/
double w_mm, h_mm; /* size in mm */ /**** mm = pixel / res ****/
double xres, yres; /* resolution in pixels/mm */ /**** res = pixel / mm ****/
int bpp; /* number of bits per pixel */
int invert_yaxis; /* invert Y coordinates before calling the driver,
used only when the native Y axis orientation is top-bottom "!(cap&CD_CAP_YAXIS)".
It is turned off by the driver if native transformation matrix is used. */
double matrix[6];
int use_matrix;
/* clipping attributes */
int clip_mode;
cdRect clip_rect;
cdfRect clip_frect;
int clip_poly_n;
cdPoint* clip_poly; /* only defined if integer polygon created, if exist clip_fpoly is NULL, and ->Poly exists */
cdfPoint* clip_fpoly; /* only defined if real polygon created, if exist clip_poly is NULL, and ->fPoly exists */
/* clipping region attributes */
int new_region;
int combine_mode;
/* color attributes */
long foreground, background;
int back_opacity, write_mode;
/* primitive attributes */
int mark_type, mark_size;
int line_style, line_width;
int line_cap, line_join;
int* line_dashes;
int line_dashes_count;
int interior_style, hatch_style;
int fill_mode;
char font_type_face[1024];
int font_style, font_size;
int text_alignment;
double text_orientation;
char native_font[1024];
int pattern_w, pattern_h, pattern_size;
long* pattern;
int stipple_w, stipple_h, stipple_size;
unsigned char* stipple;
/* origin */
int use_origin;
cdPoint origin; /* both points contains the same coordinate always */
cdfPoint forigin;
/* last polygon */
int poly_mode,
poly_n, /* current number of vertices */
poly_size, fpoly_size; /* allocated number of vertices, only increases */
cdPoint* poly; /* used during an integer polygon creation */
cdfPoint* fpoly; /* used during an real polygon creation, only if ->cxFPoly exists */
int use_fpoly;
/* last path */
int path_n, /* current number of actions */
path_size; /* allocated number of actions, only increases */
int* path; /* used during path creation */
int path_arc_index; /* used for arc */
/* simulation flags */
int sim_mode;
/* WC */
double s, sx, tx, sy, ty; /* Transform Window -> Viewport (scale+translation)*/
cdfRect window; /* Window in WC */
cdRect viewport; /* Viewport in pixels */
cdAttribute* attrib_list[50];
int attrib_n;
cdVectorFont* vector_font;
cdSimulation* simulation;
cdCtxCanvas* ctxcanvas;
cdContext* context;
void* userdata;
};