/// <summary> /// Converts translucent colors to a greyscale equivalent. /// </summary> private static Color ConvertPartiallyClearToGrey(Color oldColor) { //25% solid => 75% gray return(ConvertColors.HSVToColor(0, 0, (255 - oldColor.A) / 255f)); }
public void GenerateGradiantSamples() { List <Color> colors = new List <Color>() { //100% saturation, 100% value ConvertColors.HSVToColor(0, 1, 1), //red ConvertColors.HSVToColor(30, 1, 1), //orange ConvertColors.HSVToColor(60, 1, 1), //yellow ConvertColors.HSVToColor(90, 1, 1), //green ConvertColors.HSVToColor(120, 1, 1), //green also ConvertColors.HSVToColor(150, 1, 1), //aqua ConvertColors.HSVToColor(180, 1, 1), //cyan ConvertColors.HSVToColor(210, 1, 1), //blue ConvertColors.HSVToColor(240, 1, 1), //blue darker ConvertColors.HSVToColor(270, 1, 1), //purple ConvertColors.HSVToColor(300, 1, 1), //magenta ConvertColors.HSVToColor(330, 1, 1), //fushia //100% saturation, 50% value ConvertColors.HSVToColor(0, 1, 0.5f), //red ConvertColors.HSVToColor(30, 1, 0.5f), //orange ConvertColors.HSVToColor(60, 1, 0.5f), //yellow ConvertColors.HSVToColor(90, 1, 0.5f), //green ConvertColors.HSVToColor(120, 1, 0.5f), //green also ConvertColors.HSVToColor(150, 1, 0.5f), //aqua ConvertColors.HSVToColor(180, 1, 0.5f), //cyan ConvertColors.HSVToColor(210, 1, 0.5f), //blue ConvertColors.HSVToColor(240, 1, 0.5f), //blue darker ConvertColors.HSVToColor(270, 1, 0.5f), //purple ConvertColors.HSVToColor(300, 1, 0.5f), //magenta ConvertColors.HSVToColor(330, 1, 0.5f), //fushia //100% saturation, 25% value ConvertColors.HSVToColor(0, 1, 0.25f), //red ConvertColors.HSVToColor(30, 1, 0.25f), //orange ConvertColors.HSVToColor(60, 1, 0.25f), //yellow ConvertColors.HSVToColor(90, 1, 0.25f), //green ConvertColors.HSVToColor(120, 1, 0.25f), //green also ConvertColors.HSVToColor(150, 1, 0.25f), //aqua ConvertColors.HSVToColor(180, 1, 0.25f), //cyan ConvertColors.HSVToColor(210, 1, 0.25f), //blue ConvertColors.HSVToColor(240, 1, 0.25f), //blue darker ConvertColors.HSVToColor(270, 1, 0.25f), //purple ConvertColors.HSVToColor(300, 1, 0.25f), //magenta ConvertColors.HSVToColor(330, 1, 0.25f), //fushia //50% saturation, 100% value ConvertColors.HSVToColor(0, 0.5f, 1), //red ConvertColors.HSVToColor(30, 0.5f, 1), //orange ConvertColors.HSVToColor(60, 0.5f, 1), //yellow ConvertColors.HSVToColor(90, 0.5f, 1), //green ConvertColors.HSVToColor(120, 0.5f, 1), //green also ConvertColors.HSVToColor(150, 0.5f, 1), //aqua ConvertColors.HSVToColor(180, 0.5f, 1), //cyan ConvertColors.HSVToColor(210, 0.5f, 1), //blue ConvertColors.HSVToColor(240, 0.5f, 1), //blue darker ConvertColors.HSVToColor(270, 0.5f, 1), //purple ConvertColors.HSVToColor(300, 0.5f, 1), //magenta ConvertColors.HSVToColor(330, 0.5f, 1), //fushia //50% saturation, 50% value ConvertColors.HSVToColor(0, 0.5f, 0.5f), //red ConvertColors.HSVToColor(30, 0.5f, 0.5f), //orange ConvertColors.HSVToColor(60, 0.5f, 0.5f), //yellow ConvertColors.HSVToColor(90, 0.5f, 0.5f), //green ConvertColors.HSVToColor(120, 0.5f, 0.5f), //green also ConvertColors.HSVToColor(150, 0.5f, 0.5f), //aqua ConvertColors.HSVToColor(180, 0.5f, 0.5f), //cyan ConvertColors.HSVToColor(210, 0.5f, 0.5f), //blue ConvertColors.HSVToColor(240, 0.5f, 0.5f), //blue darker ConvertColors.HSVToColor(270, 0.5f, 0.5f), //purple ConvertColors.HSVToColor(300, 0.5f, 0.5f), //magenta ConvertColors.HSVToColor(330, 0.5f, 0.5f), //fushia //50% saturation, 50% value ConvertColors.HSVToColor(0, 0.5f, 0.25f), //red ConvertColors.HSVToColor(30, 0.5f, 0.25f), //orange ConvertColors.HSVToColor(60, 0.5f, 0.25f), //yellow ConvertColors.HSVToColor(90, 0.5f, 0.25f), //green ConvertColors.HSVToColor(120, 0.5f, 0.25f), //green also ConvertColors.HSVToColor(150, 0.5f, 0.25f), //aqua ConvertColors.HSVToColor(180, 0.5f, 0.25f), //cyan ConvertColors.HSVToColor(210, 0.5f, 0.25f), //blue ConvertColors.HSVToColor(240, 0.5f, 0.25f), //blue darker ConvertColors.HSVToColor(270, 0.5f, 0.25f), //purple ConvertColors.HSVToColor(300, 0.5f, 0.25f), //magenta ConvertColors.HSVToColor(330, 0.5f, 0.25f), //fushia //25% saturation, 100% value ConvertColors.HSVToColor(0, 0.25f, 1), //red ConvertColors.HSVToColor(30, 0.25f, 1), //orange ConvertColors.HSVToColor(60, 0.25f, 1), //yellow ConvertColors.HSVToColor(90, 0.25f, 1), //green ConvertColors.HSVToColor(120, 0.25f, 1), //green also ConvertColors.HSVToColor(150, 0.25f, 1), //aqua ConvertColors.HSVToColor(180, 0.25f, 1), //cyan ConvertColors.HSVToColor(210, 0.25f, 1), //blue ConvertColors.HSVToColor(240, 0.25f, 1), //blue darker ConvertColors.HSVToColor(270, 0.25f, 1), //purple ConvertColors.HSVToColor(300, 0.25f, 1), //magenta ConvertColors.HSVToColor(330, 0.25f, 1), //fushia //25% saturation, 75% value ConvertColors.HSVToColor(0, 0.25f, 0.75f), //red ConvertColors.HSVToColor(30, 0.25f, 0.75f), //orange ConvertColors.HSVToColor(60, 0.25f, 0.75f), //yellow ConvertColors.HSVToColor(90, 0.25f, 0.75f), //green ConvertColors.HSVToColor(120, 0.25f, 0.75f), //green also ConvertColors.HSVToColor(150, 0.25f, 0.75f), //aqua ConvertColors.HSVToColor(180, 0.25f, 0.75f), //cyan ConvertColors.HSVToColor(210, 0.25f, 0.75f), //blue ConvertColors.HSVToColor(240, 0.25f, 0.75f), //blue darker ConvertColors.HSVToColor(270, 0.25f, 0.75f), //purple ConvertColors.HSVToColor(300, 0.25f, 0.75f), //magenta ConvertColors.HSVToColor(330, 0.25f, 0.75f), //fushia //25% saturation, 50% value ConvertColors.HSVToColor(0, 0.25f, 0.5f), //red ConvertColors.HSVToColor(30, 0.25f, 0.5f), //orange ConvertColors.HSVToColor(60, 0.25f, 0.5f), //yellow ConvertColors.HSVToColor(90, 0.25f, 0.5f), //green ConvertColors.HSVToColor(120, 0.25f, 0.5f), //green also ConvertColors.HSVToColor(150, 0.25f, 0.5f), //aqua ConvertColors.HSVToColor(180, 0.25f, 0.5f), //cyan ConvertColors.HSVToColor(210, 0.25f, 0.5f), //blue ConvertColors.HSVToColor(240, 0.25f, 0.5f), //blue darker ConvertColors.HSVToColor(270, 0.25f, 0.5f), //purple ConvertColors.HSVToColor(300, 0.25f, 0.5f), //magenta ConvertColors.HSVToColor(330, 0.25f, 0.5f), //fushia //25% saturation, 25% value ConvertColors.HSVToColor(0, 0.25f, 0.25f), //red ConvertColors.HSVToColor(30, 0.25f, 0.25f), //orange ConvertColors.HSVToColor(60, 0.25f, 0.25f), //yellow ConvertColors.HSVToColor(90, 0.25f, 0.25f), //green ConvertColors.HSVToColor(120, 0.25f, 0.25f), //green also ConvertColors.HSVToColor(150, 0.25f, 0.25f), //aqua ConvertColors.HSVToColor(180, 0.25f, 0.25f), //cyan ConvertColors.HSVToColor(210, 0.25f, 0.25f), //blue ConvertColors.HSVToColor(240, 0.25f, 0.25f), //blue darker ConvertColors.HSVToColor(270, 0.25f, 0.25f), //purple ConvertColors.HSVToColor(300, 0.25f, 0.25f), //magenta ConvertColors.HSVToColor(330, 0.25f, 0.25f), //fushia }; int width = 50; foreach (Color color in colors) { Bitmap revertBitmap = GetRevertedGradient(width, color); Bitmap colorBitmap = GetColoredGradient(width, color); Bitmap grayBitmap = GetGrayscaleGradient(width); Bitmap bitmap = new Bitmap(width * 3, revertBitmap.Height); using (Graphics graphics = Graphics.FromImage(bitmap)) { graphics.DrawImage(revertBitmap, new Point(0, 0)); graphics.DrawImage(colorBitmap, new Point(width, 0)); graphics.DrawImage(grayBitmap, new Point(width * 2, 0)); } bitmap.Save(String.Format("GradientSamples/sample_{0:000}_{1:000}_{2:000}.png", color.R, color.G, color.B)); } }