note 14368 deleted from function.imagesetstyle by didou
| From: | didou@php.net | Date: | Fri, 26 Jan 2007 22:41:11 +0000 |
| Subject: | note 14368 deleted from function.imagesetstyle by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-122246@lists.php.net to get a copy of this message | ||
Note Submitter: hatamoto at hhole dot com
----
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);
?>