summaryrefslogtreecommitdiff
path: root/gs/src/gdevcgmx.h
blob: 6cfb72c6b6773418ae13dd8479a1ab715a2c1087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/* Copyright (C) 2001-2006 Artifex Software, Inc.
   All Rights Reserved.
  
   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied, modified
   or distributed except as expressly authorized under the terms of that
   license.  Refer to licensing information at http://www.artifex.com/
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
*/
/* $Id$ */
/* Internal definitions for CGM-writing library */

#ifndef gdevcgmx_INCLUDED
#  define gdevcgmx_INCLUDED

#include "gdevcgml.h"

/* Define the internal representations of the CGM opcodes. */
#define cgm_op_class_shift 7
#define cgm_op_id_shift 5
typedef enum {
    /* Class 0 */
    BEGIN_METAFILE = (0 << cgm_op_class_shift) + 1,
    END_METAFILE,
    BEGIN_PICTURE,
    BEGIN_PICTURE_BODY,
    END_PICTURE,
    /* Class 1 */
    METAFILE_VERSION = (1 << cgm_op_class_shift) + 1,
    METAFILE_DESCRIPTION,
    VDC_TYPE,
    INTEGER_PRECISION,
    REAL_PRECISION,
    INDEX_PRECISION,
    COLOR_PRECISION,
    COLOR_INDEX_PRECISION,
    MAXIMUM_COLOR_INDEX,
    COLOR_VALUE_EXTENT,
    METAFILE_ELEMENT_LIST,
    METAFILE_DEFAULTS_REPLACEMENT,
    FONT_LIST,
    CHARACTER_SET_LIST,
    CHARACTER_CODING_ANNOUNCER,
    /* Class 2 */
    SCALING_MODE = (2 << cgm_op_class_shift) + 1,
    COLOR_SELECTION_MODE,
    LINE_WIDTH_SPECIFICATION_MODE,
    MARKER_SIZE_SPECIFICATION_MODE,
    EDGE_WIDTH_SPECIFICATION_MODE,
    VDC_EXTENT,
    BACKGROUND_COLOR,
    /* Class 3 */
    VDC_INTEGER_PRECISION = (3 << cgm_op_class_shift) + 1,
    VDC_REAL_PRECISION,
    AUXILIARY_COLOR,
    TRANSPARENCY,
    CLIP_RECTANGLE,
    CLIP_INDICATOR,
    /* Class 4 */
    POLYLINE = (4 << cgm_op_class_shift) + 1,
    DISJOINT_POLYLINE,
    POLYMARKER,
    TEXT,
    RESTRICTED_TEXT,
    APPEND_TEXT,
    POLYGON,
    POLYGON_SET,
    CELL_ARRAY,
    GENERALIZED_DRAWING_PRIMITIVE,
    RECTANGLE,
    CIRCLE,
    CIRCULAR_ARC_3_POINT,
    CIRCULAR_ARC_3_POINT_CLOSE,
    CIRCULAR_ARC_CENTER,
    CIRCULAR_ARC_CENTER_CLOSE,
    ELLIPSE,
    ELLIPTICAL_ARC,
    ELLIPTICAL_ARC_CLOSE,
    /* Class 5 */
    LINE_BUNDLE_INDEX = (5 << cgm_op_class_shift) + 1,
    LINE_TYPE,
    LINE_WIDTH,
    LINE_COLOR,
    MARKER_BUNDLE_INDEX,
    MARKER_TYPE,
    MARKER_SIZE,
    MARKER_COLOR,
    TEXT_BUNDLE_INDEX,
    TEXT_FONT_INDEX,
    TEXT_PRECISION,
    CHARACTER_EXPANSION_FACTOR,
    CHARACTER_SPACING,
    TEXT_COLOR,
    CHARACTER_HEIGHT,
    CHARACTER_ORIENTATION,
    TEXT_PATH,
    TEXT_ALIGNMENT,
    CHARACTER_SET_INDEX,
    ALTERNATE_CHARACTER_SET_INDEX,
    FILL_BUNDLE_INDEX,
    INTERIOR_STYLE,
    FILL_COLOR,
    HATCH_INDEX,
    PATTERN_INDEX,
    EDGE_BUNDLE_INDEX,
    EDGE_TYPE,
    EDGE_WIDTH,
    EDGE_COLOR,
    EDGE_VISIBILITY,
    FILL_REFERENCE_POINT,
    PATTERN_TABLE,
    PATTERN_SIZE,
    COLOR_TABLE,
    ASPECT_SOURCE_FLAGS,
    /* Class 6 */
    ESCAPE = (6 << cgm_op_class_shift) + 1,
    /* Class 7 */
    MESSAGE = (7 << cgm_op_class_shift) + 1,
    APPLICATION_DATA
} cgm_op_index;

/* Define the state of the CGM writer. */
						/*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */
struct cgm_state_s {
    /* The following are set at initialization time. */
    FILE *file;
    cgm_allocator allocator;
    /* The following are set by specific calls. */
    cgm_metafile_elements metafile;
    cgm_picture_elements picture;
    int vdc_integer_precision;
    cgm_precision vdc_real_precision;
    cgm_color auxiliary_color;
    cgm_transparency transparency;
    cgm_point clip_rectangle[2];
    cgm_clip_indicator clip_indicator;
    int line_bundle_index;
    cgm_line_type line_type;
    cgm_line_width line_width;
    cgm_color line_color;
    int marker_bundle_index;
    cgm_marker_type marker_type;
    cgm_marker_size marker_size;
    cgm_color marker_color;
    int text_bundle_index;
    int text_font_index;
    cgm_text_precision text_precision;
    cgm_real character_expansion_factor;
    cgm_real character_spacing;
    cgm_color text_color;
    cgm_vdc character_height;
    cgm_vdc character_orientation[4];
    cgm_text_path text_path;
/****** text_alignment ******/
    int character_set_index;
    int alternate_character_set_index;
    int fill_bundle_index;
    cgm_interior_style interior_style;
    cgm_color fill_color;
    cgm_hatch_index hatch_index;
    int pattern_index;
    int edge_bundle_index;
    cgm_edge_type edge_type;
    cgm_edge_width edge_width;
    bool edge_visibility;
    cgm_point fill_reference_point;
/****** pattern_table ******/
    cgm_vdc pattern_size[4];
/****** color_table ******/
            byte /*cgm_aspect_source */ source_flags[18];
    /* The following change dynamically. */
#define command_max_count 400	/* (must be even) */
    byte command[command_max_count];
    int command_count;
    bool command_first;
    cgm_result result;
};

#endif /* gdevcgmx_INCLUDED */