好吧,我發現這個很酷的代碼,我無法使用它。你看......我們要輸入的圖像 ,我能做到這一點,但我們還需要輸入顏色,我不知道該怎麼做...如何在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