note 93765 modified in function.imagickdraw-point by danbrown

From: Date: Sun, 27 Sep 2009 16:23:32 +0000
Subject: note 93765 modified in function.imagickdraw-point by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161110@lists.php.net to get a copy of this message
point($x, $y) uses the FillColor of ImagickDraw! This actually took quite a while, till I found out that it's falsely documented on these pages. So to draw single pixels, do it like this: <?php $image = new Imagick(); $draw = new ImagickDraw(); $pixel = new ImagickPixel('red'); $image->newImage(10, 10, 'transparent', 'gif'); // Here comes the magick: $pixel->setColor($_POST[$i."x".$j]); $draw->setFillColor($pixel); $draw->point($i,$j); $image->drawImage($draw); $image->writeImages($path, true); ?> --was-- point($x, $y) uses the FillColor of ImagickDraw! This actually took quite a while, till I found out that it's falsely documented on these pages. So to draw single pixels, do it like this: $image = new Imagick(); $draw = new ImagickDraw(); $pixel = new ImagickPixel('red'); $image->newImage(10, 10, 'transparent', 'gif'); // Here comes the magick: $pixel->setColor($_POST[$i."x".$j]); $draw->setFillColor($pixel); $draw->point($i,$j); $image->drawImage($draw); $image->writeImages($path, true); http://php.net/manual/en/function.imagickdraw-point.php

« previous php.notes (#161110) next »