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