This driver allows generating a Computer Graphics Metafile version 1, which is an ANSI standard for the persistent storage of graphics primitives. The file usually has an extension .CGM.
The file file is created by means of a call to the function cdCreateCanvas(CD_CGM, Data), which opens the file and writes its header. Then, other functions in the CD library can be called as usual. The Data parameter string has the following format:
"filename [width_mmxheight_mm] [resolution] [-t] [-pprec] -d[description]" or in C style "%s %gx%g %g %s"
Only the parameter filename is required. The filename must be inside double quotes (") if it has spaces. width_mm and height_mm are provided in millimeters (note the lowercase "x" between them), and their default value in pixels is INT_MAX for both dimensions. The resolution is the number of pixels per millimeter; its default value is "3.78 pixels/mm" (96 DPI). Width, height and resolution are real values. width_mm, height_mm and resolution are used only by cdGetCanvasSize and in pixel-millimeter conversion. Parameter -t modifies the codification. Parameter -p specifies the precision which can be "16" bits integer (default), "32" bits (integer), "F" (float) or "D" (double). Parameter -d specifies a description, must be the last parameter (since 5.6).
Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to close the file properly.
Coding - The CGM format supports binary and text encoding. If you are not sure what to do, use binary encoding, which is the default. Should you prefer text coding, add a "-t" string to the Data parameter.
Precision of Coordinates - The primitives can use coordinates in real numbers. But to be effective the parameters "-pF" or "-pD" must be used when creating the canvas (since 5.6).
CD_SCLMDECB
- int(*cdcgmsclmdecb)(cdCanvas* canvas, short scl_mde, short *drw_mode, double *factor)
-
Executed for the command CGM SCALE MODE. Returns the current CGM scale mode
and allows the callback to modify the scale mode used internally
(ABSTRACT=0, METRIC=1).
You can choose the
METRIC or ABSTRACT scale mode, but if the original scale mode is METRIC, then you must provide the conversion factor in mm per
pixel.
CD_VDCEXTCB
- int(*cdcgmvdcextcb)(cdCanvas* canvas, short type, double *first_x, double *first_y, double *second_x,
double *second_y) - Executed for the
CGM command CGM VDC EXTENT, returns the VDC SPACE. Currently type is always 1.
CD_BEGPICTCB
- int(*cdcgmbegpictcb)(cdCanvas* canvas, char *pict) - Executed for the command BEGIN PICTURE, returns the string
that describes the image.
CD_BEGPICTBCB
- int(*cdcgmbegpictbcb)(cdCanvas* canvas) - Executed for the command BEGIN PICTURE BODY.
CD_CGMBEGMTFCB
-
int (*cdcgmbegmtfcb)(cdCanvas* canvas, int *xmin, int *ymin, int *xmax, int *ymax)
- Executed for the
command BEGIN METAFILE, provides the drawing limits of the image in the file.
These are the same parameters passed to cdCanvasPlay.CD Fonts | Generated Font Names | |||
---|---|---|---|---|
CD_PLAIN | CD_BOLD | CD_ITALIC | CD_BOLD|CD_ITALIC | |
"System" | "SYSTEM" | "SYSTEM_BOLD" | "SYSTEM_ITALIC" | "SYSTEM_BOLDITALIC" |
"Courier" | "COURIER" | "COURIER_BOLD" | "COURIER_ITALIC" | "COURIER_BOLDITALIC" |
"Times" | "TIMES_ROMAN" | "TIMES_ROMAN_BOLD" | "TIMES_ROMAN_ITALIC" | "TIMES_ROMAN_BOLDITALIC" |
"Helvetica" | "HELVETICA" | "HELVETICA_BOLD" | "HELVETICA_ITALIC" | "HELVETICA_BOLDITALIC" |