note 45247 deleted from ref.image by tularis

From: Date: Sun, 29 Jun 2008 21:11:19 +0000
Subject: note 45247 deleted from ref.image by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140970@lists.php.net to get a copy of this message
Note Submitter: andreoli dot carlo at libero dot it ---- Here my compact gradient function (request few passage): function imagecolorgradient($img,$x1,$y1,$height,$width,$colA,$colB) { $varC1=($colA[1]-$colB[1])/$height; $varC2=($colA[2]-$colB[2])/$height; $varC3=($colA[3]-$colB[3])/$height; for ($i=0;$i<=$height;$i++) { $red=$colA[1]-floor($i*$varC1); $green=$colA[2]-floor($i*$varC2); $blue=$colA[3]-floor($i*$varC3); $col= ImageColorAllocate($img,$red,$green,$blue); ImageLine($img,$x1,$y1+$i,$x1+$width,$y1+$i,$col); } } even more compact mode: function imagecolorgradient($img,$x1,$y1,$height,$width,$colA,$colB) { $varC1=($colA[1]-$colB[1])/$height; $varC2=($colA[2]-$colB[2])/$height; $varC3=($colA[3]-$colB[3])/$height; for ($i=0;$i<=$height;$i++) { $col=ImageColorAllocate($img, $colA[1]-floor($i*$varC1), $colA[2]-floor($i*$varC2), $colA[3]-floor($i*$varC3)); ImageLine($img,$x1,$y1+$i,$x1+$width,$y1+$i,$col); } } $img ist the image handle, $x1 and $y1 are the start points, $height is the gradient height, $width the width, $colA and $colB are the first and second color ARRAYs.

« previous php.notes (#140970) next »