| 1 |
<?php |
| 2 |
|
| 3 |
namespace Safe; |
| 4 |
|
| 5 |
use 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 |
* <major>.<minor>.<subminor> |
| 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 $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 |
* @return string Returns the value of the parameter. |
| 778 |
* @throws PsException |
| 779 |
* |
| 780 |
*/ |
| 781 |
function ps_get_parameter($psdoc, string $name, float $modifier = null): string |
| 782 |
{ |
| 783 |
error_clear_last(); |
| 784 |
if ($modifier !== null) { |
| 785 |
$result = \ps_get_parameter($psdoc, $name, $modifier); |
| 786 |
} else { |
| 787 |
$result = \ps_get_parameter($psdoc, $name); |
| 788 |
} |
| 789 |
if ($result === false) { |
| 790 |
throw PsException::createFromPhpError(); |
| 791 |
} |
| 792 |
return $result; |
| 793 |
} |
| 794 |
|
| 795 |
|
| 796 |
/** |
| 797 |
* Hyphenates the passed word. ps_hyphenate evaluates the |
| 798 |
* value hyphenminchars (set by ps_set_value) and |
| 799 |
* the parameter hyphendict (set by ps_set_parameter). |
| 800 |
* hyphendict must be set before calling this function. |
| 801 |
* |
| 802 |
* This function requires the locale category LC_CTYPE to be set properly. |
| 803 |
* This is done when the extension is initialized by using the environment |
| 804 |
* variables. On Unix systems read the man page of locale for more information. |
| 805 |
* |
| 806 |
* @param resource $psdoc Resource identifier of the postscript file |
| 807 |
* as returned by ps_new. |
| 808 |
* @param string $text text should not contain any non alpha |
| 809 |
* characters. Possible positions for breaks are returned in an array of |
| 810 |
* interger numbers. Each number is the position of the char in |
| 811 |
* text after which a hyphenation can take place. |
| 812 |
* @return array An array of integers indicating the position of possible breaks in |
| 813 |
* the text. |
| 814 |
* @throws PsException |
| 815 |
* |
| 816 |
*/ |
| 817 |
function ps_hyphenate($psdoc, string $text): array |
| 818 |
{ |
| 819 |
error_clear_last(); |
| 820 |
$result = \ps_hyphenate($psdoc, $text); |
| 821 |
if ($result === false) { |
| 822 |
throw PsException::createFromPhpError(); |
| 823 |
} |
| 824 |
return $result; |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
/** |
| 829 |
* This function is |
| 830 |
* currently not documented; only its argument list is available. |
| 831 |
* |
| 832 |
* |
| 833 |
* @param resource $psdoc Resource identifier of the postscript file |
| 834 |
* as returned by ps_new. |
| 835 |
* @param string $file |
| 836 |
* @throws PsException |
| 837 |
* |
| 838 |
*/ |
| 839 |
function ps_include_file($psdoc, string $file): void |
| 840 |
{ |
| 841 |
error_clear_last(); |
| 842 |
$result = \ps_include_file($psdoc, $file); |
| 843 |
if ($result === false) { |
| 844 |
throw PsException::createFromPhpError(); |
| 845 |
} |
| 846 |
} |
| 847 |
|
| 848 |
|
| 849 |
/** |
| 850 |
* Adds a straight line from the current point to the given coordinates to the |
| 851 |
* current path. Use ps_moveto to set the starting point |
| 852 |
* of the line. |
| 853 |
* |
| 854 |
* @param resource $psdoc Resource identifier of the postscript file |
| 855 |
* as returned by ps_new. |
| 856 |
* @param float $x x-coordinate of the end point of the line. |
| 857 |
* @param float $y y-coordinate of the end point of the line. |
| 858 |
* @throws PsException |
| 859 |
* |
| 860 |
*/ |
| 861 |
function ps_lineto($psdoc, float $x, float $y): void |
| 862 |
{ |
| 863 |
error_clear_last(); |
| 864 |
$result = \ps_lineto($psdoc, $x, $y); |
| 865 |
if ($result === false) { |
| 866 |
throw PsException::createFromPhpError(); |
| 867 |
} |
| 868 |
} |
| 869 |
|
| 870 |
|
| 871 |
/** |
| 872 |
* Sets the current point to new coordinates. If this is the first call of |
| 873 |
* ps_moveto after a previous path has been ended then it |
| 874 |
* will start a new path. If this function is called in the middle of a path |
| 875 |
* it will just set the current point and start a subpath. |
| 876 |
* |
| 877 |
* @param resource $psdoc Resource identifier of the postscript file |
| 878 |
* as returned by ps_new. |
| 879 |
* @param float $x x-coordinate of the point to move to. |
| 880 |
* @param float $y y-coordinate of the point to move to. |
| 881 |
* @throws PsException |
| 882 |
* |
| 883 |
*/ |
| 884 |
function ps_moveto($psdoc, float $x, float $y): void |
| 885 |
{ |
| 886 |
error_clear_last(); |
| 887 |
$result = \ps_moveto($psdoc, $x, $y); |
| 888 |
if ($result === false) { |
| 889 |
throw PsException::createFromPhpError(); |
| 890 |
} |
| 891 |
} |
| 892 |
|
| 893 |
|
| 894 |
/** |
| 895 |
* Creates a new document instance. It does not create the file on disk or in |
| 896 |
* memory, it just sets up everything. ps_new is usually |
| 897 |
* followed by a call of ps_open_file to actually create |
| 898 |
* the postscript document. |
| 899 |
* |
| 900 |
* @return resource Resource of PostScript document. The return value |
| 901 |
* is passed to all other functions as the first argument. |
| 902 |
* @throws PsException |
| 903 |
* |
| 904 |
*/ |
| 905 |
function ps_new() |
| 906 |
{ |
| 907 |
error_clear_last(); |
| 908 |
$result = \ps_new(); |
| 909 |
if ($result === false) { |
| 910 |
throw PsException::createFromPhpError(); |
| 911 |
} |
| 912 |
return $result; |
| 913 |
} |
| 914 |
|
| 915 |
|
| 916 |
/** |
| 917 |
* Creates a new file on disk and writes the PostScript document into it. The |
| 918 |
* file will be closed when ps_close is called. |
| 919 |
* |
| 920 |
* @param resource $psdoc Resource identifier of the postscript file |
| 921 |
* as returned by ps_new. |
| 922 |
* @param string $filename The name of the postscript file. |
| 923 |
* If filename is not passed the document will be |
| 924 |
* created in memory and all output will go straight to the browser. |
| 925 |
* @throws PsException |
| 926 |
* |
| 927 |
*/ |
| 928 |
function ps_open_file($psdoc, string $filename = null): void |
| 929 |
{ |
| 930 |
error_clear_last(); |
| 931 |
if ($filename !== null) { |
| 932 |
$result = \ps_open_file($psdoc, $filename); |
| 933 |
} else { |
| 934 |
$result = \ps_open_file($psdoc); |
| 935 |
} |
| 936 |
if ($result === false) { |
| 937 |
throw PsException::createFromPhpError(); |
| 938 |
} |
| 939 |
} |
| 940 |
|
| 941 |
|
| 942 |
/** |
| 943 |
* Places a formerly loaded image on the page. The image can be scaled. |
| 944 |
* If the image shall be rotated as well, you will have to rotate the |
| 945 |
* coordinate system before with ps_rotate. |
| 946 |
* |
| 947 |
* @param resource $psdoc Resource identifier of the postscript file |
| 948 |
* as returned by ps_new. |
| 949 |
* @param int $imageid The resource identifier of the image as returned by |
| 950 |
* ps_open_image or |
| 951 |
* ps_open_image_file. |
| 952 |
* @param float $x x-coordinate of the lower left corner of the image. |
| 953 |
* @param float $y y-coordinate of the lower left corner of the image. |
| 954 |
* @param float $scale The scaling factor for the image. A scale of 1.0 will result |
| 955 |
* in a resolution of 72 dpi, because each pixel is equivalent to |
| 956 |
* 1 point. |
| 957 |
* @throws PsException |
| 958 |
* |
| 959 |
*/ |
| 960 |
function ps_place_image($psdoc, int $imageid, float $x, float $y, float $scale): void |
| 961 |
{ |
| 962 |
error_clear_last(); |
| 963 |
$result = \ps_place_image($psdoc, $imageid, $x, $y, $scale); |
| 964 |
if ($result === false) { |
| 965 |
throw PsException::createFromPhpError(); |
| 966 |
} |
| 967 |
} |
| 968 |
|
| 969 |
|
| 970 |
/** |
| 971 |
* Draws a rectangle with its lower left corner at (x, |
| 972 |
* y). The rectangle starts and ends in its lower left |
| 973 |
* corner. If this function is called outside a path it will start a new path. |
| 974 |
* If it is called within a path it will add the rectangle as a subpath. If |
| 975 |
* the last drawing operation does not end in the lower left corner then there |
| 976 |
* will be a gap in the path. |
| 977 |
* |
| 978 |
* @param resource $psdoc Resource identifier of the postscript file |
| 979 |
* as returned by ps_new. |
| 980 |
* @param float $x x-coordinate of the lower left corner of the rectangle. |
| 981 |
* @param float $y y-coordinate of the lower left corner of the rectangle. |
| 982 |
* @param float $width The width of the image. |
| 983 |
* @param float $height The height of the image. |
| 984 |
* @throws PsException |
| 985 |
* |
| 986 |
*/ |
| 987 |
function ps_rect($psdoc, float $x, float $y, float $width, float $height): void |
| 988 |
{ |
| 989 |
error_clear_last(); |
| 990 |
$result = \ps_rect($psdoc, $x, $y, $width, $height); |
| 991 |
if ($result === false) { |
| 992 |
throw PsException::createFromPhpError(); |
| 993 |
} |
| 994 |
} |
| 995 |
|
| 996 |
|
| 997 |
/** |
| 998 |
* Restores a previously saved graphics context. Any call of |
| 999 |
* ps_save must be accompanied by a call to |
| 1000 |
* ps_restore. All coordinate transformations, line |
| 1001 |
* style settings, color settings, etc. are being restored to the state |
| 1002 |
* before the call of ps_save. |
| 1003 |
* |
| 1004 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1005 |
* as returned by ps_new. |
| 1006 |
* @throws PsException |
| 1007 |
* |
| 1008 |
*/ |
| 1009 |
function ps_restore($psdoc): void |
| 1010 |
{ |
| 1011 |
error_clear_last(); |
| 1012 |
$result = \ps_restore($psdoc); |
| 1013 |
if ($result === false) { |
| 1014 |
throw PsException::createFromPhpError(); |
| 1015 |
} |
| 1016 |
} |
| 1017 |
|
| 1018 |
|
| 1019 |
/** |
| 1020 |
* Sets the rotation of the coordinate system. |
| 1021 |
* |
| 1022 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1023 |
* as returned by ps_new. |
| 1024 |
* @param float $rot Angle of rotation in degree. |
| 1025 |
* @throws PsException |
| 1026 |
* |
| 1027 |
*/ |
| 1028 |
function ps_rotate($psdoc, float $rot): void |
| 1029 |
{ |
| 1030 |
error_clear_last(); |
| 1031 |
$result = \ps_rotate($psdoc, $rot); |
| 1032 |
if ($result === false) { |
| 1033 |
throw PsException::createFromPhpError(); |
| 1034 |
} |
| 1035 |
} |
| 1036 |
|
| 1037 |
|
| 1038 |
/** |
| 1039 |
* Saves the current graphics context, containing colors, translation and |
| 1040 |
* rotation settings and some more. A saved context can be restored with |
| 1041 |
* ps_restore. |
| 1042 |
* |
| 1043 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1044 |
* as returned by ps_new. |
| 1045 |
* @throws PsException |
| 1046 |
* |
| 1047 |
*/ |
| 1048 |
function ps_save($psdoc): void |
| 1049 |
{ |
| 1050 |
error_clear_last(); |
| 1051 |
$result = \ps_save($psdoc); |
| 1052 |
if ($result === false) { |
| 1053 |
throw PsException::createFromPhpError(); |
| 1054 |
} |
| 1055 |
} |
| 1056 |
|
| 1057 |
|
| 1058 |
/** |
| 1059 |
* Sets horizontal and vertical scaling of the coordinate system. |
| 1060 |
* |
| 1061 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1062 |
* as returned by ps_new. |
| 1063 |
* @param float $x Scaling factor in horizontal direction. |
| 1064 |
* @param float $y Scaling factor in vertical direction. |
| 1065 |
* @throws PsException |
| 1066 |
* |
| 1067 |
*/ |
| 1068 |
function ps_scale($psdoc, float $x, float $y): void |
| 1069 |
{ |
| 1070 |
error_clear_last(); |
| 1071 |
$result = \ps_scale($psdoc, $x, $y); |
| 1072 |
if ($result === false) { |
| 1073 |
throw PsException::createFromPhpError(); |
| 1074 |
} |
| 1075 |
} |
| 1076 |
|
| 1077 |
|
| 1078 |
/** |
| 1079 |
* Links added with one of the functions ps_add_weblink, |
| 1080 |
* ps_add_pdflink, etc. will be displayed with a |
| 1081 |
* surounded rectangle when the postscript document is converted to |
| 1082 |
* pdf and viewed in a pdf viewer. This rectangle is not visible in |
| 1083 |
* the postscript document. |
| 1084 |
* This function sets the color of the rectangle's border line. |
| 1085 |
* |
| 1086 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1087 |
* as returned by ps_new. |
| 1088 |
* @param float $red The red component of the border color. |
| 1089 |
* @param float $green The green component of the border color. |
| 1090 |
* @param float $blue The blue component of the border color. |
| 1091 |
* @throws PsException |
| 1092 |
* |
| 1093 |
*/ |
| 1094 |
function ps_set_border_color($psdoc, float $red, float $green, float $blue): void |
| 1095 |
{ |
| 1096 |
error_clear_last(); |
| 1097 |
$result = \ps_set_border_color($psdoc, $red, $green, $blue); |
| 1098 |
if ($result === false) { |
| 1099 |
throw PsException::createFromPhpError(); |
| 1100 |
} |
| 1101 |
} |
| 1102 |
|
| 1103 |
|
| 1104 |
/** |
| 1105 |
* Links added with one of the functions ps_add_weblink, |
| 1106 |
* ps_add_pdflink, etc. will be displayed with a |
| 1107 |
* surounded rectangle when the postscript document is converted to |
| 1108 |
* pdf and viewed in a pdf viewer. This rectangle is not visible in |
| 1109 |
* the postscript document. |
| 1110 |
* This function sets the length of the black and white portion of a |
| 1111 |
* dashed border line. |
| 1112 |
* |
| 1113 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1114 |
* as returned by ps_new. |
| 1115 |
* @param float $black The length of the dash. |
| 1116 |
* @param float $white The length of the gap between dashes. |
| 1117 |
* @throws PsException |
| 1118 |
* |
| 1119 |
*/ |
| 1120 |
function ps_set_border_dash($psdoc, float $black, float $white): void |
| 1121 |
{ |
| 1122 |
error_clear_last(); |
| 1123 |
$result = \ps_set_border_dash($psdoc, $black, $white); |
| 1124 |
if ($result === false) { |
| 1125 |
throw PsException::createFromPhpError(); |
| 1126 |
} |
| 1127 |
} |
| 1128 |
|
| 1129 |
|
| 1130 |
/** |
| 1131 |
* Links added with one of the functions ps_add_weblink, |
| 1132 |
* ps_add_pdflink, etc. will be displayed with a |
| 1133 |
* surounded rectangle when the postscript document is converted to |
| 1134 |
* pdf and viewed in a pdf viewer. This rectangle is not visible in |
| 1135 |
* the postscript document. |
| 1136 |
* This function sets the appearance and width of the border line. |
| 1137 |
* |
| 1138 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1139 |
* as returned by ps_new. |
| 1140 |
* @param string $style style can be solid or |
| 1141 |
* dashed. |
| 1142 |
* @param float $width The line width of the border. |
| 1143 |
* @throws PsException |
| 1144 |
* |
| 1145 |
*/ |
| 1146 |
function ps_set_border_style($psdoc, string $style, float $width): void |
| 1147 |
{ |
| 1148 |
error_clear_last(); |
| 1149 |
$result = \ps_set_border_style($psdoc, $style, $width); |
| 1150 |
if ($result === false) { |
| 1151 |
throw PsException::createFromPhpError(); |
| 1152 |
} |
| 1153 |
} |
| 1154 |
|
| 1155 |
|
| 1156 |
/** |
| 1157 |
* Sets certain information fields of the document. This fields will be shown |
| 1158 |
* as a comment in the header of the PostScript file. If the document is |
| 1159 |
* converted to pdf this fields will also be used for the document |
| 1160 |
* information. |
| 1161 |
* |
| 1162 |
* The BoundingBox is usually set to the value given to the |
| 1163 |
* first page. This only works if ps_findfont has not |
| 1164 |
* been called before. In such cases the BoundingBox would be left unset |
| 1165 |
* unless you set it explicitly with this function. |
| 1166 |
* |
| 1167 |
* This function will have no effect anymore when the header of the postscript |
| 1168 |
* file has been already written. It must be called before the first page |
| 1169 |
* or the first call of ps_findfont. |
| 1170 |
* |
| 1171 |
* @param resource $p Resource identifier of the postscript file |
| 1172 |
* as returned by ps_new. |
| 1173 |
* @param string $key The name of the information field to set. The values which can be |
| 1174 |
* set are Keywords, Subject, |
| 1175 |
* Title, Creator, |
| 1176 |
* Author, BoundingBox, and |
| 1177 |
* Orientation. Be aware that some of them has a |
| 1178 |
* meaning to PostScript viewers. |
| 1179 |
* @param string $val The value of the information field. The field |
| 1180 |
* Orientation can be set to either |
| 1181 |
* Portrait or Landscape. The |
| 1182 |
* BoundingBox is a string consisting of four numbers. |
| 1183 |
* The first two numbers are the coordinates of the lower left corner of |
| 1184 |
* the page. The last two numbers are the coordinates of the upper |
| 1185 |
* right corner. |
| 1186 |
* |
| 1187 |
* Up to version 0.2.6 of pslib, the BoundingBox and Orientation |
| 1188 |
* will be overwritten by ps_begin_page, |
| 1189 |
* unless ps_findfont has been called before. |
| 1190 |
* @throws PsException |
| 1191 |
* |
| 1192 |
*/ |
| 1193 |
function ps_set_info($p, string $key, string $val): void |
| 1194 |
{ |
| 1195 |
error_clear_last(); |
| 1196 |
$result = \ps_set_info($p, $key, $val); |
| 1197 |
if ($result === false) { |
| 1198 |
throw PsException::createFromPhpError(); |
| 1199 |
} |
| 1200 |
} |
| 1201 |
|
| 1202 |
|
| 1203 |
/** |
| 1204 |
* Sets several parameters which are used by many functions. Parameters are by |
| 1205 |
* definition string values. |
| 1206 |
* |
| 1207 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1208 |
* as returned by ps_new. |
| 1209 |
* @param string $name For a list of possible names see ps_get_parameter. |
| 1210 |
* @param string $value The value of the parameter. |
| 1211 |
* @throws PsException |
| 1212 |
* |
| 1213 |
*/ |
| 1214 |
function ps_set_parameter($psdoc, string $name, string $value): void |
| 1215 |
{ |
| 1216 |
error_clear_last(); |
| 1217 |
$result = \ps_set_parameter($psdoc, $name, $value); |
| 1218 |
if ($result === false) { |
| 1219 |
throw PsException::createFromPhpError(); |
| 1220 |
} |
| 1221 |
} |
| 1222 |
|
| 1223 |
|
| 1224 |
/** |
| 1225 |
* Set the position for the next text output. You may alternatively set the x |
| 1226 |
* and y value separately by calling ps_set_value and |
| 1227 |
* choosing textx respectively texty as |
| 1228 |
* the value name. |
| 1229 |
* |
| 1230 |
* If you want to output text at a certain position it is more convenient |
| 1231 |
* to use ps_show_xy instead of setting the text position |
| 1232 |
* and calling ps_show. |
| 1233 |
* |
| 1234 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1235 |
* as returned by ps_new. |
| 1236 |
* @param float $x x-coordinate of the new text position. |
| 1237 |
* @param float $y y-coordinate of the new text position. |
| 1238 |
* @throws PsException |
| 1239 |
* |
| 1240 |
*/ |
| 1241 |
function ps_set_text_pos($psdoc, float $x, float $y): void |
| 1242 |
{ |
| 1243 |
error_clear_last(); |
| 1244 |
$result = \ps_set_text_pos($psdoc, $x, $y); |
| 1245 |
if ($result === false) { |
| 1246 |
throw PsException::createFromPhpError(); |
| 1247 |
} |
| 1248 |
} |
| 1249 |
|
| 1250 |
|
| 1251 |
/** |
| 1252 |
* Sets several values which are used by many functions. Parameters are by |
| 1253 |
* definition float values. |
| 1254 |
* |
| 1255 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1256 |
* as returned by ps_new. |
| 1257 |
* @param string $name The name can be one of the following: |
| 1258 |
* |
| 1259 |
* |
| 1260 |
* textrendering |
| 1261 |
* |
| 1262 |
* |
| 1263 |
* The way how text is shown. |
| 1264 |
* |
| 1265 |
* |
| 1266 |
* |
| 1267 |
* |
| 1268 |
* textx |
| 1269 |
* |
| 1270 |
* |
| 1271 |
* The x coordinate for text output. |
| 1272 |
* |
| 1273 |
* |
| 1274 |
* |
| 1275 |
* |
| 1276 |
* texty |
| 1277 |
* |
| 1278 |
* |
| 1279 |
* The y coordinate for text output. |
| 1280 |
* |
| 1281 |
* |
| 1282 |
* |
| 1283 |
* |
| 1284 |
* wordspacing |
| 1285 |
* |
| 1286 |
* |
| 1287 |
* The distance between words relative to the width of a space. |
| 1288 |
* |
| 1289 |
* |
| 1290 |
* |
| 1291 |
* |
| 1292 |
* leading |
| 1293 |
* |
| 1294 |
* |
| 1295 |
* The distance between lines in pixels. |
| 1296 |
* |
| 1297 |
* |
| 1298 |
* |
| 1299 |
* |
| 1300 |
* |
| 1301 |
* The way how text is shown. |
| 1302 |
* |
| 1303 |
* The x coordinate for text output. |
| 1304 |
* |
| 1305 |
* The y coordinate for text output. |
| 1306 |
* |
| 1307 |
* The distance between words relative to the width of a space. |
| 1308 |
* |
| 1309 |
* The distance between lines in pixels. |
| 1310 |
* @param float $value The way how text is shown. |
| 1311 |
* @throws PsException |
| 1312 |
* |
| 1313 |
*/ |
| 1314 |
function ps_set_value($psdoc, string $name, float $value): void |
| 1315 |
{ |
| 1316 |
error_clear_last(); |
| 1317 |
$result = \ps_set_value($psdoc, $name, $value); |
| 1318 |
if ($result === false) { |
| 1319 |
throw PsException::createFromPhpError(); |
| 1320 |
} |
| 1321 |
} |
| 1322 |
|
| 1323 |
|
| 1324 |
/** |
| 1325 |
* Sets the color for drawing, filling, or both. |
| 1326 |
* |
| 1327 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1328 |
* as returned by ps_new. |
| 1329 |
* @param string $type The parameter type can be |
| 1330 |
* both, fill, or |
| 1331 |
* fillstroke. |
| 1332 |
* @param string $colorspace The colorspace should be one of gray, |
| 1333 |
* rgb, cmyk, |
| 1334 |
* spot, pattern. Depending on the |
| 1335 |
* colorspace either only the first, the first three or all parameters |
| 1336 |
* will be used. |
| 1337 |
* @param float $c1 Depending on the colorspace this is either the red component (rgb), |
| 1338 |
* the cyan component (cmyk), the gray value (gray), the identifier of |
| 1339 |
* the spot color or the identifier of the pattern. |
| 1340 |
* @param float $c2 Depending on the colorspace this is either the green component (rgb), |
| 1341 |
* the magenta component (cmyk). |
| 1342 |
* @param float $c3 Depending on the colorspace this is either the blue component (rgb), |
| 1343 |
* the yellow component (cmyk). |
| 1344 |
* @param float $c4 This must only be set in cmyk colorspace and specifies the black |
| 1345 |
* component. |
| 1346 |
* @throws PsException |
| 1347 |
* |
| 1348 |
*/ |
| 1349 |
function ps_setcolor($psdoc, string $type, string $colorspace, float $c1, float $c2, float $c3, float $c4): void |
| 1350 |
{ |
| 1351 |
error_clear_last(); |
| 1352 |
$result = \ps_setcolor($psdoc, $type, $colorspace, $c1, $c2, $c3, $c4); |
| 1353 |
if ($result === false) { |
| 1354 |
throw PsException::createFromPhpError(); |
| 1355 |
} |
| 1356 |
} |
| 1357 |
|
| 1358 |
|
| 1359 |
/** |
| 1360 |
* Sets the length of the black and white portions of a dashed line. |
| 1361 |
* |
| 1362 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1363 |
* as returned by ps_new. |
| 1364 |
* @param float $on The length of the dash. |
| 1365 |
* @param float $off The length of the gap between dashes. |
| 1366 |
* @throws PsException |
| 1367 |
* |
| 1368 |
*/ |
| 1369 |
function ps_setdash($psdoc, float $on, float $off): void |
| 1370 |
{ |
| 1371 |
error_clear_last(); |
| 1372 |
$result = \ps_setdash($psdoc, $on, $off); |
| 1373 |
if ($result === false) { |
| 1374 |
throw PsException::createFromPhpError(); |
| 1375 |
} |
| 1376 |
} |
| 1377 |
|
| 1378 |
|
| 1379 |
/** |
| 1380 |
* This function is |
| 1381 |
* currently not documented; only its argument list is available. |
| 1382 |
* |
| 1383 |
* |
| 1384 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1385 |
* as returned by ps_new. |
| 1386 |
* @param float $value The value must be between 0.2 and 1. |
| 1387 |
* @throws PsException |
| 1388 |
* |
| 1389 |
*/ |
| 1390 |
function ps_setflat($psdoc, float $value): void |
| 1391 |
{ |
| 1392 |
error_clear_last(); |
| 1393 |
$result = \ps_setflat($psdoc, $value); |
| 1394 |
if ($result === false) { |
| 1395 |
throw PsException::createFromPhpError(); |
| 1396 |
} |
| 1397 |
} |
| 1398 |
|
| 1399 |
|
| 1400 |
/** |
| 1401 |
* Sets a font, which has to be loaded before with |
| 1402 |
* ps_findfont. Outputting text without setting a font |
| 1403 |
* results in an error. |
| 1404 |
* |
| 1405 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1406 |
* as returned by ps_new. |
| 1407 |
* @param int $fontid The font identifier as returned by ps_findfont. |
| 1408 |
* @param float $size The size of the font. |
| 1409 |
* @throws PsException |
| 1410 |
* |
| 1411 |
*/ |
| 1412 |
function ps_setfont($psdoc, int $fontid, float $size): void |
| 1413 |
{ |
| 1414 |
error_clear_last(); |
| 1415 |
$result = \ps_setfont($psdoc, $fontid, $size); |
| 1416 |
if ($result === false) { |
| 1417 |
throw PsException::createFromPhpError(); |
| 1418 |
} |
| 1419 |
} |
| 1420 |
|
| 1421 |
|
| 1422 |
/** |
| 1423 |
* Sets the gray value for all following drawing operations. |
| 1424 |
* |
| 1425 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1426 |
* as returned by ps_new. |
| 1427 |
* @param float $gray The value must be between 0 (white) and 1 (black). |
| 1428 |
* @throws PsException |
| 1429 |
* |
| 1430 |
*/ |
| 1431 |
function ps_setgray($psdoc, float $gray): void |
| 1432 |
{ |
| 1433 |
error_clear_last(); |
| 1434 |
$result = \ps_setgray($psdoc, $gray); |
| 1435 |
if ($result === false) { |
| 1436 |
throw PsException::createFromPhpError(); |
| 1437 |
} |
| 1438 |
} |
| 1439 |
|
| 1440 |
|
| 1441 |
/** |
| 1442 |
* Sets how line ends look like. |
| 1443 |
* |
| 1444 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1445 |
* as returned by ps_new. |
| 1446 |
* @param int $type The type of line ends. Possible values are |
| 1447 |
* PS_LINECAP_BUTT, |
| 1448 |
* PS_LINECAP_ROUND, or |
| 1449 |
* PS_LINECAP_SQUARED. |
| 1450 |
* @throws PsException |
| 1451 |
* |
| 1452 |
*/ |
| 1453 |
function ps_setlinecap($psdoc, int $type): void |
| 1454 |
{ |
| 1455 |
error_clear_last(); |
| 1456 |
$result = \ps_setlinecap($psdoc, $type); |
| 1457 |
if ($result === false) { |
| 1458 |
throw PsException::createFromPhpError(); |
| 1459 |
} |
| 1460 |
} |
| 1461 |
|
| 1462 |
|
| 1463 |
/** |
| 1464 |
* Sets how lines are joined. |
| 1465 |
* |
| 1466 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1467 |
* as returned by ps_new. |
| 1468 |
* @param int $type The way lines are joined. Possible values are |
| 1469 |
* PS_LINEJOIN_MITER, |
| 1470 |
* PS_LINEJOIN_ROUND, or |
| 1471 |
* PS_LINEJOIN_BEVEL. |
| 1472 |
* @throws PsException |
| 1473 |
* |
| 1474 |
*/ |
| 1475 |
function ps_setlinejoin($psdoc, int $type): void |
| 1476 |
{ |
| 1477 |
error_clear_last(); |
| 1478 |
$result = \ps_setlinejoin($psdoc, $type); |
| 1479 |
if ($result === false) { |
| 1480 |
throw PsException::createFromPhpError(); |
| 1481 |
} |
| 1482 |
} |
| 1483 |
|
| 1484 |
|
| 1485 |
/** |
| 1486 |
* Sets the line width for all following drawing operations. |
| 1487 |
* |
| 1488 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1489 |
* as returned by ps_new. |
| 1490 |
* @param float $width The width of lines in points. |
| 1491 |
* @throws PsException |
| 1492 |
* |
| 1493 |
*/ |
| 1494 |
function ps_setlinewidth($psdoc, float $width): void |
| 1495 |
{ |
| 1496 |
error_clear_last(); |
| 1497 |
$result = \ps_setlinewidth($psdoc, $width); |
| 1498 |
if ($result === false) { |
| 1499 |
throw PsException::createFromPhpError(); |
| 1500 |
} |
| 1501 |
} |
| 1502 |
|
| 1503 |
|
| 1504 |
/** |
| 1505 |
* If two lines join in a small angle and the line join is set to |
| 1506 |
* PS_LINEJOIN_MITER, then |
| 1507 |
* the resulting spike will be very long. The miter limit is the maximum |
| 1508 |
* ratio of the miter length (the length of the spike) and the line width. |
| 1509 |
* |
| 1510 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1511 |
* as returned by ps_new. |
| 1512 |
* @param float $value The maximum ratio between the miter length and the line width. Larger |
| 1513 |
* values (> 10) will result in very long spikes when two lines meet |
| 1514 |
* in a small angle. Keep the default unless you know what you are doing. |
| 1515 |
* @throws PsException |
| 1516 |
* |
| 1517 |
*/ |
| 1518 |
function ps_setmiterlimit($psdoc, float $value): void |
| 1519 |
{ |
| 1520 |
error_clear_last(); |
| 1521 |
$result = \ps_setmiterlimit($psdoc, $value); |
| 1522 |
if ($result === false) { |
| 1523 |
throw PsException::createFromPhpError(); |
| 1524 |
} |
| 1525 |
} |
| 1526 |
|
| 1527 |
|
| 1528 |
/** |
| 1529 |
* This function is |
| 1530 |
* currently not documented; only its argument list is available. |
| 1531 |
* |
| 1532 |
* |
| 1533 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1534 |
* as returned by ps_new. |
| 1535 |
* @param int $mode |
| 1536 |
* @throws PsException |
| 1537 |
* |
| 1538 |
*/ |
| 1539 |
function ps_setoverprintmode($psdoc, int $mode): void |
| 1540 |
{ |
| 1541 |
error_clear_last(); |
| 1542 |
$result = \ps_setoverprintmode($psdoc, $mode); |
| 1543 |
if ($result === false) { |
| 1544 |
throw PsException::createFromPhpError(); |
| 1545 |
} |
| 1546 |
} |
| 1547 |
|
| 1548 |
|
| 1549 |
/** |
| 1550 |
* Sets the length of the black and white portions of a dashed line. |
| 1551 |
* ps_setpolydash is used to set more complicated dash |
| 1552 |
* patterns. |
| 1553 |
* |
| 1554 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1555 |
* as returned by ps_new. |
| 1556 |
* @param float $arr arr is a list of length elements alternately for |
| 1557 |
* the black and white portion. |
| 1558 |
* @throws PsException |
| 1559 |
* |
| 1560 |
*/ |
| 1561 |
function ps_setpolydash($psdoc, float $arr): void |
| 1562 |
{ |
| 1563 |
error_clear_last(); |
| 1564 |
$result = \ps_setpolydash($psdoc, $arr); |
| 1565 |
if ($result === false) { |
| 1566 |
throw PsException::createFromPhpError(); |
| 1567 |
} |
| 1568 |
} |
| 1569 |
|
| 1570 |
|
| 1571 |
/** |
| 1572 |
* Creates a pattern based on a shading, which has to be created before with |
| 1573 |
* ps_shading. Shading patterns can be used like regular |
| 1574 |
* patterns. |
| 1575 |
* |
| 1576 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1577 |
* as returned by ps_new. |
| 1578 |
* @param int $shadingid The identifier of a shading previously created with |
| 1579 |
* ps_shading. |
| 1580 |
* @param string $optlist This argument is not currently used. |
| 1581 |
* @return int The identifier of the pattern. |
| 1582 |
* @throws PsException |
| 1583 |
* |
| 1584 |
*/ |
| 1585 |
function ps_shading_pattern($psdoc, int $shadingid, string $optlist): int |
| 1586 |
{ |
| 1587 |
error_clear_last(); |
| 1588 |
$result = \ps_shading_pattern($psdoc, $shadingid, $optlist); |
| 1589 |
if ($result === false) { |
| 1590 |
throw PsException::createFromPhpError(); |
| 1591 |
} |
| 1592 |
return $result; |
| 1593 |
} |
| 1594 |
|
| 1595 |
|
| 1596 |
/** |
| 1597 |
* Creates a shading, which can be used by ps_shfill or |
| 1598 |
* ps_shading_pattern. |
| 1599 |
* |
| 1600 |
* The color of the shading can be in any color space except for |
| 1601 |
* pattern. |
| 1602 |
* |
| 1603 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1604 |
* as returned by ps_new. |
| 1605 |
* @param string $type The type of shading can be either radial or |
| 1606 |
* axial. Each shading starts with the current fill |
| 1607 |
* color and ends with the given color values passed in the parameters |
| 1608 |
* c1 to c4 |
| 1609 |
* (see ps_setcolor for their meaning). |
| 1610 |
* @param float $x0 The coordinates x0, y0, |
| 1611 |
* x1, y1 are the start and |
| 1612 |
* end point of the shading. If the type of shading is |
| 1613 |
* radial the two points are the middle points of |
| 1614 |
* a starting and ending circle. |
| 1615 |
* @param float $y0 See ps_setcolor for their meaning. |
| 1616 |
* @param float $x1 If the shading is of type radial the |
| 1617 |
* optlist must also contain the parameters |
| 1618 |
* r0 and r1 with the radius of the |
| 1619 |
* start and end circle. |
| 1620 |
* @param float $y1 |
| 1621 |
* @param float $c1 |
| 1622 |
* @param float $c2 |
| 1623 |
* @param float $c3 |
| 1624 |
* @param float $c4 |
| 1625 |
* @param string $optlist |
| 1626 |
* @return int Returns the identifier of the pattern. |
| 1627 |
* @throws PsException |
| 1628 |
* |
| 1629 |
*/ |
| 1630 |
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 |
| 1631 |
{ |
| 1632 |
error_clear_last(); |
| 1633 |
$result = \ps_shading($psdoc, $type, $x0, $y0, $x1, $y1, $c1, $c2, $c3, $c4, $optlist); |
| 1634 |
if ($result === false) { |
| 1635 |
throw PsException::createFromPhpError(); |
| 1636 |
} |
| 1637 |
return $result; |
| 1638 |
} |
| 1639 |
|
| 1640 |
|
| 1641 |
/** |
| 1642 |
* Fills an area with a shading, which has to be created before with |
| 1643 |
* ps_shading. This is an alternative way to creating |
| 1644 |
* a pattern from a shading ps_shading_pattern and using |
| 1645 |
* the pattern as the filling color. |
| 1646 |
* |
| 1647 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1648 |
* as returned by ps_new. |
| 1649 |
* @param int $shadingid The identifier of a shading previously created with |
| 1650 |
* ps_shading. |
| 1651 |
* @throws PsException |
| 1652 |
* |
| 1653 |
*/ |
| 1654 |
function ps_shfill($psdoc, int $shadingid): void |
| 1655 |
{ |
| 1656 |
error_clear_last(); |
| 1657 |
$result = \ps_shfill($psdoc, $shadingid); |
| 1658 |
if ($result === false) { |
| 1659 |
throw PsException::createFromPhpError(); |
| 1660 |
} |
| 1661 |
} |
| 1662 |
|
| 1663 |
|
| 1664 |
/** |
| 1665 |
* Output a text at the given text position. |
| 1666 |
* |
| 1667 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1668 |
* as returned by ps_new. |
| 1669 |
* @param string $text The text to be output. |
| 1670 |
* @param float $x x-coordinate of the lower left corner of the box surrounding the text. |
| 1671 |
* @param float $y y-coordinate of the lower left corner of the box surrounding the text. |
| 1672 |
* @throws PsException |
| 1673 |
* |
| 1674 |
*/ |
| 1675 |
function ps_show_xy($psdoc, string $text, float $x, float $y): void |
| 1676 |
{ |
| 1677 |
error_clear_last(); |
| 1678 |
$result = \ps_show_xy($psdoc, $text, $x, $y); |
| 1679 |
if ($result === false) { |
| 1680 |
throw PsException::createFromPhpError(); |
| 1681 |
} |
| 1682 |
} |
| 1683 |
|
| 1684 |
|
| 1685 |
/** |
| 1686 |
* This function is |
| 1687 |
* currently not documented; only its argument list is available. |
| 1688 |
* |
| 1689 |
* |
| 1690 |
* @param resource $psdoc |
| 1691 |
* @param string $text |
| 1692 |
* @param int $len |
| 1693 |
* @param float $xcoor |
| 1694 |
* @param float $ycoor |
| 1695 |
* @throws PsException |
| 1696 |
* |
| 1697 |
*/ |
| 1698 |
function ps_show_xy2($psdoc, string $text, int $len, float $xcoor, float $ycoor): void |
| 1699 |
{ |
| 1700 |
error_clear_last(); |
| 1701 |
$result = \ps_show_xy2($psdoc, $text, $len, $xcoor, $ycoor); |
| 1702 |
if ($result === false) { |
| 1703 |
throw PsException::createFromPhpError(); |
| 1704 |
} |
| 1705 |
} |
| 1706 |
|
| 1707 |
|
| 1708 |
/** |
| 1709 |
* Output a text at the current text position. The text position can be set |
| 1710 |
* by storing the x and y coordinates into the values textx |
| 1711 |
* and texty with the function |
| 1712 |
* ps_set_value. The function will issue an |
| 1713 |
* error if a font was not set before with ps_setfont. |
| 1714 |
* |
| 1715 |
* ps_show evaluates the following parameters and values |
| 1716 |
* as set by ps_set_parameter and |
| 1717 |
* ps_set_value. |
| 1718 |
* |
| 1719 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1720 |
* as returned by ps_new. |
| 1721 |
* @param string $text The text to be output. |
| 1722 |
* @throws PsException |
| 1723 |
* |
| 1724 |
*/ |
| 1725 |
function ps_show($psdoc, string $text): void |
| 1726 |
{ |
| 1727 |
error_clear_last(); |
| 1728 |
$result = \ps_show($psdoc, $text); |
| 1729 |
if ($result === false) { |
| 1730 |
throw PsException::createFromPhpError(); |
| 1731 |
} |
| 1732 |
} |
| 1733 |
|
| 1734 |
|
| 1735 |
/** |
| 1736 |
* Output text at the current position. Do not print more than len characters. |
| 1737 |
* |
| 1738 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1739 |
* as returned by ps_new. |
| 1740 |
* @param string $text The text to be output. |
| 1741 |
* @param int $len The maximum number of characters to print. |
| 1742 |
* @throws PsException |
| 1743 |
* |
| 1744 |
*/ |
| 1745 |
function ps_show2($psdoc, string $text, int $len): void |
| 1746 |
{ |
| 1747 |
error_clear_last(); |
| 1748 |
$result = \ps_show2($psdoc, $text, $len); |
| 1749 |
if ($result === false) { |
| 1750 |
throw PsException::createFromPhpError(); |
| 1751 |
} |
| 1752 |
} |
| 1753 |
|
| 1754 |
|
| 1755 |
/** |
| 1756 |
* Draws the path constructed with previously called drawing functions like |
| 1757 |
* ps_lineto. |
| 1758 |
* |
| 1759 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1760 |
* as returned by ps_new. |
| 1761 |
* @throws PsException |
| 1762 |
* |
| 1763 |
*/ |
| 1764 |
function ps_stroke($psdoc): void |
| 1765 |
{ |
| 1766 |
error_clear_last(); |
| 1767 |
$result = \ps_stroke($psdoc); |
| 1768 |
if ($result === false) { |
| 1769 |
throw PsException::createFromPhpError(); |
| 1770 |
} |
| 1771 |
} |
| 1772 |
|
| 1773 |
|
| 1774 |
/** |
| 1775 |
* Output the glyph at position ord in the font |
| 1776 |
* encoding vector of the current font. The font encoding for a font can be |
| 1777 |
* set when loading the font with ps_findfont. |
| 1778 |
* |
| 1779 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1780 |
* as returned by ps_new. |
| 1781 |
* @param int $ord The position of the glyph in the font encoding vector. |
| 1782 |
* @throws PsException |
| 1783 |
* |
| 1784 |
*/ |
| 1785 |
function ps_symbol($psdoc, int $ord): void |
| 1786 |
{ |
| 1787 |
error_clear_last(); |
| 1788 |
$result = \ps_symbol($psdoc, $ord); |
| 1789 |
if ($result === false) { |
| 1790 |
throw PsException::createFromPhpError(); |
| 1791 |
} |
| 1792 |
} |
| 1793 |
|
| 1794 |
|
| 1795 |
/** |
| 1796 |
* Sets a new initial point of the coordinate system. |
| 1797 |
* |
| 1798 |
* @param resource $psdoc Resource identifier of the postscript file |
| 1799 |
* as returned by ps_new. |
| 1800 |
* @param float $x x-coordinate of the origin of the translated coordinate system. |
| 1801 |
* @param float $y y-coordinate of the origin of the translated coordinate system. |
| 1802 |
* @throws PsException |
| 1803 |
* |
| 1804 |
*/ |
| 1805 |
function ps_translate($psdoc, float $x, float $y): void |
| 1806 |
{ |
| 1807 |
error_clear_last(); |
| 1808 |
$result = \ps_translate($psdoc, $x, $y); |
| 1809 |
if ($result === false) { |
| 1810 |
throw PsException::createFromPhpError(); |
| 1811 |
} |
| 1812 |
} |
| 1813 |
|