public Bitmap BuildTile(Color color) { HSV clr = new HSV(color); Bitmap src = GetSource(); Bitmap bmp = new Bitmap(src.Width, src.Height); for (int x = 0; x < bmp.Width; x++) { for (int y = 0; y < bmp.Height; y++) { Color original = src.GetPixel(x, y); Color altered = Color.FromArgb(0, 255, 255, 255); HSV orighsv = new HSV(original); Color origrgb = orighsv.Color; origrgb = Color.FromArgb(original.A, origrgb.R, origrgb.G, origrgb.B); if (!origrgb.Equals(altered)) { orighsv.Hue = clr.Hue; //orighsv.Saturation = clr.Saturation; //orighsv.Value = clr.Value; altered = orighsv.Color; altered = Color.FromArgb(original.A, altered.R, altered.G, altered.B); } bmp.SetPixel(x, y, altered); } } src.Dispose(); return bmp; }
public static Color FromHsv(int h, int s, int v) { HSV hsv = new HSV(h, s, v); return hsv.Color; }