Horde_Image_Imagick::rectangle PHP Method

rectangle() public method

Draws a rectangle.
public rectangle ( integer $x, integer $y, integer $width, integer $height, string $color, string $fill = 'none' )
$x integer The left x-coordinate of the rectangle.
$y integer The top y-coordinate of the rectangle.
$width integer The width of the rectangle.
$height integer The height of the rectangle.
$color string The line color of the rectangle.
$fill string The color to fill the rectangle.
    public function rectangle($x, $y, $width, $height, $color, $fill = 'none')
    {
        try {
            $draw = new ImagickDraw();
            $draw->setStrokeColor(new ImagickPixel($color));
            $draw->setFillColor(new ImagickPixel($fill));
            $draw->rectangle($x, $y, $x + $width, $y + $height);
        } catch (ImagickDrawException $e) {
            throw new Horde_Image_Exception($e);
        } catch (ImagickPixelException $e) {
            throw new Horde_Image_Exception($e);
        }
        try {
            $this->_imagick->drawImage($draw);
        } catch (ImagickException $e) {
            throw new Horde_Image_Exception($e);
        }
        $draw->destroy();
    }