note 46186 deleted from function.imagerectangle by betz
| From: | betz@php.net | Date: | Tue, 29 Nov 2005 22:34:22 +0000 |
| Subject: | note 46186 deleted from function.imagerectangle by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99330@lists.php.net to get a copy of this message | ||
Note Submitter: j dot gizmo at aon dot at
----
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
?>