4 * PostScript File IO utility Header File
11 #define MAX_STRING_LENGTH 256
13 #define PS_FILE_STATUS_ERROR (0)
14 #define PS_FILE_STATUS_OK (1)
18 typedef long psParaTypeInteger;
19 typedef double psParaTypeReal;
21 typedef struct psInfo {
22 psParaTypeInteger prologInfoNum;
24 char label[MAX_STRING_LENGTH];
25 psParaTypeInteger page;
26 psParaTypeInteger status;
29 typedef struct psPageInfo psPageInfo;
32 psParaTypeInteger page;
33 psParaTypeInteger byte;
39 typedef struct psFile {
52 #define PROLOG_STRING_NUM (11)
54 #define PROLOG_VERSION (0)
55 #define PROLOG_TITLE (1)
56 #define PROLOG_CREATOR (2)
57 #define PROLOG_CREATION_DATE (3)
58 #define PROLOG_FOR (4)
59 #define PROLOG_BOUND_BOX (5)
60 #define PROLOG_PAGES (6)
61 #define PROLOG_DOC_FONTS (7)
62 #define PROLOG_END_DOC (8)
63 #define PROLOG_END_PRO (9)
65 typedef enum psImageScaleMode {
66 psImageScaleModeBottomLeft = 1,
67 psImageScaleModeCenter = 2
70 #define PS_IMAGE_CENTRE_LINE_WIDTH (0.1)
71 #define PS_IMAGE_CENTRE_MARK_LENGTH (0.01)
73 #define PS_IMAGE_SCALE_LINE_WIDTH0 (0.2)
74 #define PS_IMAGE_SCALE_LINE_WIDTH1 (0.1)
75 #define PS_IMAGE_SCALE_LINE_LENGTH0 (10.0)
76 #define PS_IMAGE_SCALE_LINE_LENGTH1 (5.0)
77 #define PS_IMAGE_SCALE_LINE_LENGTH2 (3.0)
78 #define PS_IMAGE_SCALE_LINE_LENGTH3 (2.0)
79 #define PS_IMAGE_SCALE_LINE_LENGTH4 (1.0)
80 #define PS_IMAGE_SCALE_LINE_LENGTH00 (-10.0)
81 #define PS_IMAGE_SCALE_LINE_LENGTH10 (-5.0)
82 #define PS_IMAGE_SCALE_LINE_LENGTH20 (-3.0)
83 #define PS_IMAGE_SCALE_LINE_LENGTH30 (-2.0)
84 #define PS_IMAGE_SCALE_LINE_LENGTH40 (-1.0)
86 #define psContourMode_DifferentLineWidthContour (0x01)
87 #define psContourMode_SameLineWidthContour (0x02)
92 typedef struct psImageInfo {
94 psParaTypeReal scaleX;
95 psParaTypeReal scaleY;
96 psParaTypeReal translateX;
97 psParaTypeReal translateY;
101 psParaTypeInteger width;
102 psParaTypeInteger height;
103 psParaTypeInteger section;
105 psParaTypeInteger bps;
106 psParaTypeInteger nContour;
107 psParaTypeReal* contourLevel;
108 /* For Density Image */
109 unsigned char* image;
112 psParaTypeReal contourLineColorChange;
113 psParaTypeReal contourLineWidthStart;
114 psParaTypeReal contourLineWidthStep;
117 psParaTypeReal eyeX; /* Eye Position */
120 psParaTypeReal pointX; /* Projection Surface Position */
121 psParaTypeReal pointY; /* Surface Normal: (position - eye) */
122 psParaTypeReal pointZ;
125 psParaTypeInteger flagRGBColor;
126 psParaTypeInteger flagRGBGradientColor;
128 psParaTypeReal Green;
130 psParaTypeReal RedFirst;
131 psParaTypeReal GreenFirst;
132 psParaTypeReal BlueFirst;
133 psParaTypeReal RedLast;
134 psParaTypeReal GreenLast;
135 psParaTypeReal BlueLast;
136 psParaTypeInteger flagHSBColor;
137 psParaTypeInteger flagHSBGradientColor;
139 psParaTypeReal Saturation;
140 psParaTypeReal Brightness;
141 psParaTypeReal HueFirst;
142 psParaTypeReal SaturationFirst;
143 psParaTypeReal BrightnessFirst;
144 psParaTypeReal HueLast;
145 psParaTypeReal SaturationLast;
146 psParaTypeReal BrightnessLast;
148 /* For Line Colour */
149 psParaTypeInteger flagLineRGBColor;
150 psParaTypeInteger flagLineRGBGradientColor;
151 psParaTypeReal LineRed;
152 psParaTypeReal LineGreen;
153 psParaTypeReal LineBlue;
154 psParaTypeReal LineRedFirst;
155 psParaTypeReal LineGreenFirst;
156 psParaTypeReal LineBlueFirst;
157 psParaTypeReal LineRedLast;
158 psParaTypeReal LineGreenLast;
159 psParaTypeReal LineBlueLast;
160 psParaTypeInteger flagLineHSBColor;
161 psParaTypeInteger flagLineHSBGradientColor;
162 psParaTypeReal LineHue;
163 psParaTypeReal LineSaturation;
164 psParaTypeReal LineBrightness;
165 psParaTypeReal LineHueFirst;
166 psParaTypeReal LineSaturationFirst;
167 psParaTypeReal LineBrightnessFirst;
168 psParaTypeReal LineHueLast;
169 psParaTypeReal LineSaturationLast;
170 psParaTypeReal LineBrightnessLast;
173 psParaTypeReal CircleRadius;
179 #define PS_PLOT_MODE_AXIS (0x000000ff)
180 #define PS_PLOT_MODE_AXIS_X_AXIS_POS (0x00000001) /* 0: Down 1: Up */
181 #define PS_PLOT_MODE_AXIS_Y_AXIS_POS (0x00000002) /* 0: Left 1: Write */
182 #define PS_PLOT_MODE_AXIS (0x000000ff)
184 #define PS_LINE_CIRCLE_MODE (0)
185 #define PS_FILL_WHITE_CIRCLE_MODE (1)
186 #define PS_FILL_BLACK_CIRCLE_MODE (2)
188 #define PS_PLOT_SCALE_X_AXIS_Y_POSITION_DOWN ( -5.0)
189 #define PS_PLOT_SCALE_X_AXIS_Y_POSITION_UP (105.0)
190 #define PS_PLOT_SCALE_X_AXIS_LENGTH (1.0)
194 typedef struct psPlotInfo {
195 psParaTypeReal scaleX;
196 psParaTypeReal scaleY;
197 psParaTypeReal translateX;
198 psParaTypeReal translateY;
201 psParaTypeReal dXValue;
203 psParaTypeReal centreX;
208 psParaTypeReal dYValue;
210 psParaTypeReal centreY;
214 psParaTypeInteger nData;
215 psParaTypeReal *data;
223 /* prototype begin */
225 /* in psFileInit.c */
226 extern void psFileInit(psFile* ps, psParaTypeInteger mode);
228 /* in psFilePage.c */
229 extern void psFilePageStart(psFile* ps, psParaTypeInteger mode);
230 extern void psFilePageEnd(psFile* ps, psParaTypeInteger mode);
233 extern void psFileEnd(psFile* ps);
235 /* in psFileImage.c */
236 extern void psFileImage (psFile* ps, psImageInfo im, psParaTypeInteger mode);
237 extern void psFileImageByCircles (psFile* ps, psImageInfo im, psParaTypeInteger mode);
238 extern void psFileImageCentre (psFile* ps, psImageInfo im, psParaTypeInteger mode);
239 extern void psFileImageScale (psFile* ps, psImageInfo im, psParaTypeInteger mode);
240 extern void psFileImageSpaceSet (psFile* ps, psImageInfo im, psParaTypeInteger mode);
241 extern void psFileImageSpaceRotateSet (psFile* ps, psImageInfo im, psParaTypeInteger mode);
242 extern void psFileImageSpaceRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
243 extern void psFileImageSpaceRotateRestore(psFile* ps, psImageInfo im, psParaTypeInteger mode);
245 /* in psFileLine.c */
246 extern void psFileLineWidthSet (psFile* ps, float lineWidth);
247 extern void psFileLineDraw(psFile* ps, float x1,float y1,float x2,float y2);
248 extern void psFileDendgramLineDraw(psFile* ps, float width,float height1, float height2, float x, float y);
250 /* in psFileString.c */
251 extern void psFileStringStatusSet(psFile* ps, char* fontname, double fontsize);
252 extern void psFileStringDefaultStatusSet(psFile* ps);
253 extern void psFileString (psFile* ps, char* message, double x, double y, psParaTypeInteger mode);
255 /* in psFileContour.c */
256 extern void psFileContour(psFile* ps, psImageInfo im, psParaTypeInteger mode);
257 /* in psFileCircle.c */
258 extern void psFileCircleCreate(psFile* ps, float cx, float cy, float r, long mode);
262 /* in psFileRead.c */
263 extern void psFileRead(psFile* ps, FILE* fpt, long mode);
266 /* in psFileUtil.c */
267 extern long psFileIsStartPage(psFile* ps, char* s);
268 extern long psFileIsEndPage(psFile* ps, char* s);
275 #endif /* PS_FILE_H */