<!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>CD_CGM</title> <link rel="stylesheet" type="text/css" href="../../style.css"> </head> <body> <h2>CD_CGM - <em>Computer Graphics Metafile Driver </em>(cdcgm.h)</h2> <p>This driver allows generating a Computer Graphics Metafile, which is an ANSI standard for the persistent storage of graphics primitives. The file usually has an extension .CGM.</p> <h3>Use</h3> <p>The file file is created by means of a call to the function <font face="Courier"> <a href="../func/init.html#cdCreateCanvas"><strong>cdCreateCanvas</strong></a>(CD_CGM, Data)</font>, which <b>opens</b> the file and writes its header. Then, other functions in the CD library can be called as usual. The <font face="Courier">Data</font> parameter string has the following format:</p> <pre><em>"filename [widthxheight] [resolution] [-t] -p[precision]" or in C style "<strong><tt>%s %gx%g %g %s</tt></strong>"</em></pre> <p>Only the parameter <font face="Courier">filename</font> is required. The filename must be inside double quotes (") if it has spaces.<font face="Courier"> Width</font> and <font face="Courier">height</font> are provided in millimeters (note the lowercase "x" between them), and their default value in pixels is <font face="Courier">INT_MAX</font> for both dimensions. When the canvas' size is not specified, the VDC Extension saved to the file is the image's bounding rectangle. The resolution is the number of pixels per millimeter; its default value is "3.78 pixels/mm" (96 DPI). <font face="Courier">Width</font>, <font face="Courier">height</font> and <font face="Courier">resolution</font> are real values. <font face="Courier">Width</font>, <font face="Courier">height</font> and <font face="Courier">resolution</font> are used only by <strong><font face="Courier">cdGetCanvasSize</font> </strong>and in pixel-millimeter conversion. Parameter <font face="Courier">-t</font> modifies the codification. Parameter <font face="Courier">-p</font> specifies the precision of integers, which can be 16 (default) or 32.</p> <p>Any amount of such canvases may exist simultaneously. It is important to note that a call to function <a href="../func/init.html#cdKillCanvas"><font face="Courier"><strong> cdKillCanvas</strong></font></a> is required to <b>close</b> the file properly.</p> <p><strong>Coding -</strong> The CGM format supports binary and text coding. If you are not sure what to do, use binary coding, which is the default. Should you prefer text coding, add a "<font face="Courier">-t</font>" string to the <font face="Courier">Data</font> parameter.</p> <p><strong>Precision of Coordinates -</strong> The primitives can use coordinates in real numbers. However, for compatibility reasons, we use coordinates in integers.</p> <h3>Behavior of Functions</h3> <h4>Control </h4> <ul> <li><a href="../func/control.html#cdClear"><font face="Courier"><strong>Clear</strong></font></a>: does nothing.</li> <li><a href="../func/control.html#cdFlush"><font face="Courier"><strong>Flush</strong></font></a>: creates a new image, preserving the previous one. The CGM format supports multiple images in a file.</li> <li><a href="../func/other.html#cdPlay"><font face="Courier"><strong>Play</strong></font></a>: works with files created with text or binary coding. There are several callbacks for this driver. If one of the callbacks returns a value different from zero, <font face="Courier">cdPlay</font>'s processing is interrupted. The driver implements the callback <tt><strong><font face="Courier">CD_SIZECB</font> </strong></tt>and other callbacks associated to CGM:<br> <tt><font face="Courier"><strong>CD_COUNTERCB</strong></font> - int(*cdcgmcountercb)(cdContext *driver, double percent) - </tt>Executed for each header of CGM commands; returns the percentage (0-100%) of headers read.<br> <font face="Times New Roman"><code><strong><span style="font-family: Courier">CD_SCLMDECB</span></strong></code></font><tt> - int(*cdcgmsclmdecb)(cdContext *driver, short scl_mde, short *drw_mode, double *factor)</tt> <font face="Courier">-</font> Executed for the command CGM SCALE MODE. Returns the current CGM scale mode and allows the callback to modify the scale mode used by the <font face="Courier">cdPlay</font> function <font face="Courier">(ABSTRACT=0, METRIC=1)</font>. Should you choose the METRIC or ABSTRACT scale mode but the original scale mode is METRIC, you must provide the conversion factor in mm per pixel.<br> <font face="Times New Roman"><code><strong><span style="font-family: Courier">CD_VDCEXTCB</span></strong></code></font><tt> - int(*cdcgmvdcextcb)(cdContext *driver, short type, void *xmn, void *ymn, void *xmx, void *ymx)</tt> <font face="Courier">-</font> Executed for the CGM command CGM VDC EXTENT, returns the VDC SPACE. <br> <font face="Times New Roman"><code><strong><span style="font-family: Courier">CD_BEGPICTCB</span></strong></code></font><tt> - int(*cdcgmbegpictcb)(cdContext *driver, char *pict)</tt> <font face="Courier">-</font> Executed for the command BEGIN PICTURE, returns the string that describes the image.<br> <font face="Times New Roman"><code><strong><span style="font-family: Courier">CD_BEGPICTBCB</span></strong></code></font><tt> - int(*cdcgmbegpictbcb)(cdContext *driver)</tt> <font face="Courier">-</font> Executed for the command BEGIN PICTURE BODY.<br> <font face="Times New Roman"><code><strong><span style="font-family: Courier">CD_CGMBEGMTFCB</span></strong></code></font> - <font face="Times New Roman"><code> int (*cdcgmbegmtfcb)(cdContext *driver, int *xmin, int *ymin, int *xmax, int *ymax)</code></font> - Executed for the command BEGIN METAFILE, provides the drawing limits of the image in the file.</li> </ul> <h4>Coordinate System and Clipping</h4> <ul> <li><a href="../func/coordinates.html#cdUpdateYAxis"><font face="Courier"> <strong>UpdateYAxis</strong></font></a>: does nothing. The axis orientation is the same as the CD library.</li> <li><b>Complex Regions</b>: not supported.</li> <li><strong>Transformation Matrix</strong>: not supported.</li> </ul> <h4>Primitives</h4> <ul> <li><a href="../func/lines.html#cdBegin"><font face="Courier"><strong>Begin</strong></font></a>: if parameter <strong><tt>CD_CLIP</tt></strong> or <strong><tt>CD_BEZIER</tt></strong> are specified, does nothing.</li> <li><font face="Courier"><strong><a href="../func/marks.html#cdPixel">Pixel</a></strong></font>: does not exist in CGM, is simulated using a mark with size 1.</li> <li><strong><font face="Courier"><a href="../func/filled.html#cdChord">Chord</a></font></strong>: does nothing.</li> <li>Floating point primitives are supported.</li> </ul> <h4>Attributes </h4> <ul> <li><a href="../func/attributes.html#cdWriteMode"><font face="Courier"> <strong> WriteMode</strong></font></a>: does nothing, returns <font face="Courier">CD_REPLACE</font>.</li> <li><a href="../func/text.html#cdFontDim"><font face="Courier"><strong>FontDim</strong></font></a>: is simulated.</li> <li><a href="../func/filled.html#cdFillMode"><font face="Courier"><strong> FillMode</strong></font></a>: does nothing.</li> <li><a href="../func/filled.html#cdLineCap"><font face="Courier"><strong> LineCap</strong></font></a>: does nothing.</li> <li><a href="../func/filled.html#cdLineJoin"><font face="Courier"><strong> LineJoin</strong></font></a>: does nothing.</li> <li><a href="../func/text.html#cdTextSize"><font face="Courier"><strong> TextSize</strong></font></a>: is simulated.</li> <li><a href="../func/text.html#cdTextOrientation"><font face="Courier"> <strong> TextOrientation</strong></font></a>: does nothing.</li> <li><a href="../func/text.html#cdFont"><font face="Courier"><strong>Font</strong></font></a>: see the table bellow for the generated font names. No other fonts are supported.</li> </ul> <div align="center"> <center> <table border="1" cellpadding="5"> <caption style="text-align: center"><font size="4">Font Mapping</font></caption> <tr> <th rowspan="2">CD Fonts</th> <th colspan="4">Generated Font Names</th> </tr> <tr> <th>CD_PLAIN</th> <th>CD_BOLD</th> <th>CD_ITALIC</th> <th>CD_BOLD|CD_ITALIC</th> </tr> <tr> <td>"System"</td> <td>"SYSTEM"</td> <td>"SYSTEM_BOLD"</td> <td>"SYSTEM_ITALIC"</td> <td>"SYSTEM_BOLDITALIC"</td> </tr> <tr> <td>"Courier"</td> <td>"COURIER" </td> <td>"COURIER_BOLD" </td> <td>"COURIER_ITALIC" </td> <td>"COURIER_BOLDITALIC"</td> </tr> <tr> <td>"Times"</td> <td>"TIMES_ROMAN" </td> <td>"TIMES_ROMAN_BOLD"</td> <td>"TIMES_ROMAN_ITALIC"</td> <td>"TIMES_ROMAN_BOLDITALIC" </td> </tr> <tr> <td>"Helvetica"</td> <td>"HELVETICA" </td> <td>"HELVETICA_BOLD"</td> <td>"HELVETICA_ITALIC"</td> <td>"HELVETICA_BOLDITALIC"</td> </tr> </table> </center> </div> <h4>Colors </h4> <ul> <li><a href="../func/color.html#cdGetColorPlanes"><font face="Courier"> <strong> GetColorPlanes</strong></font></a>: returns 24.</li> <li><a href="../func/color.html#cdPalette"><font face="Courier"><strong>Palette</strong></font></a>: does nothing. </li> </ul> <h4>Client Images </h4> <ul> <li><a href="../func/client.html#cdGetImageRGB"><font face="Courier"><strong> GetImageRGB</strong></font></a>: does nothing.</li> <li><a href="../func/client.html#cdPutImageRGBA"><font face="Courier"><strong> PutImageRGBA</strong></font></a>: alpha is ignored.</li> </ul> <h4>Server Images</h4> <ul> <li>All functions do nothing.</li> </ul> </body> </html>