超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<imagecolorresolvealphaimagecolorsforindex>
Last updated: Fri, 22 Jun 2007

imagecolorset

(PHP 3, PHP 4 , PHP 5)

imagecolorset -- 给指定调色板索引设定颜色

说明

bool imagecolorset ( resource image, int index, int red, int green, int blue)

本函数将调色板中指定的索引设定为指定的颜色。对于在调色板图像中创建类似区域填充(flood-fill)的效果很有用,免去了真的去填充的开销。

参见 imagecolorat()




add a note add a note User Contributed Notes
imagecolorset
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;

}

<imagecolorresolvealphaimagecolorsforindex>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22