1 | /* $Xorg: psout.h,v 1.6 2001/02/09 02:04:37 xorgcvs Exp $ */
|
---|
2 | /*
|
---|
3 |
|
---|
4 | Copyright 1996, 1998 The Open Group
|
---|
5 |
|
---|
6 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
7 | documentation for any purpose is hereby granted without fee, provided that
|
---|
8 | the above copyright notice appear in all copies and that both that
|
---|
9 | copyright notice and this permission notice appear in supporting
|
---|
10 | documentation.
|
---|
11 |
|
---|
12 | The above copyright notice and this permission notice shall be included in
|
---|
13 | all copies or substantial portions of the Software.
|
---|
14 |
|
---|
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
18 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
19 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
21 |
|
---|
22 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
23 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
24 | in this Software without prior written authorization from The Open Group.
|
---|
25 |
|
---|
26 | */
|
---|
27 | /*
|
---|
28 | * (c) Copyright 1996 Hewlett-Packard Company
|
---|
29 | * (c) Copyright 1996 International Business Machines Corp.
|
---|
30 | * (c) Copyright 1996 Sun Microsystems, Inc.
|
---|
31 | * (c) Copyright 1996 Novell, Inc.
|
---|
32 | * (c) Copyright 1996 Digital Equipment Corp.
|
---|
33 | * (c) Copyright 1996 Fujitsu Limited
|
---|
34 | * (c) Copyright 1996 Hitachi, Ltd.
|
---|
35 | *
|
---|
36 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
37 | * a copy of this software and associated documentation files (the
|
---|
38 | * "Software"), to deal in the Software without restriction, including
|
---|
39 | * without limitation the rights to use, copy, modify, merge, publish,
|
---|
40 | * distribute, sublicense, and/or sell copies of the Software, and to
|
---|
41 | * permit persons to whom the Software is furnished to do so, subject
|
---|
42 | * to the following conditions:
|
---|
43 | *
|
---|
44 | * The above copyright notice and this permission notice shall be included
|
---|
45 | * in all copies or substantial portions of the Software.
|
---|
46 | *
|
---|
47 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
48 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
49 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
50 | * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
51 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
---|
52 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
53 | * SOFTWARE.
|
---|
54 | *
|
---|
55 | * Except as contained in this notice, the names of the copyright holders
|
---|
56 | * shall not be used in advertising or otherwise to promote the sale, use
|
---|
57 | * or other dealings in this Software without prior written authorization
|
---|
58 | * from said copyright holders.
|
---|
59 | */
|
---|
60 |
|
---|
61 | /*******************************************************************
|
---|
62 | **
|
---|
63 | ** *********************************************************
|
---|
64 | ** *
|
---|
65 | ** * File: psout.h
|
---|
66 | ** *
|
---|
67 | ** * Contents: Include file for psout.c
|
---|
68 | ** *
|
---|
69 | ** * Created By: Roger Helmendach (Liberty Systems)
|
---|
70 | ** *
|
---|
71 | ** * Copyright: Copyright 1996 The Open Group, Inc.
|
---|
72 | ** *
|
---|
73 | ** *********************************************************
|
---|
74 | **
|
---|
75 | ********************************************************************/
|
---|
76 |
|
---|
77 | #ifdef HAVE_DIX_CONFIG_H
|
---|
78 | #include <dix-config.h>
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | #ifndef _psout_
|
---|
82 | #define _psout_
|
---|
83 |
|
---|
84 | #include <stdio.h>
|
---|
85 |
|
---|
86 | typedef enum PsCapEnum_ { PsCButt=0, PsCRound, PsCSquare } PsCapEnum;
|
---|
87 | typedef enum PsJoinEnum_ { PsJMiter=0, PsJRound, PsJBevel } PsJoinEnum;
|
---|
88 | typedef enum PsArcEnum_ { PsChord, PsPieSlice } PsArcEnum;
|
---|
89 | typedef enum PsRuleEnum_ { PsEvenOdd, PsNZWinding } PsRuleEnum;
|
---|
90 | typedef enum PsFillEnum_ { PsSolid=0, PsTile, PsStip, PsOpStip } PsFillEnum;
|
---|
91 |
|
---|
92 | typedef struct PsPointRec_
|
---|
93 | {
|
---|
94 | int x;
|
---|
95 | int y;
|
---|
96 | } PsPointRec;
|
---|
97 |
|
---|
98 | typedef PsPointRec *PsPointPtr;
|
---|
99 |
|
---|
100 | typedef struct PsRectRec_
|
---|
101 | {
|
---|
102 | int x;
|
---|
103 | int y;
|
---|
104 | int w;
|
---|
105 | int h;
|
---|
106 | } PsRectRec;
|
---|
107 |
|
---|
108 | typedef PsRectRec *PsRectPtr;
|
---|
109 |
|
---|
110 | typedef struct PsArcRec_
|
---|
111 | {
|
---|
112 | int x;
|
---|
113 | int y;
|
---|
114 | int w;
|
---|
115 | int h;
|
---|
116 | int a1;
|
---|
117 | int a2;
|
---|
118 | PsArcEnum style;
|
---|
119 | } PsArcRec;
|
---|
120 |
|
---|
121 | typedef PsArcRec *PsArcPtr;
|
---|
122 |
|
---|
123 | #define PSOUT_RECT 0
|
---|
124 | #define PSOUT_ARC 1
|
---|
125 | #define PSOUT_POINTS 2
|
---|
126 |
|
---|
127 | typedef struct PsElmRec_
|
---|
128 | {
|
---|
129 | int type;
|
---|
130 | int nPoints;
|
---|
131 | union
|
---|
132 | {
|
---|
133 | PsRectRec rect;
|
---|
134 | PsArcRec arc;
|
---|
135 | PsPointPtr points;
|
---|
136 | } c;
|
---|
137 | } PsElmRec;
|
---|
138 |
|
---|
139 | typedef PsElmRec *PsElmPtr;
|
---|
140 |
|
---|
141 | typedef struct PsClipRec_
|
---|
142 | {
|
---|
143 | int nRects;
|
---|
144 | PsRectPtr rects;
|
---|
145 | int nElms;
|
---|
146 | PsElmPtr elms;
|
---|
147 | int nOutterClips;
|
---|
148 | PsRectPtr outterClips;
|
---|
149 | } PsClipRec;
|
---|
150 |
|
---|
151 | typedef PsClipRec *PsClipPtr;
|
---|
152 |
|
---|
153 | typedef enum PsFTDownloadFontType_
|
---|
154 | {
|
---|
155 | PsFontBitmap=0,
|
---|
156 | PsFontType1,
|
---|
157 | PsFontType3
|
---|
158 | } PsFTDownloadFontType;
|
---|
159 |
|
---|
160 | /* Define |PsOutColor| color type which can hold one RGB value
|
---|
161 | * (note: this needs to be |signed| long/long long to represent
|
---|
162 | * special values such as |PSOUTCOLOR_NOCOLOR|)
|
---|
163 | */
|
---|
164 | #ifdef PSOUT_USE_DEEPCOLOR
|
---|
165 | /* 64bit |PsOutColor| which can hold 16bit R-,G-,B-values */
|
---|
166 | #ifdef WIN32
|
---|
167 | typedef signed __int64 PsOutColor;
|
---|
168 | #else
|
---|
169 | # if defined(__alpha__) || defined(__alpha) || \
|
---|
170 | defined(ia64) || defined(__ia64__) || \
|
---|
171 | defined(__sparc64__) || defined(_LP64) || \
|
---|
172 | defined(__s390x__) || \
|
---|
173 | defined(amd64) || defined (__amd64__) || \
|
---|
174 | defined (__powerpc64__) || \
|
---|
175 | (defined(sgi) && (_MIPS_SZLONG == 64))
|
---|
176 | typedef signed long PsOutColor;
|
---|
177 | # else
|
---|
178 | typedef signed long long PsOutColor;
|
---|
179 | # endif /* native 64bit platform */
|
---|
180 | #endif /* WIN32 */
|
---|
181 |
|
---|
182 | #define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 32)
|
---|
183 | #define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 16) & 0xFFFF)
|
---|
184 | #define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFFFF)
|
---|
185 | #define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 65535.)
|
---|
186 | #define PSOUTCOLOR_WHITE (0xFFFFFFFFFFFFLL)
|
---|
187 | #define PSOUTCOLOR_NOCOLOR (-1LL)
|
---|
188 | #define PSOUTCOLOR_TO_RGB24BIT(clr) (((PSOUTCOLOR_TO_REDBITS(clr) >> 8) << 16) | \
|
---|
189 | ((PSOUTCOLOR_TO_GREENBITS(clr) >> 8) << 8) | \
|
---|
190 | ((PSOUTCOLOR_TO_BLUEBITS(clr) >> 8) << 0))
|
---|
191 | #else
|
---|
192 | /* 32bit |PsOutColor| which can hold 8bit R-,G-,B-values */
|
---|
193 | typedef signed long PsOutColor;
|
---|
194 | #define PSOUTCOLOR_TO_REDBITS(clr) ((clr) >> 16)
|
---|
195 | #define PSOUTCOLOR_TO_GREENBITS(clr) (((clr) >> 8) & 0xFF)
|
---|
196 | #define PSOUTCOLOR_TO_BLUEBITS(clr) ((clr) & 0xFF)
|
---|
197 | #define PSOUTCOLOR_BITS_TO_PSFLOAT(b) ((float)(b) / 255.)
|
---|
198 | #define PSOUTCOLOR_WHITE (0xFFFFFF)
|
---|
199 | #define PSOUTCOLOR_NOCOLOR (-1)
|
---|
200 | #define PSOUTCOLOR_TO_RGB24BIT(clr) ((PSOUTCOLOR_TO_REDBITS(clr) << 16) | \
|
---|
201 | (PSOUTCOLOR_TO_GREENBITS(clr) << 8) | \
|
---|
202 | (PSOUTCOLOR_TO_BLUEBITS(clr) << 0))
|
---|
203 | #endif /* PSOUT_USE_DEEPCOLOR */
|
---|
204 |
|
---|
205 | #ifdef USE_PSOUT_PRIVATE
|
---|
206 | typedef void *voidPtr;
|
---|
207 |
|
---|
208 | typedef struct PsPatRec_
|
---|
209 | {
|
---|
210 | PsFillEnum type;
|
---|
211 | voidPtr tag;
|
---|
212 | } PsPatRec;
|
---|
213 |
|
---|
214 | typedef PsPatRec *PsPatPtr;
|
---|
215 |
|
---|
216 | typedef struct PsOutRec_
|
---|
217 | {
|
---|
218 | FILE *Fp;
|
---|
219 | char Buf[16384];
|
---|
220 | PsOutColor CurColor;
|
---|
221 | int LineWidth;
|
---|
222 | PsCapEnum LineCap;
|
---|
223 | PsJoinEnum LineJoin;
|
---|
224 | int NDashes;
|
---|
225 | int *Dashes;
|
---|
226 | int DashOffset;
|
---|
227 | PsOutColor LineBClr;
|
---|
228 | PsRuleEnum FillRule;
|
---|
229 | char *FontName;
|
---|
230 | int FontSize;
|
---|
231 | float FontMtx[4];
|
---|
232 | int ImageFormat;
|
---|
233 | int RevImage;
|
---|
234 | int NPatterns;
|
---|
235 | int MxPatterns;
|
---|
236 | PsPatPtr Patterns;
|
---|
237 | int ClipType;
|
---|
238 | PsClipRec Clip;
|
---|
239 | int InFrame;
|
---|
240 | int XOff;
|
---|
241 | int YOff;
|
---|
242 |
|
---|
243 | PsFillEnum InTile;
|
---|
244 | int ImgSkip;
|
---|
245 | PsOutColor ImgBClr;
|
---|
246 | PsOutColor ImgFClr;
|
---|
247 | int ImgX;
|
---|
248 | int ImgY;
|
---|
249 | int ImgW;
|
---|
250 | int ImgH;
|
---|
251 | int SclW;
|
---|
252 | int SclH;
|
---|
253 |
|
---|
254 | Bool isRaw;
|
---|
255 |
|
---|
256 | int pagenum;
|
---|
257 |
|
---|
258 | int start_image;
|
---|
259 | } PsOutRec;
|
---|
260 |
|
---|
261 | typedef struct PsOutRec_ *PsOutPtr;
|
---|
262 |
|
---|
263 | extern void S_Flush(PsOutPtr self);
|
---|
264 | extern void S_OutNum(PsOutPtr self, float num);
|
---|
265 | extern void S_OutTok(PsOutPtr self, char *tok, int cr);
|
---|
266 | #else
|
---|
267 | typedef struct PsOutRec_ *PsOutPtr;
|
---|
268 | #endif /* USE_PSOUT_PRIVATE */
|
---|
269 |
|
---|
270 | extern PsOutPtr PsOut_BeginFile(FILE *fp, char *title, int orient, int count, int plex,
|
---|
271 | int res, int wd, int ht, Bool raw);
|
---|
272 | extern void PsOut_EndFile(PsOutPtr self, int closeFile);
|
---|
273 | extern void PsOut_BeginPage(PsOutPtr self, int orient, int count, int plex,
|
---|
274 | int res, int wd, int ht);
|
---|
275 | extern void PsOut_EndPage(PsOutPtr self);
|
---|
276 | extern void PsOut_DirtyAttributes(PsOutPtr self);
|
---|
277 | extern void PsOut_Comment(PsOutPtr self, char *comment);
|
---|
278 | extern void PsOut_Offset(PsOutPtr self, int x, int y);
|
---|
279 |
|
---|
280 | extern void PsOut_Clip(PsOutPtr self, int clpTyp, PsClipPtr clpinf);
|
---|
281 |
|
---|
282 | extern void PsOut_Color(PsOutPtr self, PsOutColor clr);
|
---|
283 | extern void PsOut_FillRule(PsOutPtr self, PsRuleEnum rule);
|
---|
284 | extern void PsOut_LineAttrs(PsOutPtr self, int wd, PsCapEnum cap,
|
---|
285 | PsJoinEnum join, int nDsh, int *dsh, int dshOff,
|
---|
286 | PsOutColor bclr);
|
---|
287 | extern void PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso);
|
---|
288 | extern void PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso);
|
---|
289 |
|
---|
290 | extern void PsOut_Polygon(PsOutPtr self, int nPts, PsPointPtr pts);
|
---|
291 | extern void PsOut_FillRect(PsOutPtr self, int x, int y, int w, int h);
|
---|
292 | extern void PsOut_FillArc(PsOutPtr self, int x, int y, int w, int h,
|
---|
293 | float ang1, float ang2, PsArcEnum style);
|
---|
294 |
|
---|
295 | extern void PsOut_Lines(PsOutPtr self, int nPts, PsPointPtr pts);
|
---|
296 | extern void PsOut_Points(PsOutPtr self, int nPts, PsPointPtr pts);
|
---|
297 | extern void PsOut_DrawRect(PsOutPtr self, int x, int y, int w, int h);
|
---|
298 | extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
|
---|
299 | float ang1, float ang2);
|
---|
300 |
|
---|
301 | extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
|
---|
302 | PsOutColor bclr);
|
---|
303 | extern void PsOut_Text16(PsOutPtr self, int x, int y, unsigned short *text, int textl, PsOutColor bclr);
|
---|
304 |
|
---|
305 | extern void PsOut_BeginImage(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
|
---|
306 | int w, int h, int sw, int sh, int format);
|
---|
307 | extern void PsOut_BeginImageIM(PsOutPtr self, PsOutColor bclr, PsOutColor fclr, int x, int y,
|
---|
308 | int w, int h, int sw, int sh, int format);
|
---|
309 | extern void PsOut_EndImage(PsOutPtr self);
|
---|
310 | extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
|
---|
311 |
|
---|
312 | extern void PsOut_BeginFrame(PsOutPtr self, int xoff, int yoff, int x, int y,
|
---|
313 | int w, int h);
|
---|
314 | extern void PsOut_EndFrame(PsOutPtr self);
|
---|
315 |
|
---|
316 | extern int PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h,
|
---|
317 | PsFillEnum type, PsOutColor bclr, PsOutColor fclr);
|
---|
318 | extern void PsOut_EndPattern(PsOutPtr self);
|
---|
319 | extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
|
---|
320 |
|
---|
321 | extern void PsOut_RawData(PsOutPtr self, char *data, int len);
|
---|
322 |
|
---|
323 | extern int PsOut_DownloadType1(PsOutPtr self, const char *auditmsg, const char *name, const char *fname);
|
---|
324 |
|
---|
325 | extern int PsOut_DownloadFreeType1(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
|
---|
326 | extern int PsOut_DownloadFreeType3(PsOutPtr self, const char *psfontname, FontPtr pFont, long block_offset);
|
---|
327 |
|
---|
328 | extern int PsOut_DownloadFreeType(PsOutPtr self, PsFTDownloadFontType downloadfonttype, const char *psfontname, FontPtr pFont, long block_offset);
|
---|
329 | extern void PsOut_Get_FreeType_Glyph_Name( char *destbuf, FontPtr pFont, unsigned long x11fontindex);
|
---|
330 | extern void PsOut_FreeType_Text(FontPtr pFont, PsOutPtr self, int x, int y, char *text, int textl);
|
---|
331 | extern void PsOut_FreeType_Text16(FontPtr pFont, PsOutPtr self, int x, int y, unsigned short *text, int textl);
|
---|
332 |
|
---|
333 | extern void PsOut_FreeType_TextAttrs16(PsOutPtr self, char *fnam, int siz, int iso);
|
---|
334 | extern void PsOut_FreeType_TextAttrsMtx16(PsOutPtr self, char *fnam, float *mtx, int iso);
|
---|
335 | #endif
|
---|