I would like to darken an existing color for use in a gradient brush. Could somebody tell me how to do this please?
C#, .net 2.0, GDI+
Color AdjustBrightness(Color c1, float factor)
{
float r = ((c1.R * factor) > 255) ? 255 : (c1.R * factor);
float g = ((c1.G * factor) > 255) ? 255 : (c1.G * factor);
float b = ((c1.B * factor) > 255) ? 255 : (c1.B * factor);
Color c = Color.FromArgb(c1.A,(int)r, (int)g, (int)b);
return c ;
}