1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1995, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
//-----------------------------------------------------------------------------
28
/// PostScript(tm) grafport class.
29
class PSGrafport: public Grafport {
30
/*@Doc: {\large {\bf scope:} GUI} */
32
/// open grafport to filename, When filename = "", stdout is used.
33
PSGrafport(const char *fileName);
35
virtual ~PSGrafport();
38
bool IsSucces() {return succes;}
40
// Sizes, refreshments etc.
42
void ClearArea(double, double, double, double) {}
46
void SetLineWidth(unsigned n);
50
void SetBackgroundColor(const string *);
52
void SetBackgroundColor(const char *);
54
void SetForegroundColor(const string *);
56
void SetForegroundColor(const char *);
58
// Drawing Rectangles.
60
void DrawRectangle(double x, double y, double wd, double ht);
62
void FillRectangle(double x, double y, double wd, double ht);
65
void DrawUnzoomedRectangle(double x, double y, double wd, double ht);
69
void DrawStringLeft(double x, double y, const char *str);
71
void DrawStringCentered(double x, double y, const char *str);
73
void DrawStringRight(double x, double y, const char *str);
75
void DrawUnzoomedStringLeft(double x, double y, const char *str);
77
void DrawUnzoomedStringCentered(double x, double y, const char *str);
79
// Drawing Underlined Strings.
81
void DrawStringLeftUnderlined(double x, double y, const char *str);
83
void DrawStringRightUnderlined(double x, double y, const char *str);
85
void DrawStringCenteredUnderlined(double x, double y, const char *str);
89
// void DrawLine(double x1, double y1, double x2, double y2);
91
void DrawUnzoomedLine(double x1, double y1, double x2, double y2);
96
void DrawPoint(double x, double y);
100
void DrawEllipse(double x, double y, double wd, double ht);
102
void FillEllipse(double x, double y, double wd, double ht);
106
/* virtual */ void FillSegment(double x, double y,
107
double wd, double ht, int arc1, int arc2);
111
void DrawPolygon(const Point *points, int n);
113
void FillPolygon(const Point *points, int n);
115
/* virtual */ void FillPolygon(const DPoint *points, int n);
117
// Postscript thingies.
118
/// generate postscript header.
119
void Header(const char *title, const char *creator);
122
void BeginDrawProc();
128
/// concat banner from file with name of document.
129
void Banner(const char *title);
132
void BeginPage(int i, int j, int nx, int tot);
137
/// generate postscript trailer.
140
/// set grafport font.
141
void SetFont(XFont *font);
143
/// header for encapsulated postscript + bounding box
144
void EPSHeader(const char *title, const char *creator,
145
double llx, double lly, double urx, double ury);
148
void EPSProlog(double y, double dy);
150
void SetPageSize(double x, double y) {width = x; height = y;}
152
void SetFactor(double f) {factor = f;}
154
void SetISOLatin1Encoding(bool b) {isoLatin1Encoding = b;}
156
void SetShowColors(bool b) {showColors = b;}
158
/// postscript file containing front page for printer.
159
static const char BANNER[];
162
static const double XOFF;
164
static const double YOFF;
167
/* virtual */ void DrawSimpleArc(double x, double y,
168
double wd, double ht, int arc1, int arc2);
170
/* virtual */ void DrawSimplePolygon(const DPoint *points,
173
/* virtual */ void DrawSimpleCurve(const DPoint *points);
175
static void MakePSString(string *str);
177
static void FixEscapeChar(string *str, char c);
179
static void FixNonAscii(string *str);
183
void InstallIsoLatin1Font(const char *psFont);
187
void DrawPSRectangle(double x, double y, double wd, double ht);
189
void DrawPSLine(double x1, double y1, double x2, double y2);
191
void DrawPSPolygon(const Point *point, int nrPoints);
193
/// postscript output file.
204
bool isoLatin1Encoding;
208
/// default PostScript line width.
209
static const double DEFAULT_LINE_WIDTH;
212
List<string> definedFonts;
217
void UnsetPSDashes();