Page 1 of 1

Polyline Stroke

Posted: 2013-02-14T07:38:49-07:00
by alfaalex
Greetings, I'm trying to set the stroke for a polyline but not working. Linejoin and linecap drawing a beveled corner. Where is the issue?

This is the code:

Code: Select all

$stroke = new Imagick();
$stroke->newImage(400, 400, new ImagickPixel("none"));

$draw = new ImagickDraw();
$draw->setFillColor("none");

$draw->setStrokeWidth(50);
$draw->setStrokeColor("#ff0000");
$draw->setstrokeLineJoin(imagick::LINEJOIN_MITER);
$draw->setStrokeLineCap(imagick::LINECAP_BUTT);
$draw->setStrokeMiterLimit(0);
$draw->setStrokeAntialias(0);
$x = 100;
$y = 100;
$x1 = 300;
$y1 = 200;
$coo1 = array(
		array('x' => $x,'y' => $y),
		array('x' => $x1,'y' => $y),
		array('x' => $x1,'y' => $y1),
		array('x' => $x,'y' => $y1),
		array('x' => $x,'y' => $y),
);
$draw->polyline($coo1);
$stroke->drawImage( $draw );
$stroke->setImageFormat("png");
header( "Content-Type: image/png" );
echo $stroke;
This is the image generated:
Image

This is what I would:

Image