note 97776 added to function.imagesetpixel
| From: | mailATkkapsnerDOTde at osu1 dot php dot net | Date: | Fri, 07 May 2010 11:04:21 +0000 |
| Subject: | note 97776 added to function.imagesetpixel | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169044@lists.php.net to get a copy of this message | ||
It IS posible to "delete" pixels from an image in PHP natively - the key-function is
imageAlphaBlending:
<?php
$image = imageCreateTrueColor(101, 101);
imageSaveAlpha($image, true);
# draw a red cycle with alpha blending
$red = imageColorAllocateAlpha($image, 255, 0, 0, 30);
imageFilledEllipse($image, 50, 50, 100, 100, $red);
# disable alpha blending for deletion
imageAlphaBlending($image, false);
# paint with a complete opaque color
$trans = imageColorAllocateAlpha($image, 0, 0, 0, 127);
# you can clear every shape you like
imageFilledRectangle($image, 30, 30, 70, 70, $trans);
# enable alpha blending again
imageAlphaBlending($image, true);
# draw a green rectangle with alpha blending
$green = imageColorAllocateAlpha($image, 0, 255, 0, 40);
imageFilledRectangle($image, 40, 20, 90, 80, $green);
header("Content-Type: image/png");
imagePNG($image);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 138.246.7.187
----
Manual Page -- http://www.php.net/manual/en/function.imagesetpixel.php
Edit -- https://master.php.net/note/edit/97776
Del: integrated -- https://master.php.net/note/delete/97776/integrated
Del: useless -- https://master.php.net/note/delete/97776/useless
Del: bad code -- https://master.php.net/note/delete/97776/bad+code
Del: spam -- https://master.php.net/note/delete/97776/spam
Del: non-english -- https://master.php.net/note/delete/97776/non-english
Del: in docs -- https://master.php.net/note/delete/97776/in+docs
Del: other reasons-- https://master.php.net/note/delete/97776
Reject -- https://master.php.net/note/reject/97776
Search -- https://master.php.net/manage/user-notes.php