好吧,我发现这个很酷的代码,我无法使用它。你看......我们要输入的图像 ,我能做到这一点,但我们还需要输入颜色,我不知道该怎么做...如何在C#中使用Color []颜色?
public static Bitmap Colorize(Bitmap Image, Color[] Colors)
{
if (Colors.Length < 256)
return null;
Bitmap TempBitmap = new Bitmap(Image.Width, Image.Height);
for (int x = 0; x < Image.Width; ++x)
{
for (int y = 0; y < Image.Height; ++y)
{
int ColorUsing = Image.GetPixel(x, y).R;
TempBitmap.SetPixel(x, y, Colors[ColorUsing]);
}
}
return TempBitmap;
}
想知道这段代码应该做什么很有趣。 –
@Etienne:难道不明显吗?它做了“着色”。 :D但是,严重的是,它看起来像使用不同的调色板将一些图像重新绘制成新图像。 –
@Cody:你在说什么? – BoltClock