1 /*
2  * bltPs.h --
3  *
4  * Copyright 1993-1998 Lucent Technologies, Inc.
5  *
6  * Permission to use, copy, modify, and distribute this software and
7  * its documentation for any purpose and without fee is hereby
8  * granted, provided that the above copyright notice appear in all
9  * copies and that both that the copyright notice and warranty
10  * disclaimer appear in supporting documentation, and that the names
11  * of Lucent Technologies any of their entities not be used in
12  * advertising or publicity pertaining to distribution of the software
13  * without specific, written prior permission.
14  *
15  * Lucent Technologies disclaims all warranties with regard to this
16  * software, including all implied warranties of merchantability and
17  * fitness.  In no event shall Lucent Technologies be liable for any
18  * special, indirect or consequential damages or any damages
19  * whatsoever resulting from loss of use, data or profits, whether in
20  * an action of contract, negligence or other tortuous action, arising
21  * out of or in connection with the use or performance of this
22  * software.
23  */
24 
25 #ifndef _BLT_PS_H
26 #define _BLT_PS_H
27 
28 #include "bltImage.h"
29 
30 typedef enum {
31     PS_MODE_MONOCHROME,
32     PS_MODE_GREYSCALE,
33     PS_MODE_COLOR
34 } PsColorMode;
35 
36 typedef struct PsTokenStruct *PsToken;
37 
38 struct PsTokenStruct {
39     Tcl_Interp *interp;		/* Interpreter to report errors to. */
40 
41     Tk_Window tkwin;		/* Tk_Window used to get font and color
42 				 * information */
43 
44     Tcl_DString dString;	/* Dynamic string used to contain the
45 				 * PostScript generated. */
46 
47     char *fontVarName;		/* Name of a Tcl array variable to convert
48 				 * X font names to PostScript fonts. */
49 
50     char *colorVarName;		/* Name of a Tcl array variable to convert
51 				 * X color names to PostScript. */
52 
53     PsColorMode colorMode;	/* Mode: color or greyscale */
54 
55 #define PSTOKEN_BUFSIZ	((BUFSIZ*2)-1)
56     /*
57      * Utility space for building strings.  Currently used to create
58      * PostScript output for the "postscript" command.
59      */
60     char scratchArr[PSTOKEN_BUFSIZ+1];
61 };
62 
63 extern PsToken Blt_GetPsToken _ANSI_ARGS_((Tcl_Interp *interp,
64 			   Tk_Window tkwin));
65 
66 extern void Blt_ReleasePsToken _ANSI_ARGS_((PsToken psToken));
67 
68 extern char *Blt_PostScriptFromToken _ANSI_ARGS_((PsToken psToken));
69 extern char *Blt_ScratchBufferFromToken _ANSI_ARGS_((PsToken psToken));
70 
71 extern void Blt_AppendToPostScript _ANSI_ARGS_(TCL_VARARGS(PsToken, psToken));
72 
73 extern void Blt_FormatToPostScript _ANSI_ARGS_(TCL_VARARGS(PsToken, psToken));
74 
75 extern void Blt_Draw3DRectangleToPostScript _ANSI_ARGS_((PsToken psToken,
76 	Tk_3DBorder border, double x, double y, int width, int height,
77 	int borderWidth, int relief));
78 
79 extern void Blt_Fill3DRectangleToPostScript _ANSI_ARGS_((PsToken psToken,
80 	Tk_3DBorder border, double x, double y, int width, int height,
81 	int borderWidth, int relief));
82 
83 extern void Blt_BackgroundToPostScript _ANSI_ARGS_((PsToken psToken,
84 	XColor *colorPtr));
85 
86 extern void Blt_BitmapDataToPostScript _ANSI_ARGS_((PsToken psToken,
87 	Display *display, Pixmap bitmap, int width, int height));
88 
89 extern void Blt_ClearBackgroundToPostScript _ANSI_ARGS_((PsToken psToken));
90 
91 extern int Blt_ColorImageToPsData _ANSI_ARGS_((Blt_ColorImage image,
92 	int nComponents, Tcl_DString * resultPtr, char *prefix));
93 
94 extern void Blt_ColorImageToPostScript _ANSI_ARGS_((PsToken psToken,
95 	Blt_ColorImage image, double x, double y));
96 
97 extern void Blt_ForegroundToPostScript _ANSI_ARGS_((PsToken psToken,
98 	XColor *colorPtr));
99 
100 extern void Blt_FontToPostScript _ANSI_ARGS_((PsToken psToken, Tk_Font font));
101 
102 extern void Blt_WindowToPostScript _ANSI_ARGS_((PsToken psToken,
103 	Tk_Window tkwin, double x, double y));
104 
105 extern void Blt_LineDashesToPostScript _ANSI_ARGS_((PsToken psToken,
106 	Blt_Dashes *dashesPtr));
107 
108 extern void Blt_LineWidthToPostScript _ANSI_ARGS_((PsToken psToken,
109 	int lineWidth));
110 
111 extern void Blt_PathToPostScript _ANSI_ARGS_((PsToken psToken,
112 	Point2D *screenPts, int nScreenPts));
113 
114 extern void Blt_PhotoToPostScript _ANSI_ARGS_((PsToken psToken,
115 	Tk_PhotoHandle photoToken, double x, double y));
116 
117 extern void Blt_PolygonToPostScript _ANSI_ARGS_((PsToken psToken,
118 	Point2D *screenPts, int nScreenPts));
119 
120 extern void Blt_LineToPostScript _ANSI_ARGS_((PsToken psToken,
121 	XPoint *pointArr, int nPoints));
122 
123 extern void Blt_TextToPostScript _ANSI_ARGS_((PsToken psToken, char *string,
124 	TextStyle *attrPtr, double x, double y));
125 
126 extern void Blt_RectangleToPostScript _ANSI_ARGS_((PsToken psToken, double x,
127 	double y, int width, int height));
128 
129 extern void Blt_RegionToPostScript _ANSI_ARGS_((PsToken psToken, double x,
130 	double y, int width, int height));
131 
132 extern void Blt_RectanglesToPostScript _ANSI_ARGS_((PsToken psToken,
133 	XRectangle *rectArr, int nRects));
134 
135 extern void Blt_BitmapToPostScript _ANSI_ARGS_((PsToken psToken,
136 	Display *display, Pixmap bitmap, double scaleX, double scaleY));
137 
138 extern void Blt_SegmentsToPostScript _ANSI_ARGS_((PsToken psToken,
139 	XSegment *segArr, int nSegs));
140 
141 extern void Blt_StippleToPostScript _ANSI_ARGS_((PsToken psToken,
142 	Display *display, Pixmap bitmap));
143 
144 extern void Blt_LineAttributesToPostScript _ANSI_ARGS_((PsToken psToken,
145 	XColor *colorPtr, int lineWidth, Blt_Dashes *dashesPtr, int capStyle,
146 	int joinStyle));
147 
148 extern int Blt_FileToPostScript _ANSI_ARGS_((PsToken psToken,
149 	char *fileName));
150 
151 extern void Blt_2DSegmentsToPostScript _ANSI_ARGS_((PsToken psToken,
152 	Segment2D *segments, int nSegments));
153 
154 #endif /* BLT_PS_H */
155