PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Safe / generated / ps.php

ps.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Safe/generated/ps.php

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