note 46186 added to function.imagerectangle
| From: | j dot gizmo at aon dot at | Date: | Fri, 01 Oct 2004 16:33:03 +0000 |
| Subject: | note 46186 added to function.imagerectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77690@lists.php.net to get a copy of this message | ||
this function essentially only draws four lines.
usually this is not a problem, but if you are using a color with an alpha value (with transparency),
the four corner pixels will be darker than the connection lines. this is due to the fact, that the
lines all start on the corner pixel, thus always two lines are on top of each other at the corner.
<?php
$col = imagecolorcreatealpha($img, $r, $g, $b, $transparency)
//doesn't work, corners too dark
imagerectangle($img, $x1, $y1, $x2, $y2, $col );
//proper drawing
$col = imagecolorcreatealpha($img, $r, $g, $b, $transparency)
imageline($img, $x1, $y1, $x2, $y1, $col ); //top
imageline($img, $x1, $y2, $x2, $y2, $col ); //bottom
imageline($img, $x1, $y1+1, $x1, $y2-1, $col ); //left
imageline($img, $x2, $y1+1, $x2, $y2-1, $col ); //right
?>
----
Manual Page -- http://www.php.net/manual/en/function.imagerectangle.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46186
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46186&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46186&report=yes
Search -- http://master.php.net/manage/user-notes.php