CSharp examples for System.Drawing:Color Brightness
Change Color Brightness
using System.Text.RegularExpressions; using System.Linq; using System.Drawing; using System;/*from w ww.j a v a2s . c om*/ public class Main{ public static Color ChangeColorBrightness(Color color, float correctionFactor) { var red = (float)color.R; var green = (float)color.G; var blue = (float)color.B; if (correctionFactor < 0) { correctionFactor = 1 + correctionFactor; red *= correctionFactor; green *= correctionFactor; blue *= correctionFactor; } else { red = (255 - red) * correctionFactor + red; green = (255 - green) * correctionFactor + green; blue = (255 - blue) * correctionFactor + blue; } return Color.FromArgb(color.A, (int)red, (int)green, (int)blue); } }