summaryrefslogtreecommitdiff
path: root/html/en/drv/ps.html
blob: 9f4267a122b7053fd57dfd4b621cb65ad0249704 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>CD_PS</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<h2 style="text-align: left">CD_PS - PostScript Driver (cdps.h)</h2>

  <p>This drivers allows generating a PostScript file. This format was created to be a high-quality graphics language 
  for printers and is currently supported by several printers. If your printer supports PostScript, you can send the 
  file generated by the driver directly to the printer port. Usually, the filename has an extension .PS or .EPS. The 
  driver generates level-2 PostScript, therefore some PostScript viewers might present errors. The format's copyrights 
  are property of <a href="http://www.adobe.com" target="_top">Adobe Systems</a>. </p>

<h3>Use</h3>

  <p>The file is created and opened by calling function <font face="Courier">
  <a href="../func/init.html#cdCreateCanvas"><strong>cdCreateCanvas</strong></a>(CD_PS, 
  Data)</font>, in which <font face="Courier">Data</font> contains the filename and canvas dimensions. This function 
  opens the file and writes its header. Then, other functions in the CD library can be called as usual. The
  <font face="Courier">Data</font> parameter string has the following format:</p>
  
    <pre>&quot;<em>filename -p[paper] -w[width] -h[height] -l[left] -r[right] -b[bottom] -t[top] -s[resolution] [-e]</em> <em>[-g] [-o] [-1] d[margin]</em>&quot;<em><br>
</em>or in C<em><br>
&quot;<strong><tt>%s -p%d -w%g -h%g -l%g -r%g -b%g -t%g -s%d -e -o -1 -g -d%g</tt></strong>&quot;</em></pre>
  
  <p>The filename must be inside double quotes (&quot;) if it has spaces. Any amount of such canvases may exist 
  simultaneously. It is important to note that a call to function
  <a href="../func/init.html#cdKillCanvas"><font face="Courier"><strong>
  cdKillCanvas</strong></font></a> is required to <b>close</b> the file properly.</p>
  <p><b>Paper Size - </b>The default paper size is A4. It is possible to change it by using one of the predefined sizes 
  - <strong><tt>CD_A0</tt></strong>, <strong><tt>CD_A1</tt></strong>, <strong><tt>CD_A2</tt></strong>, <strong><tt>CD_A3</tt></strong>,
  <strong><tt>CD_A4</tt></strong>, <strong><tt>CD_A5</tt></strong>, <strong><tt>CD_LETTER</tt></strong> and <strong><tt>
  CD_LEGAL</tt></strong> - with parameter &quot;<font face="Courier">-p</font>&quot;. It is also possible to define a paper in a 
  particular size by using parameters &quot;<font face="Courier">-w</font>&quot; e &quot;<font face="Courier">-h</font>&quot;. Values are 
  provided in millimeters.</p>

<div align="center">
  <center>
  <table border="1" cellpadding="3">
    <caption valign="top"><font size="4">Default Paper Sizes</font></caption>
    <tr>
      <td>&nbsp;</td>
      <th>Width (mm)</th>
      <th>Length (mm)</th>
    </tr>
    <tr>
      <td><strong>A0</strong></td>
      <td align="center">841</td>
      <td align="center">1187</td>
    </tr>
    <tr>
      <td><strong>A1</strong></td>
      <td align="center">594</td>
      <td align="center">841</td>
    </tr>
    <tr>
      <td><strong>A2</strong></td>
      <td align="center">420</td>
      <td align="center">594</td>
    </tr>
    <tr>
      <td><strong>A3</strong></td>
      <td align="center">297</td>
      <td align="center">420</td>
    </tr>
    <tr>
      <td><strong>A4</strong></td>
      <td align="center">210</td>
      <td align="center">297</td>
    </tr>
    <tr>
      <td><strong>A5</strong></td>
      <td align="center">148</td>
      <td align="center">210</td>
    </tr>
    <tr>
      <td><strong>Letter</strong></td>
      <td align="center">216</td>
      <td align="center">279</td>
    </tr>
    <tr>
      <td><strong>Legal</strong></td>
      <td align="center">216</td>
      <td align="center">356</td>
    </tr>
  </table>
  </center>
</div>

  <p><b>Margins -</b> The margins are controlled by parameters &quot;<font face="Courier">-l</font>&quot; &quot;<font face="Courier">-r</font>&quot; 
  &quot;<font face="Courier">-t</font>&quot; and &quot;<font face="Courier">-b</font>&quot; (<em>left, right, top, bottom</em>). Values are 
  provided in millimeters. Default margins are 25.4 mm to all parameters. You can draw only inside the margins.</p>
  <p><b>Resolution -</b> Resolution is used to convert values from millimeters to pixels (the same as points, but the 
  number of points is per inch - DPI). Use parameter &quot;<font face="Courier">-s</font>&quot; to configure the resolution. The 
  default value is 300 DPI.</p>
  <p><b>Orientation -</b> The page can be oriented as portrait or landscape. The default value is portrait, but when the 
  parameter &quot;-o&quot; is used, the horizontal and vertical values are switched.</p>
  <p><b>EPS -</b> The PostScript file can be in an <strong>Encapsulated PostScript<b> </b></strong>format. For such, 
  simply specify the parameter &quot;<font face="Courier">-e</font>&quot;. It is useful for other applications to import the 
  PostScript file. You can define the margins of the bounding box by means of parameter &quot;<font face="Courier">-d</font>&quot;, 
  in millimeters.</p>
  <p><b>Debug -</b> Parameter &quot;<font face="Courier">-g</font>&quot; adds a series of comments to the PS file, making the 
  beginning and end of a command from the CD library explicit. It is useful only for those who understand PostScript and 
  wish to identify a problem. It considerably increases the file size.</p>
  <p><b>Level 1 -</b> Parameter &quot;<font face="Courier">-1</font>&quot; forces the driver to generate a level-1 PostScript. In 
  this case, pattern, stipple and hatch are not supported.</p>
  <p><b>Pages -</b> Use function <font face="Courier">cdFlush</font> to change to a new page. The previous page will not 
  be changed.</p>

<h3>Behavior of Functions</h3>
<h4>Control</h4>
<ul>
  <li><a href="../func/other.html#cdPlay"><font face="Courier"><strong>Play</strong></font></a>: 
  does nothing, returns <font face="Courier">CD_ERROR</font>. </li>
  <li><a href="../func/control.html#cdFlush"><font face="Courier"><strong>Flush</strong></font></a>: 
  changes to a new page, preserving the previous one. Does nothing in EPS mode.</li>
  <li><a href="../func/control.html#cdClear"><font face="Courier"><strong>Clear</strong></font></a>: 
  does nothing.</li>
</ul>
<h4>Coordinate System&nbsp;&amp; Clipping</h4>
<ul>
  <li><a href="../func/coordinates.html#cdGetCanvasSize"><font face="Courier">
  <strong>GetCanvasSize</strong></font></a>: returns the page's size within the margins (drawing area).</li>
  <li><a href="../func/coordinates.html#cdUpdateYAxis"><font face="Courier">
  <strong>UpdateYAxis</strong></font></a>: does nothing.</li>
  <li><b>Complex Regions</b>: not supported.</li>
	<li><strong>Clipping</strong>: not supported in EPS.</li>
</ul>
<h4>Attributes</h4>
<ul>
  <li><a href="../func/attributes.html#cdBackground"><font face="Courier">
  <strong>
  Background</strong></font></a> does nothing, returns <font face="Courier">CD_WHITE</font>.</li>
  <li><a href="../func/filled.html#cdBackOpacity"><font face="Courier"><strong>
  BackOpacity</strong></font></a>: does nothing, returns <font face="Courier">CD_TRANSPARENT</font>.</li>
  <li><a href="../func/attributes.html#cdWriteMode"><font face="Courier">
  <strong>
  WriteMode</strong></font></a>: does nothing, returns <font face="Courier">CD_REPLACE</font>.</li>
  <li><a href="../func/text.html#cdFontDim"><font face="Courier"><strong>FontDim</strong></font></a>: 
  is simulated.</li>
  <li><a href="../func/text.html#cdTextSize"><font face="Courier"><strong>
  TextSize</strong></font></a>: is simulated.</li>
  <li><a href="../func/filled.html#cdHatch"><font face="Courier"><strong>Hatch</strong></font></a>: 
  is always opaque (to be implemented).</li>
  <li><a href="../func/filled.html#cdStipple"><font face="Courier"><strong>
  Stipple</strong></font></a>: is always opaque (to be implemented).</li>
  <li><a href="../func/text.html#cdTextAlignment"><font face="Courier"><strong>
  TextAlignment</strong></font></a>: <font face="Courier">Baseline</font> is the same as <font face="Courier">South</font>.</li>
  <li><a href="../func/text.html#cdFont"><font face="Courier"><strong>Font</strong></font></a>: 
  old name &quot;System&quot; is mapped to &quot;Courier&quot;. Styles are added to the Postscript 
  font name.</li>
</ul>
<h4>Colors </h4>
<ul>
  <li><a href="../func/color.html#cdGetColorPlanes"><font face="Courier">
  <strong>
  GetColorPlanes</strong></font></a>: returns 24.</li>
  <li><a href="../func/color.html#cdPalette"><font face="Courier"><strong>Palette</strong></font></a>: 
  does nothing. </li>
</ul>
<h4>Client Images</h4>
<ul>
  <li><a href="../func/client.html#cdGetImageRGB"><font face="Courier"><strong>
  GetImageRGB</strong></font></a>: does nothing.</li>
  <li><font face="Courier"><strong><a href="../func/client.html#cdPutImageMap">
  PutImageMap</a></strong></font>: stores an RGB image in the file (to be implemented).</li>
  <li><a href="../func/client.html#cdPutImageRGBA"><font face="Courier"><strong>
  PutImageRGBA</strong></font></a>: alpha is ignored (to be implemented).</li>
</ul>
<h4>Primitives</h4>
<ul>
  <li><font face="Courier"><strong><a href="../func/marks.html#cdPixel">Pixel</a></strong></font>: 
  does not exist in PS, is simulated using a circle with radius=1.</li>
  <li>Floating point primitives are supported.</li>
  <li>Filled primitives do not include the line at the edges of the filled area.</li>
	<li><a href="../func/lines.html#cdBegin">
  <font face="Courier"><strong>Begin</strong></font></a>: <strong><tt>CD_PATH</tt></strong> 
	is supported.</li>
</ul>
<h4>Server Images</h4>
<ul>
  <li>All functions do nothing.</li>
</ul>
<h4>Exclusive Attributes</h4>
<ul>
  <li>&quot;<strong><font face="Courier">POLYHOLE</font></strong>&quot;: defines the index 
	of the vertex where there is a hole in a closed polygon. It will affect the 
	next <strong>cdEnd</strong>. Can be called several times between
  <strong>cdBegin</strong> and <strong>cdEnd</strong> to define holes. The value 
	passed must be a string containing an integer (&quot;%d&quot;). If the value of the 
	attribute passed is NULL, all holes will no longer be considered.&nbsp;When 
	consulted returns the current number of holes (&quot;%d&quot;). It can have a maximum 
	of 500 holes.</li>
</ul>
<ul>
  <li>&quot;<b><font face="Courier">CMD</font></b>&quot;: saves a string directly to the file. Allows adding PostScript commands 
  to the file generated by the CD library. (set only)</li>
</ul>
<ul>
  <li>&quot;<b><font face="Courier">ROTATE</font></b>&quot;:&nbsp; allows the usage of 1 angle 
	and 1 coordinate (x, y), that define a global rotation transformation 
	centered in the specified coordinate. Use 1 real and 2 integer values inside 
	a string (&quot;%g %d %d&quot; = angle x y). Can not be set if a 
	transformation is already set.</li>
</ul>

</body>

</html>