note 71181 added to ref.image

From: Date: Wed, 15 Nov 2006 11:26:07 +0000
Subject: note 71181 added to ref.image
Groups: php.notes 
Request: Send a blank email to php-notes+get-119747@lists.php.net to get a copy of this message
function chromagradient(&$image, $startgradient, $endgradient, $chromacolor) { $testcolor=imagecolorallocate($image,30,50,10); $width=imagesx($image); $height=imagesy($image); $endindex=imagecolorsforindex($image,$endgradient); $startindex=imagecolorsforindex($image,$startgradient); $reddiff=$startindex['red']-$endindex['red']; $greendiff=$startindex['green']-$endindex['green']; $bluediff=$startindex['blue']-$endindex['blue']; $found=false; $y=0; while ((!$found) && ($y<$height)) { $x=0; while(($x<$width) && (!$found)) { $col=imagecolorat($image,$x,$y); if ($col==$chromacolor) { $startpoint=$y; $found=true; break; } $x++; } $y++; } $found=false; $y=$height; while ((!$found) && ($y>0)) { for ($x=0;$x<$width;$x++) { $col=imagecolorat($image,$x,$y); if ($col==$chromacolor) { $endpoint=$y; $found=true; break; } } $y--; } $gheight=$endpoint-$startpoint; for ($x=0;$x<$width;$x++) { for ($y=$startpoint;$y<$endpoint;$y++) { $newblue=$startindex['blue'] - floor(($y-$startpoint)*$bluediff/($gheight)); $newgreen=$startindex['green'] - floor(($y-$startpoint)*$greendiff/($gheight)); $newred=$startindex['red'] - floor(($y-$startpoint)*$reddiff/($gheight)); $replacementcol=imagecolorallocate($image, $newred, $newgreen, $newblue); $col=imagecolorat($image,$x,$y); if ($col==$chromacolor) { imagesetpixel($image,$x,$y,$replacementcol); } } } } ---- Server IP: 66.163.161.117 Probable Submitter: 168.209.98.43 (proxied: 196.36.199.4) ---- Manual Page -- http://www.php.net/manual/en/ref.image.php Edit -- https://master.php.net/note/edit/71181 Del: integrated -- https://master.php.net/note/delete/71181/integrated Del: useless -- https://master.php.net/note/delete/71181/useless Del: bad code -- https://master.php.net/note/delete/71181/bad+code Del: spam -- https://master.php.net/note/delete/71181/spam Del: non-english -- https://master.php.net/note/delete/71181/non-english Del: in docs -- https://master.php.net/note/delete/71181/in+docs Del: other reasons-- https://master.php.net/note/delete/71181 Reject -- https://master.php.net/note/reject/71181 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119747) next »