Horde_Image_Imagick::dashedLine PHP Method

dashedLine() public method

Draws a dashed line.
public dashedLine ( integer $x0, integer $y0, integer $x1, integer $y1, string $color = 'black', string $width = 1, integer $dash_length = 2, integer $dash_space = 2 )
$x0 integer The x co-ordinate of the start.
$y0 integer The y co-ordinate of the start.
$x1 integer The x co-ordinate of the end.
$y1 integer The y co-ordinate of the end.
$color string The line color.
$width string The width of the line.
$dash_length integer The length of a dash on the dashed line.
$dash_space integer The length of a space in the dashed line.
    public function dashedLine($x0, $y0, $x1, $y1, $color = 'black', $width = 1, $dash_length = 2, $dash_space = 2)
    {
        try {
            $draw = new ImagickDraw();
            $draw->setStrokeColor(new ImagickPixel($color));
            $draw->setStrokeWidth($width);
            $draw->setStrokeDashArray(array($dash_length, $dash_space));
            $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 (ImageException $e) {
            throw new Horde_Image_Exception($e);
        }
        $draw->destroy();
    }