Polyline Stroke

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
alfaalex
Posts: 2
Joined: 2013-02-14T07:28:02-07:00
Authentication code: 6789

Polyline Stroke

Post 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
Attachments
test2.png
test2.png (2.05 KiB) Viewed 4761 times
test2.php.png
test2.php.png (1.96 KiB) Viewed 4761 times
Post Reply