Example: draw a purple box 144 points wide by 72 points high on a page in position 0, 0:
<?php
ps_setcolor($ps, "fill", "cmyk", .5, .5, 0, 0);
ps_rect($ps, 0, 0, 144, 72);
ps_fill($ps);
?>
(PECL ps >= 1.1.0)
ps_rect — Draws a rectangle
$psdoc
,$x
,$y
,$width
,$height
Draws a rectangle with its lower left corner at (x
,
y
). The rectangle starts and ends in its lower left
corner. If this function is called outside a path it will start a new path.
If it is called within a path it will add the rectangle as a subpath. If
the last drawing operation does not end in the lower left corner then there
will be a gap in the path.
psdoc
Resource identifier of the postscript file as returned by ps_new().
x
x-coordinate of the lower left corner of the rectangle.
y
y-coordinate of the lower left corner of the rectangle.
width
The width of the image.
height
The height of the image.
成功时返回 true
, 或者在失败时返回 false
。
Example: draw a purple box 144 points wide by 72 points high on a page in position 0, 0:
<?php
ps_setcolor($ps, "fill", "cmyk", .5, .5, 0, 0);
ps_rect($ps, 0, 0, 144, 72);
ps_fill($ps);
?>