note 14368 added to function.imagesetstyle.php
| From: | hatamoto at hhole dot com | Date: | Fri, 27 Jul 2001 23:12:24 +0000 |
| Subject: | note 14368 added to function.imagesetstyle.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15959@lists.php.net to get a copy of this message | ||
Okay, I answered my own question. ;)
If you use truecolor image modes and generate colors that have alpha values, those colors will be
drawn correctly (ie: with appropriate transparency). So the following should draw a blue box with a
white dashed line diagonally across it. It should NOT be a white solid line.
<?
$image = imagecreatetruecolor(200,200);
imagealphablending($image, TRUE);
$blue = imagecolorallocate($image, 0, 0, 0xff);
$white = imagecolorallocate($image, 0xff, 0xff, 0xff);
$t = imagecolorresolvealpha($image, 0xff, 0xff, 0xff, 0xff);
$style = array($white, $white, $white, $t, $t, $t);
imagesetstyle($image, $style);
imagefilledrectangle($image, 0, 0, 199, 199, $blue);
imageline($image, 0, 0, 199, 199, IMG_COLOR_STYLED);
header("Content-type: image/jpeg");
imagejpeg($image);
?>
http://www.php.net/manual/en/function.imagesetstyle.php