PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / trunk
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress vtrunk
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated / ps.php
wp-user-avatar / third-party / vendor / thecodingmachine / safe / generated Last commit date
Exceptions 6 days ago apache.php 6 days ago apcu.php 6 days ago array.php 6 days ago bzip2.php 6 days ago calendar.php 6 days ago classobj.php 6 days ago com.php 6 days ago cubrid.php 6 days ago curl.php 6 days ago datetime.php 6 days ago dir.php 6 days ago eio.php 6 days ago errorfunc.php 6 days ago exec.php 6 days ago fileinfo.php 6 days ago filesystem.php 6 days ago filter.php 6 days ago fpm.php 6 days ago ftp.php 6 days ago funchand.php 6 days ago functionsList.php 6 days ago gmp.php 6 days ago gnupg.php 6 days ago hash.php 6 days ago ibase.php 6 days ago ibmDb2.php 6 days ago iconv.php 6 days ago image.php 6 days ago imap.php 6 days ago info.php 6 days ago ingres-ii.php 6 days ago inotify.php 6 days ago json.php 6 days ago ldap.php 6 days ago libxml.php 6 days ago lzf.php 6 days ago mailparse.php 6 days ago mbstring.php 6 days ago misc.php 6 days ago msql.php 6 days ago mysql.php 6 days ago mysqli.php 6 days ago mysqlndMs.php 6 days ago mysqlndQc.php 6 days ago network.php 6 days ago oci8.php 6 days ago opcache.php 6 days ago openssl.php 6 days ago outcontrol.php 6 days ago password.php 6 days ago pcntl.php 6 days ago pcre.php 6 days ago pdf.php 6 days ago pgsql.php 6 days ago posix.php 6 days ago ps.php 6 days ago pspell.php 6 days ago readline.php 6 days ago rpminfo.php 6 days ago rrd.php 6 days ago sem.php 6 days ago session.php 6 days ago shmop.php 6 days ago simplexml.php 6 days ago sockets.php 6 days ago sodium.php 6 days ago solr.php 6 days ago spl.php 6 days ago sqlsrv.php 6 days ago ssdeep.php 6 days ago ssh2.php 6 days ago stream.php 6 days ago strings.php 6 days ago swoole.php 6 days ago uodbc.php 6 days ago uopz.php 6 days ago url.php 6 days ago var.php 6 days ago xdiff.php 6 days ago xml.php 6 days ago xmlrpc.php 6 days ago yaml.php 6 days ago yaz.php 6 days ago zip.php 6 days ago zlib.php 6 days ago
ps.php
1684 lines
1 <?php
2
3 namespace ProfilePressVendor\Safe;
4
5 use ProfilePressVendor\Safe\Exceptions\PsException;
6 /**
7 * Places a hyperlink at the given position pointing to a file program
8 * which is being started when clicked on. The hyperlink's source position
9 * is a rectangle
10 * with its lower left corner at (llx, lly) and its upper right corner at
11 * (urx, ury). The rectangle has by default a thin blue border.
12 *
13 * The note will not be visible if the document
14 * is printed or viewed but it will show up if the document is converted to
15 * pdf by either Acrobat Distiller™ or Ghostview.
16 *
17 * @param resource $psdoc Resource identifier of the postscript file
18 * as returned by ps_new.
19 * @param float $llx The x-coordinate of the lower left corner.
20 * @param float $lly The y-coordinate of the lower left corner.
21 * @param float $urx The x-coordinate of the upper right corner.
22 * @param float $ury The y-coordinate of the upper right corner.
23 * @param string $filename The path of the program to be started, when the link is clicked on.
24 * @throws PsException
25 *
26 */
27 function ps_add_launchlink($psdoc, float $llx, float $lly, float $urx, float $ury, string $filename): void
28 {
29 error_clear_last();
30 $result = \ps_add_launchlink($psdoc, $llx, $lly, $urx, $ury, $filename);
31 if ($result === \false) {
32 throw PsException::createFromPhpError();
33 }
34 }
35 /**
36 * Places a hyperlink at the given position pointing to a page in the same
37 * document. Clicking on the link will jump to the given page. The first page
38 * in a document has number 1.
39 *
40 * The hyperlink's source position is a rectangle with its lower left corner at
41 * (llx, lly) and its upper
42 * right corner at (urx, ury).
43 * The rectangle has by default a thin blue border.
44 *
45 * The note will not be visible if the document
46 * is printed or viewed but it will show up if the document is converted to
47 * pdf by either Acrobat Distiller™ or Ghostview.
48 *
49 * @param resource $psdoc Resource identifier of the postscript file
50 * as returned by ps_new.
51 * @param float $llx The x-coordinate of the lower left corner.
52 * @param float $lly The y-coordinate of the lower left corner.
53 * @param float $urx The x-coordinate of the upper right corner.
54 * @param float $ury The y-coordinate of the upper right corner.
55 * @param int $page The number of the page displayed when clicking on the link.
56 * @param string $dest The parameter dest determines how the document
57 * is being viewed. It can be fitpage,
58 * fitwidth, fitheight, or
59 * fitbbox.
60 * @throws PsException
61 *
62 */
63 function ps_add_locallink($psdoc, float $llx, float $lly, float $urx, float $ury, int $page, string $dest): void
64 {
65 error_clear_last();
66 $result = \ps_add_locallink($psdoc, $llx, $lly, $urx, $ury, $page, $dest);
67 if ($result === \false) {
68 throw PsException::createFromPhpError();
69 }
70 }
71 /**
72 * Adds a note at a certain position on the page. Notes are like little
73 * rectangular sheets with text on it, which can be placed anywhere on
74 * a page. They
75 * are shown either folded or unfolded. If folded, the specified icon
76 * is used as a placeholder.
77 *
78 * The note will not be visible if the document
79 * is printed or viewed but it will show up if the document is converted to
80 * pdf by either Acrobat Distiller™ or Ghostview.
81 *
82 * @param resource $psdoc Resource identifier of the postscript file
83 * as returned by ps_new.
84 * @param float $llx The x-coordinate of the lower left corner.
85 * @param float $lly The y-coordinate of the lower left corner.
86 * @param float $urx The x-coordinate of the upper right corner.
87 * @param float $ury The y-coordinate of the upper right corner.
88 * @param string $contents The text of the note.
89 * @param string $title The title of the note as displayed in the header of the note.
90 * @param string $icon The icon shown if the note is folded. This parameter can be set
91 * to comment, insert,
92 * note, paragraph,
93 * newparagraph, key, or
94 * help.
95 * @param int $open If open is unequal to zero the note will
96 * be shown unfolded after opening the document with a pdf viewer.
97 * @throws PsException
98 *
99 */
100 function ps_add_note($psdoc, float $llx, float $lly, float $urx, float $ury, string $contents, string $title, string $icon, int $open): void
101 {
102 error_clear_last();
103 $result = \ps_add_note($psdoc, $llx, $lly, $urx, $ury, $contents, $title, $icon, $open);
104 if ($result === \false) {
105 throw PsException::createFromPhpError();
106 }
107 }
108 /**
109 * Places a hyperlink at the given position pointing to a second pdf document.
110 * Clicking on the link will branch to the document at the given page. The
111 * first page in a document has number 1.
112 *
113 * The hyperlink's source position is a rectangle with its lower left corner at
114 * (llx, lly) and its upper
115 * right corner at (urx, ury).
116 * The rectangle has by default a thin blue border.
117 *
118 * The note will not be visible if the document
119 * is printed or viewed but it will show up if the document is converted to
120 * pdf by either Acrobat Distiller™ or Ghostview.
121 *
122 * @param resource $psdoc Resource identifier of the postscript file
123 * as returned by ps_new.
124 * @param float $llx The x-coordinate of the lower left corner.
125 * @param float $lly The y-coordinate of the lower left corner.
126 * @param float $urx The x-coordinate of the upper right corner.
127 * @param float $ury The y-coordinate of the upper right corner.
128 * @param string $filename The name of the pdf document to be opened when clicking on
129 * this link.
130 * @param int $page The page number of the destination pdf document
131 * @param string $dest The parameter dest determines how the document
132 * is being viewed. It can be fitpage,
133 * fitwidth, fitheight, or
134 * fitbbox.
135 * @throws PsException
136 *
137 */
138 function ps_add_pdflink($psdoc, float $llx, float $lly, float $urx, float $ury, string $filename, int $page, string $dest): void
139 {
140 error_clear_last();
141 $result = \ps_add_pdflink($psdoc, $llx, $lly, $urx, $ury, $filename, $page, $dest);
142 if ($result === \false) {
143 throw PsException::createFromPhpError();
144 }
145 }
146 /**
147 * Places a hyperlink at the given position pointing to a web page. The
148 * hyperlink's source position is a rectangle with its lower left corner at
149 * (llx, lly) and
150 * its upper right corner at (urx,
151 * ury). The rectangle has by default a thin
152 * blue border.
153 *
154 * The note will not be visible if the document
155 * is printed or viewed but it will show up if the document is converted to
156 * pdf by either Acrobat Distiller™ or Ghostview.
157 *
158 * @param resource $psdoc Resource identifier of the postscript file
159 * as returned by ps_new.
160 * @param float $llx The x-coordinate of the lower left corner.
161 * @param float $lly The y-coordinate of the lower left corner.
162 * @param float $urx The x-coordinate of the upper right corner.
163 * @param float $ury The y-coordinate of the upper right corner.
164 * @param string $url The url of the hyperlink to be opened when clicking on
165 * this link, e.g. http://www.php.net.
166 * @throws PsException
167 *
168 */
169 function ps_add_weblink($psdoc, float $llx, float $lly, float $urx, float $ury, string $url): void
170 {
171 error_clear_last();
172 $result = \ps_add_weblink($psdoc, $llx, $lly, $urx, $ury, $url);
173 if ($result === \false) {
174 throw PsException::createFromPhpError();
175 }
176 }
177 /**
178 * Draws a portion of a circle with at middle point at
179 * (x, y). The arc starts at an
180 * angle of alpha and ends at an angle of
181 * beta. It is drawn counterclockwise (use
182 * ps_arcn to draw clockwise). The subpath added
183 * to the current path starts on the arc at angle alpha
184 * and ends on the arc at angle beta.
185 *
186 * @param resource $psdoc Resource identifier of the postscript file
187 * as returned by ps_new.
188 * @param float $x The x-coordinate of the circle's middle point.
189 * @param float $y The y-coordinate of the circle's middle point.
190 * @param float $radius The radius of the circle
191 * @param float $alpha The start angle given in degrees.
192 * @param float $beta The end angle given in degrees.
193 * @throws PsException
194 *
195 */
196 function ps_arc($psdoc, float $x, float $y, float $radius, float $alpha, float $beta): void
197 {
198 error_clear_last();
199 $result = \ps_arc($psdoc, $x, $y, $radius, $alpha, $beta);
200 if ($result === \false) {
201 throw PsException::createFromPhpError();
202 }
203 }
204 /**
205 * Draws a portion of a circle with at middle point at
206 * (x, y). The arc starts at an
207 * angle of alpha and ends at an angle of
208 * beta. It is drawn clockwise (use
209 * ps_arc to draw counterclockwise). The subpath added to
210 * the current path starts on the arc at angle beta and
211 * ends on the arc at angle alpha.
212 *
213 * @param resource $psdoc Resource identifier of the postscript file
214 * as returned by ps_new.
215 * @param float $x The x-coordinate of the circle's middle point.
216 * @param float $y The y-coordinate of the circle's middle point.
217 * @param float $radius The radius of the circle
218 * @param float $alpha The starting angle given in degrees.
219 * @param float $beta The end angle given in degrees.
220 * @throws PsException
221 *
222 */
223 function ps_arcn($psdoc, float $x, float $y, float $radius, float $alpha, float $beta): void
224 {
225 error_clear_last();
226 $result = \ps_arcn($psdoc, $x, $y, $radius, $alpha, $beta);
227 if ($result === \false) {
228 throw PsException::createFromPhpError();
229 }
230 }
231 /**
232 * Starts a new page. Although the parameters width
233 * and height imply a different page size for each
234 * page, this is not possible in PostScript. The first call of
235 * ps_begin_page will set the page size for the whole
236 * document. Consecutive calls will have no effect, except for creating a new
237 * page. The situation is different if you intent to convert the PostScript
238 * document into PDF. This function places pdfmarks into the document which
239 * can set the size for each page indiviually. The resulting PDF document will
240 * have different page sizes.
241 *
242 * Though PostScript does not know different page sizes, pslib places
243 * a bounding box for each page into the document. This size is evaluated
244 * by some PostScript viewers and will have precedence over the BoundingBox
245 * in the Header of the document. This can lead to unexpected results when
246 * you set a BoundingBox whose lower left corner is not (0, 0), because the
247 * bounding box of the page will always have a lower left corner (0, 0)
248 * and overwrites the global setting.
249 *
250 * Each page is encapsulated into save/restore. This means, that most of the
251 * settings made on one page will not be retained on the next page.
252 *
253 * If there is up to the first call of ps_begin_page no
254 * call of ps_findfont, then the header of the PostScript
255 * document will be output and the bounding box will be set to the size of
256 * the first page. The lower left corner of the bounding box is set to (0, 0).
257 * If ps_findfont was called before, then the
258 * header has been output already, and the document will not have a valid
259 * bounding box. In order to prevent this, one should call
260 * ps_set_info to set the info field
261 * BoundingBox and possibly Orientation
262 * before any ps_findfont or
263 * ps_begin_page calls.
264 *
265 * @param resource $psdoc Resource identifier of the postscript file
266 * as returned by ps_new.
267 * @param float $width The width of the page in pixel, e.g. 596 for A4 format.
268 * @param float $height The height of the page in pixel, e.g. 842 for A4 format.
269 * @throws PsException
270 *
271 */
272 function ps_begin_page($psdoc, float $width, float $height): void
273 {
274 error_clear_last();
275 $result = \ps_begin_page($psdoc, $width, $height);
276 if ($result === \false) {
277 throw PsException::createFromPhpError();
278 }
279 }
280 /**
281 * Starts a new pattern. A pattern is like a page containing e.g. a drawing
282 * which can be used for filling areas. It is used like a color by calling
283 * ps_setcolor and setting the color space to
284 * pattern.
285 *
286 * @param resource $psdoc Resource identifier of the postscript file
287 * as returned by ps_new.
288 * @param float $width The width of the pattern in pixel.
289 * @param float $height The height of the pattern in pixel.
290 * @param float $xstep The distance in pixel of placements of the pattern in
291 * horizontal direction.
292 * @param float $ystep The distance in pixel of placements of the pattern in
293 * vertical direction.
294 * @param int $painttype Must be 1 or 2.
295 * @return int The identifier of the pattern.
296 * @throws PsException
297 *
298 */
299 function ps_begin_pattern($psdoc, float $width, float $height, float $xstep, float $ystep, int $painttype): int
300 {
301 error_clear_last();
302 $result = \ps_begin_pattern($psdoc, $width, $height, $xstep, $ystep, $painttype);
303 if ($result === \false) {
304 throw PsException::createFromPhpError();
305 }
306 return $result;
307 }
308 /**
309 * Starts a new template. A template is called a form in the postscript
310 * language. It is created similar to a pattern but used like an image.
311 * Templates are often used for drawings which are placed several times
312 * through out the document, e.g. like a company logo. All drawing functions
313 * may be used within a template. The template will not be drawn until
314 * it is placed by ps_place_image.
315 *
316 * @param resource $psdoc Resource identifier of the postscript file
317 * as returned by ps_new.
318 * @param float $width The width of the template in pixel.
319 * @param float $height The height of the template in pixel.
320 * @return int Returns TRUE on success.
321 * @throws PsException
322 *
323 */
324 function ps_begin_template($psdoc, float $width, float $height): int
325 {
326 error_clear_last();
327 $result = \ps_begin_template($psdoc, $width, $height);
328 if ($result === \false) {
329 throw PsException::createFromPhpError();
330 }
331 return $result;
332 }
333 /**
334 * Draws a circle with its middle point at (x,
335 * y). The circle starts and ends at position
336 * (x+radius,
337 * y). If this function is called outside a path it
338 * will start a new path. If it is called within a path it will add the circle
339 * as a subpath. If the last drawing operation does not end in point
340 * (x+radius,
341 * y) then there will be a gap in the path.
342 *
343 * @param resource $psdoc Resource identifier of the postscript file
344 * as returned by ps_new.
345 * @param float $x The x-coordinate of the circle's middle point.
346 * @param float $y The y-coordinate of the circle's middle point.
347 * @param float $radius The radius of the circle
348 * @throws PsException
349 *
350 */
351 function ps_circle($psdoc, float $x, float $y, float $radius): void
352 {
353 error_clear_last();
354 $result = \ps_circle($psdoc, $x, $y, $radius);
355 if ($result === \false) {
356 throw PsException::createFromPhpError();
357 }
358 }
359 /**
360 * Takes the current path and uses it to define the border of a clipping area.
361 * Everything drawn outside of that area will not be visible.
362 *
363 * @param resource $psdoc Resource identifier of the postscript file
364 * as returned by ps_new.
365 * @throws PsException
366 *
367 */
368 function ps_clip($psdoc): void
369 {
370 error_clear_last();
371 $result = \ps_clip($psdoc);
372 if ($result === \false) {
373 throw PsException::createFromPhpError();
374 }
375 }
376 /**
377 * Closes an image and frees its resources. Once an image is closed
378 * it cannot be used anymore.
379 *
380 * @param resource $psdoc Resource identifier of the postscript file
381 * as returned by ps_new.
382 * @param int $imageid Resource identifier of the image as returned by
383 * ps_open_image or
384 * ps_open_image_file.
385 * @throws PsException
386 *
387 */
388 function ps_close_image($psdoc, int $imageid): void
389 {
390 error_clear_last();
391 $result = \ps_close_image($psdoc, $imageid);
392 if ($result === \false) {
393 throw PsException::createFromPhpError();
394 }
395 }
396 /**
397 * Closes the PostScript document.
398 *
399 * This function writes the trailer of the PostScript document.
400 * It also writes the bookmark tree. ps_close does
401 * not free any resources, which is done by ps_delete.
402 *
403 * This function is also called by ps_delete if it
404 * has not been called before.
405 *
406 * @param resource $psdoc Resource identifier of the postscript file
407 * as returned by ps_new.
408 * @throws PsException
409 *
410 */
411 function ps_close($psdoc): void
412 {
413 error_clear_last();
414 $result = \ps_close($psdoc);
415 if ($result === \false) {
416 throw PsException::createFromPhpError();
417 }
418 }
419 /**
420 * Connects the last point with first point of a path and draws the resulting
421 * closed line.
422 *
423 * @param resource $psdoc Resource identifier of the postscript file
424 * as returned by ps_new.
425 * @throws PsException
426 *
427 */
428 function ps_closepath_stroke($psdoc): void
429 {
430 error_clear_last();
431 $result = \ps_closepath_stroke($psdoc);
432 if ($result === \false) {
433 throw PsException::createFromPhpError();
434 }
435 }
436 /**
437 * Connects the last point with the first point of a path. The resulting
438 * path can be used for stroking, filling, clipping, etc..
439 *
440 * @param resource $psdoc Resource identifier of the postscript file
441 * as returned by ps_new.
442 * @throws PsException
443 *
444 */
445 function ps_closepath($psdoc): void
446 {
447 error_clear_last();
448 $result = \ps_closepath($psdoc);
449 if ($result === \false) {
450 throw PsException::createFromPhpError();
451 }
452 }
453 /**
454 * Output a text one line below the last line. The line spacing is
455 * taken from the value "leading" which must be set with
456 * ps_set_value. The actual position of the
457 * text is determined by the values "textx" and "texty" which can be requested
458 * with ps_get_value
459 *
460 * @param resource $psdoc Resource identifier of the postscript file
461 * as returned by ps_new.
462 * @param string $text The text to output.
463 * @throws PsException
464 *
465 */
466 function ps_continue_text($psdoc, string $text): void
467 {
468 error_clear_last();
469 $result = \ps_continue_text($psdoc, $text);
470 if ($result === \false) {
471 throw PsException::createFromPhpError();
472 }
473 }
474 /**
475 * Add a section of a cubic Bézier curve described by the three given control
476 * points to the current path.
477 *
478 * @param resource $psdoc Resource identifier of the postscript file
479 * as returned by ps_new.
480 * @param float $x1 x-coordinate of first control point.
481 * @param float $y1 y-coordinate of first control point.
482 * @param float $x2 x-coordinate of second control point.
483 * @param float $y2 y-coordinate of second control point.
484 * @param float $x3 x-coordinate of third control point.
485 * @param float $y3 y-coordinate of third control point.
486 * @throws PsException
487 *
488 */
489 function ps_curveto($psdoc, float $x1, float $y1, float $x2, float $y2, float $x3, float $y3): void
490 {
491 error_clear_last();
492 $result = \ps_curveto($psdoc, $x1, $y1, $x2, $y2, $x3, $y3);
493 if ($result === \false) {
494 throw PsException::createFromPhpError();
495 }
496 }
497 /**
498 * Mainly frees memory used by the document. Also closes a file, if it was not
499 * closed before with ps_close. You should in any case
500 * close the file with ps_close before, because
501 * ps_close not just closes the file but also outputs a
502 * trailor containing PostScript comments like the number of pages in the
503 * document and adding the bookmark hierarchy.
504 *
505 * @param resource $psdoc Resource identifier of the postscript file
506 * as returned by ps_new.
507 * @throws PsException
508 *
509 */
510 function ps_delete($psdoc): void
511 {
512 error_clear_last();
513 $result = \ps_delete($psdoc);
514 if ($result === \false) {
515 throw PsException::createFromPhpError();
516 }
517 }
518 /**
519 * Ends a page which was started with ps_begin_page.
520 * Ending a page will leave the current drawing context, which e.g. requires
521 * to reload fonts if they were loading within the page, and to set many
522 * other drawing parameters like the line width, or color..
523 *
524 * @param resource $psdoc Resource identifier of the postscript file
525 * as returned by ps_new.
526 * @throws PsException
527 *
528 */
529 function ps_end_page($psdoc): void
530 {
531 error_clear_last();
532 $result = \ps_end_page($psdoc);
533 if ($result === \false) {
534 throw PsException::createFromPhpError();
535 }
536 }
537 /**
538 * Ends a pattern which was started with ps_begin_pattern.
539 * Once a pattern has been ended, it can be used like a color to fill
540 * areas.
541 *
542 * @param resource $psdoc Resource identifier of the postscript file
543 * as returned by ps_new.
544 * @throws PsException
545 *
546 */
547 function ps_end_pattern($psdoc): void
548 {
549 error_clear_last();
550 $result = \ps_end_pattern($psdoc);
551 if ($result === \false) {
552 throw PsException::createFromPhpError();
553 }
554 }
555 /**
556 * Ends a template which was started with ps_begin_template.
557 * Once a template has been ended, it can be used like an image.
558 *
559 * @param resource $psdoc Resource identifier of the postscript file
560 * as returned by ps_new.
561 * @throws PsException
562 *
563 */
564 function ps_end_template($psdoc): void
565 {
566 error_clear_last();
567 $result = \ps_end_template($psdoc);
568 if ($result === \false) {
569 throw PsException::createFromPhpError();
570 }
571 }
572 /**
573 * Fills and draws the path constructed with previously called drawing
574 * functions like ps_lineto.
575 *
576 * @param resource $psdoc Resource identifier of the postscript file
577 * as returned by ps_new.
578 * @throws PsException
579 *
580 */
581 function ps_fill_stroke($psdoc): void
582 {
583 error_clear_last();
584 $result = \ps_fill_stroke($psdoc);
585 if ($result === \false) {
586 throw PsException::createFromPhpError();
587 }
588 }
589 /**
590 * Fills the path constructed with previously called drawing functions like
591 * ps_lineto.
592 *
593 * @param resource $psdoc Resource identifier of the postscript file
594 * as returned by ps_new.
595 * @throws PsException
596 *
597 */
598 function ps_fill($psdoc): void
599 {
600 error_clear_last();
601 $result = \ps_fill($psdoc);
602 if ($result === \false) {
603 throw PsException::createFromPhpError();
604 }
605 }
606 /**
607 * Gets several parameters which were directly set by
608 * ps_set_parameter or indirectly by one of the other
609 * functions. Parameters are by definition string
610 * values. This function cannot be used to retrieve resources which were also
611 * set by ps_set_parameter.
612 *
613 * The parameter name can have the following values.
614 *
615 *
616 *
617 * fontname
618 *
619 *
620 * The name of the currently active font or the font whose
621 * identifier is passed in parameter modifier.
622 *
623 *
624 *
625 *
626 * fontencoding
627 *
628 *
629 * The encoding of the currently active font.
630 *
631 *
632 *
633 *
634 * dottedversion
635 *
636 *
637 * The version of the underlying pslib library in the format
638 * &lt;major&gt;.&lt;minor&gt;.&lt;subminor&gt;
639 *
640 *
641 *
642 *
643 * scope
644 *
645 *
646 * The current drawing scope. Can be object, document, null, page,
647 * pattern, path, template, prolog, font, glyph.
648 *
649 *
650 *
651 *
652 * ligaturedisolvechar
653 *
654 *
655 * The character which dissolves a ligature. If your are using a font
656 * which contains the ligature `ff' and `|' is the char to dissolve the
657 * ligature, then `f|f' will result in two `f' instead of the ligature `ff'.
658 *
659 *
660 *
661 *
662 * imageencoding
663 *
664 *
665 * The encoding used for encoding images. Can be either
666 * hex or 85. hex encoding
667 * uses two bytes in the postscript file each byte in the image.
668 * 85 stand for Ascii85 encoding.
669 *
670 *
671 *
672 *
673 * linenumbermode
674 *
675 *
676 * Set to paragraph if lines are numbered
677 * within a paragraph or box if they are
678 * numbered within the surrounding box.
679 *
680 *
681 *
682 *
683 * linebreak
684 *
685 *
686 * Only used if text is output with ps_show_boxed.
687 * If set to TRUE a carriage return will add a line
688 * break.
689 *
690 *
691 *
692 *
693 * parbreak
694 *
695 *
696 * Only used if text is output with ps_show_boxed.
697 * If set to TRUE a carriage return will start
698 * a new paragraph.
699 *
700 *
701 *
702 *
703 * hyphenation
704 *
705 *
706 * Only used if text is output with ps_show_boxed.
707 * If set to TRUE the paragraph will be hyphenated
708 * if a hypen dictionary is set and exists.
709 *
710 *
711 *
712 *
713 * hyphendict
714 *
715 *
716 * Filename of the dictionary used for hyphenation pattern.
717 *
718 *
719 *
720 *
721 *
722 * @param resource $psdoc Resource identifier of the postscript file
723 * as returned by ps_new.
724 * @param string $name Name of the parameter.
725 * @param float $modifier An identifier needed if a parameter of a resource is requested,
726 * e.g. the size of an image. In such a case the resource id is
727 * passed.
728 * @return string Returns the value of the parameter.
729 * @throws PsException
730 *
731 */
732 function ps_get_parameter($psdoc, string $name, float $modifier = null): string
733 {
734 error_clear_last();
735 if ($modifier !== null) {
736 $result = \ps_get_parameter($psdoc, $name, $modifier);
737 } else {
738 $result = \ps_get_parameter($psdoc, $name);
739 }
740 if ($result === \false) {
741 throw PsException::createFromPhpError();
742 }
743 return $result;
744 }
745 /**
746 * Hyphenates the passed word. ps_hyphenate evaluates the
747 * value hyphenminchars (set by ps_set_value) and
748 * the parameter hyphendict (set by ps_set_parameter).
749 * hyphendict must be set before calling this function.
750 *
751 * This function requires the locale category LC_CTYPE to be set properly.
752 * This is done when the extension is initialized by using the environment
753 * variables. On Unix systems read the man page of locale for more information.
754 *
755 * @param resource $psdoc Resource identifier of the postscript file
756 * as returned by ps_new.
757 * @param string $text text should not contain any non alpha
758 * characters. Possible positions for breaks are returned in an array of
759 * interger numbers. Each number is the position of the char in
760 * text after which a hyphenation can take place.
761 * @return array An array of integers indicating the position of possible breaks in
762 * the text.
763 * @throws PsException
764 *
765 */
766 function ps_hyphenate($psdoc, string $text): array
767 {
768 error_clear_last();
769 $result = \ps_hyphenate($psdoc, $text);
770 if ($result === \false) {
771 throw PsException::createFromPhpError();
772 }
773 return $result;
774 }
775 /**
776 * This function is
777 * currently not documented; only its argument list is available.
778 *
779 *
780 * @param resource $psdoc Resource identifier of the postscript file
781 * as returned by ps_new.
782 * @param string $file
783 * @throws PsException
784 *
785 */
786 function ps_include_file($psdoc, string $file): void
787 {
788 error_clear_last();
789 $result = \ps_include_file($psdoc, $file);
790 if ($result === \false) {
791 throw PsException::createFromPhpError();
792 }
793 }
794 /**
795 * Adds a straight line from the current point to the given coordinates to the
796 * current path. Use ps_moveto to set the starting point
797 * of the line.
798 *
799 * @param resource $psdoc Resource identifier of the postscript file
800 * as returned by ps_new.
801 * @param float $x x-coordinate of the end point of the line.
802 * @param float $y y-coordinate of the end point of the line.
803 * @throws PsException
804 *
805 */
806 function ps_lineto($psdoc, float $x, float $y): void
807 {
808 error_clear_last();
809 $result = \ps_lineto($psdoc, $x, $y);
810 if ($result === \false) {
811 throw PsException::createFromPhpError();
812 }
813 }
814 /**
815 * Sets the current point to new coordinates. If this is the first call of
816 * ps_moveto after a previous path has been ended then it
817 * will start a new path. If this function is called in the middle of a path
818 * it will just set the current point and start a subpath.
819 *
820 * @param resource $psdoc Resource identifier of the postscript file
821 * as returned by ps_new.
822 * @param float $x x-coordinate of the point to move to.
823 * @param float $y y-coordinate of the point to move to.
824 * @throws PsException
825 *
826 */
827 function ps_moveto($psdoc, float $x, float $y): void
828 {
829 error_clear_last();
830 $result = \ps_moveto($psdoc, $x, $y);
831 if ($result === \false) {
832 throw PsException::createFromPhpError();
833 }
834 }
835 /**
836 * Creates a new document instance. It does not create the file on disk or in
837 * memory, it just sets up everything. ps_new is usually
838 * followed by a call of ps_open_file to actually create
839 * the postscript document.
840 *
841 * @return resource Resource of PostScript document. The return value
842 * is passed to all other functions as the first argument.
843 * @throws PsException
844 *
845 */
846 function ps_new()
847 {
848 error_clear_last();
849 $result = \ps_new();
850 if ($result === \false) {
851 throw PsException::createFromPhpError();
852 }
853 return $result;
854 }
855 /**
856 * Creates a new file on disk and writes the PostScript document into it. The
857 * file will be closed when ps_close is called.
858 *
859 * @param resource $psdoc Resource identifier of the postscript file
860 * as returned by ps_new.
861 * @param string $filename The name of the postscript file.
862 * If filename is not passed the document will be
863 * created in memory and all output will go straight to the browser.
864 * @throws PsException
865 *
866 */
867 function ps_open_file($psdoc, string $filename = null): void
868 {
869 error_clear_last();
870 if ($filename !== null) {
871 $result = \ps_open_file($psdoc, $filename);
872 } else {
873 $result = \ps_open_file($psdoc);
874 }
875 if ($result === \false) {
876 throw PsException::createFromPhpError();
877 }
878 }
879 /**
880 * Places a formerly loaded image on the page. The image can be scaled.
881 * If the image shall be rotated as well, you will have to rotate the
882 * coordinate system before with ps_rotate.
883 *
884 * @param resource $psdoc Resource identifier of the postscript file
885 * as returned by ps_new.
886 * @param int $imageid The resource identifier of the image as returned by
887 * ps_open_image or
888 * ps_open_image_file.
889 * @param float $x x-coordinate of the lower left corner of the image.
890 * @param float $y y-coordinate of the lower left corner of the image.
891 * @param float $scale The scaling factor for the image. A scale of 1.0 will result
892 * in a resolution of 72 dpi, because each pixel is equivalent to
893 * 1 point.
894 * @throws PsException
895 *
896 */
897 function ps_place_image($psdoc, int $imageid, float $x, float $y, float $scale): void
898 {
899 error_clear_last();
900 $result = \ps_place_image($psdoc, $imageid, $x, $y, $scale);
901 if ($result === \false) {
902 throw PsException::createFromPhpError();
903 }
904 }
905 /**
906 * Draws a rectangle with its lower left corner at (x,
907 * y). The rectangle starts and ends in its lower left
908 * corner. If this function is called outside a path it will start a new path.
909 * If it is called within a path it will add the rectangle as a subpath. If
910 * the last drawing operation does not end in the lower left corner then there
911 * will be a gap in the path.
912 *
913 * @param resource $psdoc Resource identifier of the postscript file
914 * as returned by ps_new.
915 * @param float $x x-coordinate of the lower left corner of the rectangle.
916 * @param float $y y-coordinate of the lower left corner of the rectangle.
917 * @param float $width The width of the image.
918 * @param float $height The height of the image.
919 * @throws PsException
920 *
921 */
922 function ps_rect($psdoc, float $x, float $y, float $width, float $height): void
923 {
924 error_clear_last();
925 $result = \ps_rect($psdoc, $x, $y, $width, $height);
926 if ($result === \false) {
927 throw PsException::createFromPhpError();
928 }
929 }
930 /**
931 * Restores a previously saved graphics context. Any call of
932 * ps_save must be accompanied by a call to
933 * ps_restore. All coordinate transformations, line
934 * style settings, color settings, etc. are being restored to the state
935 * before the call of ps_save.
936 *
937 * @param resource $psdoc Resource identifier of the postscript file
938 * as returned by ps_new.
939 * @throws PsException
940 *
941 */
942 function ps_restore($psdoc): void
943 {
944 error_clear_last();
945 $result = \ps_restore($psdoc);
946 if ($result === \false) {
947 throw PsException::createFromPhpError();
948 }
949 }
950 /**
951 * Sets the rotation of the coordinate system.
952 *
953 * @param resource $psdoc Resource identifier of the postscript file
954 * as returned by ps_new.
955 * @param float $rot Angle of rotation in degree.
956 * @throws PsException
957 *
958 */
959 function ps_rotate($psdoc, float $rot): void
960 {
961 error_clear_last();
962 $result = \ps_rotate($psdoc, $rot);
963 if ($result === \false) {
964 throw PsException::createFromPhpError();
965 }
966 }
967 /**
968 * Saves the current graphics context, containing colors, translation and
969 * rotation settings and some more. A saved context can be restored with
970 * ps_restore.
971 *
972 * @param resource $psdoc Resource identifier of the postscript file
973 * as returned by ps_new.
974 * @throws PsException
975 *
976 */
977 function ps_save($psdoc): void
978 {
979 error_clear_last();
980 $result = \ps_save($psdoc);
981 if ($result === \false) {
982 throw PsException::createFromPhpError();
983 }
984 }
985 /**
986 * Sets horizontal and vertical scaling of the coordinate system.
987 *
988 * @param resource $psdoc Resource identifier of the postscript file
989 * as returned by ps_new.
990 * @param float $x Scaling factor in horizontal direction.
991 * @param float $y Scaling factor in vertical direction.
992 * @throws PsException
993 *
994 */
995 function ps_scale($psdoc, float $x, float $y): void
996 {
997 error_clear_last();
998 $result = \ps_scale($psdoc, $x, $y);
999 if ($result === \false) {
1000 throw PsException::createFromPhpError();
1001 }
1002 }
1003 /**
1004 * Links added with one of the functions ps_add_weblink,
1005 * ps_add_pdflink, etc. will be displayed with a
1006 * surounded rectangle when the postscript document is converted to
1007 * pdf and viewed in a pdf viewer. This rectangle is not visible in
1008 * the postscript document.
1009 * This function sets the color of the rectangle's border line.
1010 *
1011 * @param resource $psdoc Resource identifier of the postscript file
1012 * as returned by ps_new.
1013 * @param float $red The red component of the border color.
1014 * @param float $green The green component of the border color.
1015 * @param float $blue The blue component of the border color.
1016 * @throws PsException
1017 *
1018 */
1019 function ps_set_border_color($psdoc, float $red, float $green, float $blue): void
1020 {
1021 error_clear_last();
1022 $result = \ps_set_border_color($psdoc, $red, $green, $blue);
1023 if ($result === \false) {
1024 throw PsException::createFromPhpError();
1025 }
1026 }
1027 /**
1028 * Links added with one of the functions ps_add_weblink,
1029 * ps_add_pdflink, etc. will be displayed with a
1030 * surounded rectangle when the postscript document is converted to
1031 * pdf and viewed in a pdf viewer. This rectangle is not visible in
1032 * the postscript document.
1033 * This function sets the length of the black and white portion of a
1034 * dashed border line.
1035 *
1036 * @param resource $psdoc Resource identifier of the postscript file
1037 * as returned by ps_new.
1038 * @param float $black The length of the dash.
1039 * @param float $white The length of the gap between dashes.
1040 * @throws PsException
1041 *
1042 */
1043 function ps_set_border_dash($psdoc, float $black, float $white): void
1044 {
1045 error_clear_last();
1046 $result = \ps_set_border_dash($psdoc, $black, $white);
1047 if ($result === \false) {
1048 throw PsException::createFromPhpError();
1049 }
1050 }
1051 /**
1052 * Links added with one of the functions ps_add_weblink,
1053 * ps_add_pdflink, etc. will be displayed with a
1054 * surounded rectangle when the postscript document is converted to
1055 * pdf and viewed in a pdf viewer. This rectangle is not visible in
1056 * the postscript document.
1057 * This function sets the appearance and width of the border line.
1058 *
1059 * @param resource $psdoc Resource identifier of the postscript file
1060 * as returned by ps_new.
1061 * @param string $style style can be solid or
1062 * dashed.
1063 * @param float $width The line width of the border.
1064 * @throws PsException
1065 *
1066 */
1067 function ps_set_border_style($psdoc, string $style, float $width): void
1068 {
1069 error_clear_last();
1070 $result = \ps_set_border_style($psdoc, $style, $width);
1071 if ($result === \false) {
1072 throw PsException::createFromPhpError();
1073 }
1074 }
1075 /**
1076 * Sets certain information fields of the document. This fields will be shown
1077 * as a comment in the header of the PostScript file. If the document is
1078 * converted to pdf this fields will also be used for the document
1079 * information.
1080 *
1081 * The BoundingBox is usually set to the value given to the
1082 * first page. This only works if ps_findfont has not
1083 * been called before. In such cases the BoundingBox would be left unset
1084 * unless you set it explicitly with this function.
1085 *
1086 * This function will have no effect anymore when the header of the postscript
1087 * file has been already written. It must be called before the first page
1088 * or the first call of ps_findfont.
1089 *
1090 * @param resource $p Resource identifier of the postscript file
1091 * as returned by ps_new.
1092 * @param string $key The name of the information field to set. The values which can be
1093 * set are Keywords, Subject,
1094 * Title, Creator,
1095 * Author, BoundingBox, and
1096 * Orientation. Be aware that some of them has a
1097 * meaning to PostScript viewers.
1098 * @param string $val The value of the information field. The field
1099 * Orientation can be set to either
1100 * Portrait or Landscape. The
1101 * BoundingBox is a string consisting of four numbers.
1102 * The first two numbers are the coordinates of the lower left corner of
1103 * the page. The last two numbers are the coordinates of the upper
1104 * right corner.
1105 *
1106 * Up to version 0.2.6 of pslib, the BoundingBox and Orientation
1107 * will be overwritten by ps_begin_page,
1108 * unless ps_findfont has been called before.
1109 * @throws PsException
1110 *
1111 */
1112 function ps_set_info($p, string $key, string $val): void
1113 {
1114 error_clear_last();
1115 $result = \ps_set_info($p, $key, $val);
1116 if ($result === \false) {
1117 throw PsException::createFromPhpError();
1118 }
1119 }
1120 /**
1121 * Sets several parameters which are used by many functions. Parameters are by
1122 * definition string values.
1123 *
1124 * @param resource $psdoc Resource identifier of the postscript file
1125 * as returned by ps_new.
1126 * @param string $name For a list of possible names see ps_get_parameter.
1127 * @param string $value The value of the parameter.
1128 * @throws PsException
1129 *
1130 */
1131 function ps_set_parameter($psdoc, string $name, string $value): void
1132 {
1133 error_clear_last();
1134 $result = \ps_set_parameter($psdoc, $name, $value);
1135 if ($result === \false) {
1136 throw PsException::createFromPhpError();
1137 }
1138 }
1139 /**
1140 * Set the position for the next text output. You may alternatively set the x
1141 * and y value separately by calling ps_set_value and
1142 * choosing textx respectively texty as
1143 * the value name.
1144 *
1145 * If you want to output text at a certain position it is more convenient
1146 * to use ps_show_xy instead of setting the text position
1147 * and calling ps_show.
1148 *
1149 * @param resource $psdoc Resource identifier of the postscript file
1150 * as returned by ps_new.
1151 * @param float $x x-coordinate of the new text position.
1152 * @param float $y y-coordinate of the new text position.
1153 * @throws PsException
1154 *
1155 */
1156 function ps_set_text_pos($psdoc, float $x, float $y): void
1157 {
1158 error_clear_last();
1159 $result = \ps_set_text_pos($psdoc, $x, $y);
1160 if ($result === \false) {
1161 throw PsException::createFromPhpError();
1162 }
1163 }
1164 /**
1165 * Sets several values which are used by many functions. Parameters are by
1166 * definition float values.
1167 *
1168 * @param resource $psdoc Resource identifier of the postscript file
1169 * as returned by ps_new.
1170 * @param string $name The name can be one of the following:
1171 *
1172 *
1173 * textrendering
1174 *
1175 *
1176 * The way how text is shown.
1177 *
1178 *
1179 *
1180 *
1181 * textx
1182 *
1183 *
1184 * The x coordinate for text output.
1185 *
1186 *
1187 *
1188 *
1189 * texty
1190 *
1191 *
1192 * The y coordinate for text output.
1193 *
1194 *
1195 *
1196 *
1197 * wordspacing
1198 *
1199 *
1200 * The distance between words relative to the width of a space.
1201 *
1202 *
1203 *
1204 *
1205 * leading
1206 *
1207 *
1208 * The distance between lines in pixels.
1209 *
1210 *
1211 *
1212 *
1213 *
1214 * The way how text is shown.
1215 *
1216 * The x coordinate for text output.
1217 *
1218 * The y coordinate for text output.
1219 *
1220 * The distance between words relative to the width of a space.
1221 *
1222 * The distance between lines in pixels.
1223 * @param float $value The way how text is shown.
1224 * @throws PsException
1225 *
1226 */
1227 function ps_set_value($psdoc, string $name, float $value): void
1228 {
1229 error_clear_last();
1230 $result = \ps_set_value($psdoc, $name, $value);
1231 if ($result === \false) {
1232 throw PsException::createFromPhpError();
1233 }
1234 }
1235 /**
1236 * Sets the color for drawing, filling, or both.
1237 *
1238 * @param resource $psdoc Resource identifier of the postscript file
1239 * as returned by ps_new.
1240 * @param string $type The parameter type can be
1241 * both, fill, or
1242 * fillstroke.
1243 * @param string $colorspace The colorspace should be one of gray,
1244 * rgb, cmyk,
1245 * spot, pattern. Depending on the
1246 * colorspace either only the first, the first three or all parameters
1247 * will be used.
1248 * @param float $c1 Depending on the colorspace this is either the red component (rgb),
1249 * the cyan component (cmyk), the gray value (gray), the identifier of
1250 * the spot color or the identifier of the pattern.
1251 * @param float $c2 Depending on the colorspace this is either the green component (rgb),
1252 * the magenta component (cmyk).
1253 * @param float $c3 Depending on the colorspace this is either the blue component (rgb),
1254 * the yellow component (cmyk).
1255 * @param float $c4 This must only be set in cmyk colorspace and specifies the black
1256 * component.
1257 * @throws PsException
1258 *
1259 */
1260 function ps_setcolor($psdoc, string $type, string $colorspace, float $c1, float $c2, float $c3, float $c4): void
1261 {
1262 error_clear_last();
1263 $result = \ps_setcolor($psdoc, $type, $colorspace, $c1, $c2, $c3, $c4);
1264 if ($result === \false) {
1265 throw PsException::createFromPhpError();
1266 }
1267 }
1268 /**
1269 * Sets the length of the black and white portions of a dashed line.
1270 *
1271 * @param resource $psdoc Resource identifier of the postscript file
1272 * as returned by ps_new.
1273 * @param float $on The length of the dash.
1274 * @param float $off The length of the gap between dashes.
1275 * @throws PsException
1276 *
1277 */
1278 function ps_setdash($psdoc, float $on, float $off): void
1279 {
1280 error_clear_last();
1281 $result = \ps_setdash($psdoc, $on, $off);
1282 if ($result === \false) {
1283 throw PsException::createFromPhpError();
1284 }
1285 }
1286 /**
1287 * This function is
1288 * currently not documented; only its argument list is available.
1289 *
1290 *
1291 * @param resource $psdoc Resource identifier of the postscript file
1292 * as returned by ps_new.
1293 * @param float $value The value must be between 0.2 and 1.
1294 * @throws PsException
1295 *
1296 */
1297 function ps_setflat($psdoc, float $value): void
1298 {
1299 error_clear_last();
1300 $result = \ps_setflat($psdoc, $value);
1301 if ($result === \false) {
1302 throw PsException::createFromPhpError();
1303 }
1304 }
1305 /**
1306 * Sets a font, which has to be loaded before with
1307 * ps_findfont. Outputting text without setting a font
1308 * results in an error.
1309 *
1310 * @param resource $psdoc Resource identifier of the postscript file
1311 * as returned by ps_new.
1312 * @param int $fontid The font identifier as returned by ps_findfont.
1313 * @param float $size The size of the font.
1314 * @throws PsException
1315 *
1316 */
1317 function ps_setfont($psdoc, int $fontid, float $size): void
1318 {
1319 error_clear_last();
1320 $result = \ps_setfont($psdoc, $fontid, $size);
1321 if ($result === \false) {
1322 throw PsException::createFromPhpError();
1323 }
1324 }
1325 /**
1326 * Sets the gray value for all following drawing operations.
1327 *
1328 * @param resource $psdoc Resource identifier of the postscript file
1329 * as returned by ps_new.
1330 * @param float $gray The value must be between 0 (white) and 1 (black).
1331 * @throws PsException
1332 *
1333 */
1334 function ps_setgray($psdoc, float $gray): void
1335 {
1336 error_clear_last();
1337 $result = \ps_setgray($psdoc, $gray);
1338 if ($result === \false) {
1339 throw PsException::createFromPhpError();
1340 }
1341 }
1342 /**
1343 * Sets how line ends look like.
1344 *
1345 * @param resource $psdoc Resource identifier of the postscript file
1346 * as returned by ps_new.
1347 * @param int $type The type of line ends. Possible values are
1348 * PS_LINECAP_BUTT,
1349 * PS_LINECAP_ROUND, or
1350 * PS_LINECAP_SQUARED.
1351 * @throws PsException
1352 *
1353 */
1354 function ps_setlinecap($psdoc, int $type): void
1355 {
1356 error_clear_last();
1357 $result = \ps_setlinecap($psdoc, $type);
1358 if ($result === \false) {
1359 throw PsException::createFromPhpError();
1360 }
1361 }
1362 /**
1363 * Sets how lines are joined.
1364 *
1365 * @param resource $psdoc Resource identifier of the postscript file
1366 * as returned by ps_new.
1367 * @param int $type The way lines are joined. Possible values are
1368 * PS_LINEJOIN_MITER,
1369 * PS_LINEJOIN_ROUND, or
1370 * PS_LINEJOIN_BEVEL.
1371 * @throws PsException
1372 *
1373 */
1374 function ps_setlinejoin($psdoc, int $type): void
1375 {
1376 error_clear_last();
1377 $result = \ps_setlinejoin($psdoc, $type);
1378 if ($result === \false) {
1379 throw PsException::createFromPhpError();
1380 }
1381 }
1382 /**
1383 * Sets the line width for all following drawing operations.
1384 *
1385 * @param resource $psdoc Resource identifier of the postscript file
1386 * as returned by ps_new.
1387 * @param float $width The width of lines in points.
1388 * @throws PsException
1389 *
1390 */
1391 function ps_setlinewidth($psdoc, float $width): void
1392 {
1393 error_clear_last();
1394 $result = \ps_setlinewidth($psdoc, $width);
1395 if ($result === \false) {
1396 throw PsException::createFromPhpError();
1397 }
1398 }
1399 /**
1400 * If two lines join in a small angle and the line join is set to
1401 * PS_LINEJOIN_MITER, then
1402 * the resulting spike will be very long. The miter limit is the maximum
1403 * ratio of the miter length (the length of the spike) and the line width.
1404 *
1405 * @param resource $psdoc Resource identifier of the postscript file
1406 * as returned by ps_new.
1407 * @param float $value The maximum ratio between the miter length and the line width. Larger
1408 * values (&gt; 10) will result in very long spikes when two lines meet
1409 * in a small angle. Keep the default unless you know what you are doing.
1410 * @throws PsException
1411 *
1412 */
1413 function ps_setmiterlimit($psdoc, float $value): void
1414 {
1415 error_clear_last();
1416 $result = \ps_setmiterlimit($psdoc, $value);
1417 if ($result === \false) {
1418 throw PsException::createFromPhpError();
1419 }
1420 }
1421 /**
1422 * This function is
1423 * currently not documented; only its argument list is available.
1424 *
1425 *
1426 * @param resource $psdoc Resource identifier of the postscript file
1427 * as returned by ps_new.
1428 * @param int $mode
1429 * @throws PsException
1430 *
1431 */
1432 function ps_setoverprintmode($psdoc, int $mode): void
1433 {
1434 error_clear_last();
1435 $result = \ps_setoverprintmode($psdoc, $mode);
1436 if ($result === \false) {
1437 throw PsException::createFromPhpError();
1438 }
1439 }
1440 /**
1441 * Sets the length of the black and white portions of a dashed line.
1442 * ps_setpolydash is used to set more complicated dash
1443 * patterns.
1444 *
1445 * @param resource $psdoc Resource identifier of the postscript file
1446 * as returned by ps_new.
1447 * @param float $arr arr is a list of length elements alternately for
1448 * the black and white portion.
1449 * @throws PsException
1450 *
1451 */
1452 function ps_setpolydash($psdoc, float $arr): void
1453 {
1454 error_clear_last();
1455 $result = \ps_setpolydash($psdoc, $arr);
1456 if ($result === \false) {
1457 throw PsException::createFromPhpError();
1458 }
1459 }
1460 /**
1461 * Creates a pattern based on a shading, which has to be created before with
1462 * ps_shading. Shading patterns can be used like regular
1463 * patterns.
1464 *
1465 * @param resource $psdoc Resource identifier of the postscript file
1466 * as returned by ps_new.
1467 * @param int $shadingid The identifier of a shading previously created with
1468 * ps_shading.
1469 * @param string $optlist This argument is not currently used.
1470 * @return int The identifier of the pattern.
1471 * @throws PsException
1472 *
1473 */
1474 function ps_shading_pattern($psdoc, int $shadingid, string $optlist): int
1475 {
1476 error_clear_last();
1477 $result = \ps_shading_pattern($psdoc, $shadingid, $optlist);
1478 if ($result === \false) {
1479 throw PsException::createFromPhpError();
1480 }
1481 return $result;
1482 }
1483 /**
1484 * Creates a shading, which can be used by ps_shfill or
1485 * ps_shading_pattern.
1486 *
1487 * The color of the shading can be in any color space except for
1488 * pattern.
1489 *
1490 * @param resource $psdoc Resource identifier of the postscript file
1491 * as returned by ps_new.
1492 * @param string $type The type of shading can be either radial or
1493 * axial. Each shading starts with the current fill
1494 * color and ends with the given color values passed in the parameters
1495 * c1 to c4
1496 * (see ps_setcolor for their meaning).
1497 * @param float $x0 The coordinates x0, y0,
1498 * x1, y1 are the start and
1499 * end point of the shading. If the type of shading is
1500 * radial the two points are the middle points of
1501 * a starting and ending circle.
1502 * @param float $y0 See ps_setcolor for their meaning.
1503 * @param float $x1 If the shading is of type radial the
1504 * optlist must also contain the parameters
1505 * r0 and r1 with the radius of the
1506 * start and end circle.
1507 * @param float $y1
1508 * @param float $c1
1509 * @param float $c2
1510 * @param float $c3
1511 * @param float $c4
1512 * @param string $optlist
1513 * @return int Returns the identifier of the pattern.
1514 * @throws PsException
1515 *
1516 */
1517 function ps_shading($psdoc, string $type, float $x0, float $y0, float $x1, float $y1, float $c1, float $c2, float $c3, float $c4, string $optlist): int
1518 {
1519 error_clear_last();
1520 $result = \ps_shading($psdoc, $type, $x0, $y0, $x1, $y1, $c1, $c2, $c3, $c4, $optlist);
1521 if ($result === \false) {
1522 throw PsException::createFromPhpError();
1523 }
1524 return $result;
1525 }
1526 /**
1527 * Fills an area with a shading, which has to be created before with
1528 * ps_shading. This is an alternative way to creating
1529 * a pattern from a shading ps_shading_pattern and using
1530 * the pattern as the filling color.
1531 *
1532 * @param resource $psdoc Resource identifier of the postscript file
1533 * as returned by ps_new.
1534 * @param int $shadingid The identifier of a shading previously created with
1535 * ps_shading.
1536 * @throws PsException
1537 *
1538 */
1539 function ps_shfill($psdoc, int $shadingid): void
1540 {
1541 error_clear_last();
1542 $result = \ps_shfill($psdoc, $shadingid);
1543 if ($result === \false) {
1544 throw PsException::createFromPhpError();
1545 }
1546 }
1547 /**
1548 * Output a text at the given text position.
1549 *
1550 * @param resource $psdoc Resource identifier of the postscript file
1551 * as returned by ps_new.
1552 * @param string $text The text to be output.
1553 * @param float $x x-coordinate of the lower left corner of the box surrounding the text.
1554 * @param float $y y-coordinate of the lower left corner of the box surrounding the text.
1555 * @throws PsException
1556 *
1557 */
1558 function ps_show_xy($psdoc, string $text, float $x, float $y): void
1559 {
1560 error_clear_last();
1561 $result = \ps_show_xy($psdoc, $text, $x, $y);
1562 if ($result === \false) {
1563 throw PsException::createFromPhpError();
1564 }
1565 }
1566 /**
1567 * This function is
1568 * currently not documented; only its argument list is available.
1569 *
1570 *
1571 * @param resource $psdoc
1572 * @param string $text
1573 * @param int $len
1574 * @param float $xcoor
1575 * @param float $ycoor
1576 * @throws PsException
1577 *
1578 */
1579 function ps_show_xy2($psdoc, string $text, int $len, float $xcoor, float $ycoor): void
1580 {
1581 error_clear_last();
1582 $result = \ps_show_xy2($psdoc, $text, $len, $xcoor, $ycoor);
1583 if ($result === \false) {
1584 throw PsException::createFromPhpError();
1585 }
1586 }
1587 /**
1588 * Output a text at the current text position. The text position can be set
1589 * by storing the x and y coordinates into the values textx
1590 * and texty with the function
1591 * ps_set_value. The function will issue an
1592 * error if a font was not set before with ps_setfont.
1593 *
1594 * ps_show evaluates the following parameters and values
1595 * as set by ps_set_parameter and
1596 * ps_set_value.
1597 *
1598 * @param resource $psdoc Resource identifier of the postscript file
1599 * as returned by ps_new.
1600 * @param string $text The text to be output.
1601 * @throws PsException
1602 *
1603 */
1604 function ps_show($psdoc, string $text): void
1605 {
1606 error_clear_last();
1607 $result = \ps_show($psdoc, $text);
1608 if ($result === \false) {
1609 throw PsException::createFromPhpError();
1610 }
1611 }
1612 /**
1613 * Output text at the current position. Do not print more than len characters.
1614 *
1615 * @param resource $psdoc Resource identifier of the postscript file
1616 * as returned by ps_new.
1617 * @param string $text The text to be output.
1618 * @param int $len The maximum number of characters to print.
1619 * @throws PsException
1620 *
1621 */
1622 function ps_show2($psdoc, string $text, int $len): void
1623 {
1624 error_clear_last();
1625 $result = \ps_show2($psdoc, $text, $len);
1626 if ($result === \false) {
1627 throw PsException::createFromPhpError();
1628 }
1629 }
1630 /**
1631 * Draws the path constructed with previously called drawing functions like
1632 * ps_lineto.
1633 *
1634 * @param resource $psdoc Resource identifier of the postscript file
1635 * as returned by ps_new.
1636 * @throws PsException
1637 *
1638 */
1639 function ps_stroke($psdoc): void
1640 {
1641 error_clear_last();
1642 $result = \ps_stroke($psdoc);
1643 if ($result === \false) {
1644 throw PsException::createFromPhpError();
1645 }
1646 }
1647 /**
1648 * Output the glyph at position ord in the font
1649 * encoding vector of the current font. The font encoding for a font can be
1650 * set when loading the font with ps_findfont.
1651 *
1652 * @param resource $psdoc Resource identifier of the postscript file
1653 * as returned by ps_new.
1654 * @param int $ord The position of the glyph in the font encoding vector.
1655 * @throws PsException
1656 *
1657 */
1658 function ps_symbol($psdoc, int $ord): void
1659 {
1660 error_clear_last();
1661 $result = \ps_symbol($psdoc, $ord);
1662 if ($result === \false) {
1663 throw PsException::createFromPhpError();
1664 }
1665 }
1666 /**
1667 * Sets a new initial point of the coordinate system.
1668 *
1669 * @param resource $psdoc Resource identifier of the postscript file
1670 * as returned by ps_new.
1671 * @param float $x x-coordinate of the origin of the translated coordinate system.
1672 * @param float $y y-coordinate of the origin of the translated coordinate system.
1673 * @throws PsException
1674 *
1675 */
1676 function ps_translate($psdoc, float $x, float $y): void
1677 {
1678 error_clear_last();
1679 $result = \ps_translate($psdoc, $x, $y);
1680 if ($result === \false) {
1681 throw PsException::createFromPhpError();
1682 }
1683 }
1684