note 109787 added to function.imagefilledrectangle
| From: | olivier dot pons at google dot mail dot com | Date: | Tue, 21 Aug 2012 09:48:29 +0000 |
| Subject: | note 109787 added to function.imagefilledrectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190151@lists.php.net to get a copy of this message | ||
I wanted to clear an image, and set it to full transparent.
imagefilledrectangle() seems to ignore alpha channel and alpha blending.
Use imagefill() instead:
<php
$w = imagesx($final);
$h = imagesy($final);
$grande = imagecreatetruecolor($w, $h);
// Alpha blending on to use channel alpha
imagealphablending($grande, true);
// Allocate a transparent color and fill the new image with it.
// Without this the image will have a black background instead
// of being transparent.
$transparent = imagecolorallocatealpha($grande, 0, 0, 0, 127);
// transparent alpha will be _ignored_:
imagefilledrectangle($grande, 0, 0, $w, $h, $transparent);
// ok, transparent will be used and set whole alpha channel to transparent:
imagefill($grande, 0, 0, $transparent);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 78.224.184.168
----
Manual Page -- http://www.php.net/manual/en/function.imagefilledrectangle.php
Edit -- https://master.php.net/note/edit/109787
Del: integrated -- https://master.php.net/note/delete/109787/integrated
Del: useless -- https://master.php.net/note/delete/109787/useless
Del: bad code -- https://master.php.net/note/delete/109787/bad+code
Del: spam -- https://master.php.net/note/delete/109787/spam
Del: non-english -- https://master.php.net/note/delete/109787/non-english
Del: in docs -- https://master.php.net/note/delete/109787/in+docs
Del: other reasons-- https://master.php.net/note/delete/109787
Reject -- https://master.php.net/note/reject/109787
Search -- https://master.php.net/manage/user-notes.php