4
* $Id: cgm.h 685 2003-03-08 15:26:51Z travo $
6
* Declare the CGM binary metafile engine for GIST.
9
/* Copyright (c) 1994. The Regents of the University of California.
10
All rights reserved. */
20
/* Sun strikes again... This may break other non-standard machines */
24
/* This Engine is based on the ANSI CGM Standard, ANSI X3.122 - 1986
25
Parts 1 and 3. It is fully conforming with the following caveats:
26
1. The font names in the FONT LIST metafile descriptor element are
27
standard PostScript font names, rather than ISO standard names
28
(which I couldn't find). The font numbers match the numbering
29
scheme used by the GPLOT program.
30
2. A Gist smooth polyline is output using the ordinary POLYLINE
31
primitive, preceded by an APPLICATION DATA comment. This gives
32
reasonable output (identical to that produced by the Gist X
33
engine, in fact), but not as nice as the Gist PostScript engine.
36
typedef unsigned char Octet; /* as defined in the CGM standard */
37
#define MAX_PARTITION 0x7ffc /* maximum length of a CELL ARRAY partition */
39
typedef struct CGMEngine CGMEngine;
43
/* --------------- Specific to CGMEngine ------------------- */
46
GpReal scale; /* VDC units per Gist NDC unit, 25545.2 by default */
47
long fileSize; /* approximate maximum in bytes, default is 1 Meg */
48
void (*IncrementName)(char *filename);
49
/* function to increment filename IN PLACE
50
(a reasonable default is supplied) */
51
p_file *file; /* 0 until file is actually written into */
52
int state; /* CGM state as described in fig. 12 of ANSI X3.122 */
54
/* Page orientation and color table can only be changed at the beginning
55
of each page, so the entries in the Engine base class are repeated
56
here as the "currently in effect" values. When a new page begins,
57
these values are brought into agreement with those in the base
58
class. The ChangePalette virtual function temporarily resets colorMode
59
to 0, to avoid any references to the new palette until the
65
int currentPage; /* current page number, incremented by EndPage */
67
/* The CGM engine must keep track of several graphical state
68
parameters, mostly from gistA. These are reset at the
69
beginning of each page. */
72
unsigned long curColor[5];
79
int curAlignH, curAlignV;
81
int curOpaque; /* unlike Gist, this applies to more than text... */
86
extern CGMEngine *GisCGMEngine(Engine *engine);
88
/* Default CGM scale factor and maximum file size */
89
extern GpReal gCGMScale;
90
extern long gCGMFileSize;
92
/* To change away from the default fileSize, just change the
93
CGMEngine fileSize member. To change the CGM scale factor
94
(the initial default value is 25545.2, which corresponds to
95
2400 dpi resolution), use GcgmSetScale after creating the
96
engine but BEFORE DRAWING ANYTHING WITH IT: */
97
extern void GcgmSetScale(CGMEngine *cgmEngine, GpReal scale);