/// <summary>
/// Blends the specified colors onto "main", according to the blend pattern specified by "blend"
/// Blend contains either (255,255,0) for colors[0]; (255,0,0) for colors [1]; (0,255,0) for colors[2]; (0,0,255) for colors[3]; or Transparent for nothing
/// </summary>
private static Bitmap BlendPixels(Bitmap main, Bitmap blend, int[] colors)
{
Color c1 = OutfiterManager.GetColor(colors[0]);
Color c2 = OutfiterManager.GetColor(colors[1]);
Color c3 = OutfiterManager.GetColor(colors[2]);
Color c4 = OutfiterManager.GetColor(colors[3]);
for (int x = 0; x < main.Width; x++)
{
for (int y = 0; y < main.Height; y++)
{
Color blendColor = blend.GetPixel(x, y);
Color resultColor = Color.Transparent;
if (blendColor.R == 255 && blendColor.G == 255 && blendColor.B == 0)
{
resultColor = c1;
}
else if (blendColor.R == 255 && blendColor.G == 0 && blendColor.B == 0)
{
resultColor = c2;
}
else if (blendColor.R == 0 && blendColor.G == 255 && blendColor.B == 0)
{
resultColor = c3;
}
else if (blendColor.R == 0 && blendColor.G == 0 && blendColor.B == 255)
{
resultColor = c4;
}
if (blendColor.A > 0)
{
Color mainColor = main.GetPixel(x, y);
main.SetPixel(x, y, Color.FromArgb(
(byte)((((double)mainColor.R / 255.0)) * resultColor.R),
(byte)((((double)mainColor.G / 255.0)) * resultColor.G),
(byte)((((double)mainColor.B / 255.0)) * resultColor.B)));
}
}
}
return(main);
}