note 98663 deleted from function.imagefilter by danbrown
| From: | danbrown@php.net | Date: | Tue, 29 Jun 2010 17:54:59 +0000 |
| Subject: | note 98663 deleted from function.imagefilter by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170559@lists.php.net to get a copy of this message | ||
Note Submitter: danilo_barbosa_1000 at yahoo dot com dot br
Reason: non-english
----
http://www.onbest.com.br/ oferece:
função Hue com suporte a '.gif' e outros suportados pela GD.
function hue($img,$r,$g,$b){
$w=imagesx($img);
$h=imagesy($img);
if(!imageistruecolor($this->img)){
$image=imagecreatetruecolor($w,$h); $color=imagecolorallocatealpha($image,255,255,255,127);
imagecolortransparent($image,$color);
imagefill($image,0,0,$color); imagecopyresampled($image,$img,0,0,0,0,$w,$h,$w,$h);
$img=$image;
}
$rgb=$r+$g+$b;
$col=array($r/$rgb,$b/$rgb,$g/$rgb);
for($x=0;$x<$w;$x++){
for($y=0;$y<$h;$y++){
$rgb=imagecolorat($img,$x,$y);
$r=($rgb>>16) & 0xFF;
$g=($rgb>>8) & 0xFF;
$b=$rgb & 0xFF; $newR=$r*$col[0]+$g*$col[1]+$b*$col[2];
$newG=$r*$col[2]+$g*$col[0]+$b*$col[1];
$newB=$r*$col[1]+$g*$col[2]+$b*$col[0];
imagesetpixel($img,$x,$y,imagecolorallocate($img,$newR,$newG,$newB));
}
}