note 66448 added to function.imagecreatetruecolor

From: Date: Tue, 23 May 2006 01:28:03 +0000
Subject: note 66448 added to function.imagecreatetruecolor
Groups: php.notes 
Request: Send a blank email to php-notes+get-111843@lists.php.net to get a copy of this message
This is another approach to get an initially transparent truecolor canvas and in comparison to the one below it does not declare black to be transparent (which might be okay on indexed-color images and unless you want to draw in black) ... $im = imagecreatetruecolor( $w, $h ); imagealphablending( $im, false ); $col = imagecolorallocate( $im, 0, 0, 0, 127 ); imagefilledrectangle( $im, 0, 0, $w, $h, $col ); imagealphablending( $im, true ); Without disabling blending mode this would paint transparent rectangle over current background thus not changing anything. Nevertheless blending mode is required e.g. to get proper results from using imagettftext ... that's why it is enabled after filling, again. Don't miss to disable blending mode and enable savealpha prior to generating a PNG ... imagealphablending( $im, false ); imagesavealpha( $im, true ); imagepng( $im ); ---- Server IP: 212.124.37.9 Probable Submitter: 88.72.223.226 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.imagecreatetruecolor.php Edit -- http://master.php.net/note/edit/66448 Del: integrated -- http://master.php.net/note/delete/66448/integrated Del: useless -- http://master.php.net/note/delete/66448/useless Del: bad code -- http://master.php.net/note/delete/66448/bad+code Del: spam -- http://master.php.net/note/delete/66448/spam Del: non-english -- http://master.php.net/note/delete/66448/non-english Del: in docs -- http://master.php.net/note/delete/66448/in+docs Del: other reasons-- http://master.php.net/note/delete/66448 Reject -- http://master.php.net/note/reject/66448 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#111843) next »