note 19558 added to function.imagerectangle
| From: | carl dot luvs dot spam at strategySPAMMEforward dot com | Date: | Sun, 03 Mar 2002 20:49:22 +0000 |
| Subject: | note 19558 added to function.imagerectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27300@lists.php.net to get a copy of this message | ||
The behavior of Image*Rectangle() seems undefined wrt the pixels that are actually effected, as are
the underlying GD calls.
They seem to treat the width,height as relative coordinates to which the pen travels, rather than as
the defining limits of the box. For example:
$width=100;
$height=100;
$image = ImageCreate($width, $height);
$black = ImageColorAllocate($image, 0, 0, 0);
$white = ImageColorAllocate($image, 255, 255, 255);
ImageFilledRectangle($image, 0, 0, $width, $height, $white);
ImageRectangle($image, 0, 0, $width, $height, $black);
header("Content-type: image/png");
ImagePNG($image);
ImageDestroy($image);
will only show the top and left sides of the black rectangle. This can be a hassle, but not
insurmountable. You just have to subtract 1 to get the "other" behavior.
I don't have GD 2.0,but maybe someone who does can check to see how line thickness impacts
this. Hopefully, it follows the pattern (filling pixels from $x+$width to $x+$width+$penwidth).
Carl
--
http://www.php.net/manual/en/function.imagerectangle.php
http://master.php.net/manage/user-notes.php?action=edit+19558
http://master.php.net/manage/user-notes.php?action=delete+19558
http://master.php.net/manage/user-notes.php?action=reject+19558