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
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*
* Smithsonian Astrophysical Observatory, Cambridge, MA, USA
* This code has been modified under the terms listed below and is made
* available under the same terms.
*/
/*
* Copyright 1993-2004 George A Howlett.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _BLT_PS_H
#define _BLT_PS_H
#include "bltConfig.h"
typedef struct {
Tk_OptionTable optionTable;
int reqWidth, reqHeight; /* If greater than zero, represents the
* requested dimensions of the printed graph */
int reqPaperWidth;
int reqPaperHeight; /* Requested dimensions for the PostScript
* page. Can constrain the size of the graph
* if the graph (plus padding) is larger than
* the size of the page. */
int xPad, yPad; /* Requested padding on the exterior of the
* graph. This forms the bounding box for
* the page. */
const char *fontVarName; /* If non-NULL, is the name of a TCL array
* variable containing X to output device font
* translations */
int level; /* PostScript Language level 1-3 */
int decorations;
int center;
int footer;
int greyscale;
int landscape;
unsigned int flags;
const char **comments; /* User supplied comments to be added. */
/* Computed fields */
short int left, bottom; /* Bounding box of the plot in the page. */
short int right, top;
float scale; /* Scale of page. Set if "-maxpect" option
* is set, otherwise 1.0. */
int paperHeight;
int paperWidth;
} PageSetup;
#define PS_MAXPECT (1<<4)
#define PS_FMT_NONE 0
#define PS_FMT_MASK (PS_FMT_WMF|PS_FMT_EPSI|PS_FMT_TIFF)
#define PS_FMT_WMF (1<<8)
#define PS_FMT_EPSI (1<<9)
#define PS_FMT_TIFF (1<<10)
typedef struct _Blt_Ps *Blt_Ps;
extern Blt_Ps Blt_Ps_Create(Tcl_Interp* interp, PageSetup *setupPtr);
extern void Blt_Ps_Free(Blt_Ps ps);
extern const char *Blt_Ps_GetValue(Blt_Ps ps, int *lengthPtr);
extern Tcl_Interp *Blt_Ps_GetInterp(Blt_Ps ps);
extern Tcl_DString *Blt_Ps_GetDString(Blt_Ps ps);
extern char *Blt_Ps_GetScratchBuffer(Blt_Ps ps);
extern void Blt_Ps_SetInterp(Blt_Ps ps, Tcl_Interp* interp);
extern void Blt_Ps_Append(Blt_Ps ps, const char *string);
extern void Blt_Ps_AppendBytes(Blt_Ps ps, const char *string, int nBytes);
extern void Blt_Ps_VarAppend TCL_VARARGS(Blt_Ps, ps);
extern void Blt_Ps_Format TCL_VARARGS(Blt_Ps, ps);
extern void Blt_Ps_SetClearBackground(Blt_Ps ps);
extern int Blt_Ps_IncludeFile(Tcl_Interp* interp, Blt_Ps ps,
const char *fileName);
extern int Blt_Ps_ComputeBoundingBox(PageSetup *setupPtr, int w, int h);
extern void Blt_Ps_Rectangle(Blt_Ps ps, int x, int y, int w, int h);
extern int Blt_Ps_SaveFile(Tcl_Interp* interp, Blt_Ps ps,
const char *fileName);
#ifdef _TK
#include "bltText.h"
extern void Blt_Ps_XSetLineWidth(Blt_Ps ps, int lineWidth);
extern void Blt_Ps_XSetBackground(Blt_Ps ps, XColor* colorPtr);
extern void Blt_Ps_XSetBitmapData(Blt_Ps ps, Display *display,
Pixmap bitmap, int width, int height);
extern void Blt_Ps_XSetForeground(Blt_Ps ps, XColor* colorPtr);
extern void Blt_Ps_XSetFont(Blt_Ps ps, Tk_Font font);
extern void Blt_Ps_XSetDashes(Blt_Ps ps, Blt_Dashes *dashesPtr);
extern void Blt_Ps_XSetLineAttributes(Blt_Ps ps, XColor* colorPtr,
int lineWidth, Blt_Dashes *dashesPtr, int capStyle, int joinStyle);
extern void Blt_Ps_XSetStipple(Blt_Ps ps, Display *display, Pixmap bitmap);
extern void Blt_Ps_Polyline(Blt_Ps ps, Point2d *screenPts, int nScreenPts);
extern void Blt_Ps_XDrawLines(Blt_Ps ps, XPoint *points, int n);
extern void Blt_Ps_XDrawSegments(Blt_Ps ps, XSegment *segments,
int nSegments);
extern void Blt_Ps_DrawPolyline(Blt_Ps ps, Point2d *points, int n);
extern void Blt_Ps_Draw2DSegments(Blt_Ps ps, Segment2d *segments,
int nSegments);
extern void Blt_Ps_Draw3DRectangle(Blt_Ps ps, Tk_3DBorder border,
double x, double y, int width, int height, int borderWidth, int relief);
extern void Blt_Ps_Fill3DRectangle(Blt_Ps ps, Tk_3DBorder border, double x,
double y, int width, int height, int borderWidth, int relief);
extern void Blt_Ps_XFillRectangle(Blt_Ps ps, double x, double y,
int width, int height);
extern void Blt_Ps_XFillRectangles(Blt_Ps ps, XRectangle *rects, int n);
extern void Blt_Ps_XFillPolygon(Blt_Ps ps, Point2d *screenPts,
int nScreenPts);
extern void Blt_Ps_DrawPhoto(Blt_Ps ps, Tk_PhotoHandle photoToken,
double x, double y);
extern void Blt_Ps_XDrawWindow(Blt_Ps ps, Tk_Window tkwin,
double x, double y);
extern void Blt_Ps_DrawText(Blt_Ps ps, const char *string,
TextStyle *attrPtr, double x, double y);
extern void Blt_Ps_DrawBitmap(Blt_Ps ps, Display *display, Pixmap bitmap,
double scaleX, double scaleY);
extern void Blt_Ps_XSetCapStyle(Blt_Ps ps, int capStyle);
extern void Blt_Ps_XSetJoinStyle(Blt_Ps ps, int joinStyle);
extern void Blt_Ps_PolylineFromXPoints(Blt_Ps ps, XPoint *points, int n);
extern void Blt_Ps_Polygon(Blt_Ps ps, Point2d *screenPts, int nScreenPts);
extern void Blt_Ps_SetPrinting(Blt_Ps ps, int value);
extern int Blt_Ps_IsPrinting(void);
extern void Blt_Ps_FontName(const char *family, int flags,
Tcl_DString *resultPtr);
#endif /* _TK */
#endif /* BLT_PS_H */
|