|
|
 |
imagecolorset (PHP 3, PHP 4 , PHP 5) imagecolorset -- 给指定调色板索引设定颜色 说明bool imagecolorset ( resource image, int index, int red, int green, int blue)
本函数将调色板中指定的索引设定为指定的颜色。对于在调色板图像中创建类似区域填充(flood-fill)的效果很有用,免去了真的去填充的开销。
参见 imagecolorat()。
olivier at moostik dot net
12-Jul-2001 08:49
This function change colors of an image with ranges 0>100 for each
primary color:
int ImageSelectiveColor (int im, int red, int
green, int blue)
im is image pointer
red, green and blue are
ranges 0->100
function
ImageSelectiveColor($im,$red,$green,$blue)
{
for($i=0;$i<imagecolorstotal($im);$i++)
{
$col=ImageColorsForIndex($im,$i);
$red_set=$red/100*$col['red'];
$green_set=$green/100*$col['green'];
$blue_set=$blue/100*$col['blue'];
if($red_set>255)$red_set=255;
if($green_set>255)$green_set=255;
if($blue_set>255)$blue_set=255;
imagecolorset($im,$i,$red_set,$green_set,$blue_set);
}
return $im;
}
| |