note 72971 added to function.imageantialias

From: Date: Tue, 06 Feb 2007 11:13:17 +0000
Subject: note 72971 added to function.imageantialias
Groups: php.notes 
Request: Send a blank email to php-notes+get-122913@lists.php.net to get a copy of this message
If you can't be bothered creating (or searching for) a full screen antialias function. You can actually cheat (well a bit of a dirty inefficient hack really!!) and perform a fake antialias on an image by using 'imagecopyresampled'... first create your source image twice the size of what you really want. Then use 'imagecopyresampled' to shrink it to half the size, the function automatically interpolates pixels to create an antialias effect! I've used this in a pie chart function and it works brilliantly, not as slow as I thought it might be! the rough code below should give you the idea... <?php $realWidth = 500; $realHeight = 500; $srcWidth = $realWidth * 2; $srcHeight = $realHeight * 2; // create the larger source image $srcImage = imagecreatetruecolor($srcWidth,$srcHeight); // create the real/final image $destImage = imagecreatetruecolor($realWidth,$realHeight); // now do whatever you want to draw in the source image // blah.... // now the picture is finished, do the shrink... imagecopyresampled($destImage,$srcImage,0,0,0,0, $realWidth,$realHeight,$srcWidth,$srcHeight); // now just do whatever you want with '$destImage' (e.g. display or output to file!) ?> ---- Server IP: 61.129.78.119 Probable Submitter: 194.176.105.35 (proxied: 10.135.64.4) ---- Manual Page -- http://www.php.net/manual/en/function.imageantialias.php Edit -- https://master.php.net/note/edit/72971 Del: integrated -- https://master.php.net/note/delete/72971/integrated Del: useless -- https://master.php.net/note/delete/72971/useless Del: bad code -- https://master.php.net/note/delete/72971/bad+code Del: spam -- https://master.php.net/note/delete/72971/spam Del: non-english -- https://master.php.net/note/delete/72971/non-english Del: in docs -- https://master.php.net/note/delete/72971/in+docs Del: other reasons-- https://master.php.net/note/delete/72971 Reject -- https://master.php.net/note/reject/72971 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#122913) next »