note 95983 added to function.imagecopymerge
| From: | peterjwest3 at gmail dot com | Date: | Mon, 01 Feb 2010 15:27:11 +0000 |
| Subject: | note 95983 added to function.imagecopymerge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165568@lists.php.net to get a copy of this message | ||
Sina's method is elegant but had a small bug as well as some redundant code. Here is a more
concise version with better comments:
<?php
//PNG alpha channel support for imagecopymerge()
//This works because imagecopy() supports alpha but not blending, while imagecopymerge() supports
blending but not alpha
function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h,
$pct) {
//Creates a portion of the destination image and overlays the source image (with alpha)
$portion = imagecreatetruecolor($src_w, $src_h);
imagecopy($portion, $dst_im, 0, 0, $dst_x, $dst_y, $src_w, $src_h);
imagecopy($portion, $src_im, 0, 0, $src_x, $src_y, $src_w, $src_h);
//Blends the portion with the original image
imagecopymerge($dst_im, $portion, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 81.108.89.249
----
Manual Page -- http://www.php.net/manual/en/function.imagecopymerge.php
Edit -- https://master.php.net/note/edit/95983
Del: integrated -- https://master.php.net/note/delete/95983/integrated
Del: useless -- https://master.php.net/note/delete/95983/useless
Del: bad code -- https://master.php.net/note/delete/95983/bad+code
Del: spam -- https://master.php.net/note/delete/95983/spam
Del: non-english -- https://master.php.net/note/delete/95983/non-english
Del: in docs -- https://master.php.net/note/delete/95983/in+docs
Del: other reasons-- https://master.php.net/note/delete/95983
Reject -- https://master.php.net/note/reject/95983
Search -- https://master.php.net/manage/user-notes.php