xref: /plan9/sys/src/cmd/gs/src/gdevcgmx.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1995 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gdevcgmx.h,v 1.4 2002/02/21 22:24:51 giles Exp $ */
18 /* Internal definitions for CGM-writing library */
19 
20 #ifndef gdevcgmx_INCLUDED
21 #  define gdevcgmx_INCLUDED
22 
23 #include "gdevcgml.h"
24 
25 /* Define the internal representations of the CGM opcodes. */
26 #define cgm_op_class_shift 7
27 #define cgm_op_id_shift 5
28 typedef enum {
29     /* Class 0 */
30     BEGIN_METAFILE = (0 << cgm_op_class_shift) + 1,
31     END_METAFILE,
32     BEGIN_PICTURE,
33     BEGIN_PICTURE_BODY,
34     END_PICTURE,
35     /* Class 1 */
36     METAFILE_VERSION = (1 << cgm_op_class_shift) + 1,
37     METAFILE_DESCRIPTION,
38     VDC_TYPE,
39     INTEGER_PRECISION,
40     REAL_PRECISION,
41     INDEX_PRECISION,
42     COLOR_PRECISION,
43     COLOR_INDEX_PRECISION,
44     MAXIMUM_COLOR_INDEX,
45     COLOR_VALUE_EXTENT,
46     METAFILE_ELEMENT_LIST,
47     METAFILE_DEFAULTS_REPLACEMENT,
48     FONT_LIST,
49     CHARACTER_SET_LIST,
50     CHARACTER_CODING_ANNOUNCER,
51     /* Class 2 */
52     SCALING_MODE = (2 << cgm_op_class_shift) + 1,
53     COLOR_SELECTION_MODE,
54     LINE_WIDTH_SPECIFICATION_MODE,
55     MARKER_SIZE_SPECIFICATION_MODE,
56     EDGE_WIDTH_SPECIFICATION_MODE,
57     VDC_EXTENT,
58     BACKGROUND_COLOR,
59     /* Class 3 */
60     VDC_INTEGER_PRECISION = (3 << cgm_op_class_shift) + 1,
61     VDC_REAL_PRECISION,
62     AUXILIARY_COLOR,
63     TRANSPARENCY,
64     CLIP_RECTANGLE,
65     CLIP_INDICATOR,
66     /* Class 4 */
67     POLYLINE = (4 << cgm_op_class_shift) + 1,
68     DISJOINT_POLYLINE,
69     POLYMARKER,
70     TEXT,
71     RESTRICTED_TEXT,
72     APPEND_TEXT,
73     POLYGON,
74     POLYGON_SET,
75     CELL_ARRAY,
76     GENERALIZED_DRAWING_PRIMITIVE,
77     RECTANGLE,
78     CIRCLE,
79     CIRCULAR_ARC_3_POINT,
80     CIRCULAR_ARC_3_POINT_CLOSE,
81     CIRCULAR_ARC_CENTER,
82     CIRCULAR_ARC_CENTER_CLOSE,
83     ELLIPSE,
84     ELLIPTICAL_ARC,
85     ELLIPTICAL_ARC_CLOSE,
86     /* Class 5 */
87     LINE_BUNDLE_INDEX = (5 << cgm_op_class_shift) + 1,
88     LINE_TYPE,
89     LINE_WIDTH,
90     LINE_COLOR,
91     MARKER_BUNDLE_INDEX,
92     MARKER_TYPE,
93     MARKER_SIZE,
94     MARKER_COLOR,
95     TEXT_BUNDLE_INDEX,
96     TEXT_FONT_INDEX,
97     TEXT_PRECISION,
98     CHARACTER_EXPANSION_FACTOR,
99     CHARACTER_SPACING,
100     TEXT_COLOR,
101     CHARACTER_HEIGHT,
102     CHARACTER_ORIENTATION,
103     TEXT_PATH,
104     TEXT_ALIGNMENT,
105     CHARACTER_SET_INDEX,
106     ALTERNATE_CHARACTER_SET_INDEX,
107     FILL_BUNDLE_INDEX,
108     INTERIOR_STYLE,
109     FILL_COLOR,
110     HATCH_INDEX,
111     PATTERN_INDEX,
112     EDGE_BUNDLE_INDEX,
113     EDGE_TYPE,
114     EDGE_WIDTH,
115     EDGE_COLOR,
116     EDGE_VISIBILITY,
117     FILL_REFERENCE_POINT,
118     PATTERN_TABLE,
119     PATTERN_SIZE,
120     COLOR_TABLE,
121     ASPECT_SOURCE_FLAGS,
122     /* Class 6 */
123     ESCAPE = (6 << cgm_op_class_shift) + 1,
124     /* Class 7 */
125     MESSAGE = (7 << cgm_op_class_shift) + 1,
126     APPLICATION_DATA
127 } cgm_op_index;
128 
129 /* Define the state of the CGM writer. */
130 						/*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */
131 struct cgm_state_s {
132     /* The following are set at initialization time. */
133     FILE *file;
134     cgm_allocator allocator;
135     /* The following are set by specific calls. */
136     cgm_metafile_elements metafile;
137     cgm_picture_elements picture;
138     int vdc_integer_precision;
139     cgm_precision vdc_real_precision;
140     cgm_color auxiliary_color;
141     cgm_transparency transparency;
142     cgm_point clip_rectangle[2];
143     cgm_clip_indicator clip_indicator;
144     int line_bundle_index;
145     cgm_line_type line_type;
146     cgm_line_width line_width;
147     cgm_color line_color;
148     int marker_bundle_index;
149     cgm_marker_type marker_type;
150     cgm_marker_size marker_size;
151     cgm_color marker_color;
152     int text_bundle_index;
153     int text_font_index;
154     cgm_text_precision text_precision;
155     cgm_real character_expansion_factor;
156     cgm_real character_spacing;
157     cgm_color text_color;
158     cgm_vdc character_height;
159     cgm_vdc character_orientation[4];
160     cgm_text_path text_path;
161 /****** text_alignment ******/
162     int character_set_index;
163     int alternate_character_set_index;
164     int fill_bundle_index;
165     cgm_interior_style interior_style;
166     cgm_color fill_color;
167     cgm_hatch_index hatch_index;
168     int pattern_index;
169     int edge_bundle_index;
170     cgm_edge_type edge_type;
171     cgm_edge_width edge_width;
172     bool edge_visibility;
173     cgm_point fill_reference_point;
174 /****** pattern_table ******/
175     cgm_vdc pattern_size[4];
176 /****** color_table ******/
177             byte /*cgm_aspect_source */ source_flags[18];
178     /* The following change dynamically. */
179 #define command_max_count 400	/* (must be even) */
180     byte command[command_max_count];
181     int command_count;
182     bool command_first;
183     cgm_result result;
184 };
185 
186 #endif /* gdevcgmx_INCLUDED */
187