Horde_Image_Imagick::line PHP Method

line() public method

Draws a line.
public line ( integer $x0, integer $y0, integer $x1, integer $y1, string $color = 'black', string $width = 1 )
$x0 integer The x coordinate of the start.
$y0 integer The y coordinate of the start.
$x1 integer The x coordinate of the end.
$y1 integer The y coordinate of the end.
$color string The line color.
$width string The width of the line.
    public function line($x0, $y0, $x1, $y1, $color = 'black', $width = 1)
    {
        try {
            $draw = new ImagickDraw();
            $draw->setStrokeColor(new ImagickPixel($color));
            $draw->setStrokeWidth($width);
            $draw->line($x0, $y0, $x1, $y1);
        } 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 Horde_Image_Exception($e);
        }
        $draw->destroy();
    }