/// <summary> /// Changes the image according to a gradient between 2 colors /// Black pixels will be replaced with dark color /// White pixels will be replaced with bright color /// Other pixels are replaced by their position on the gradient /// </summary> /// <param name="image">Image to modify</param> /// <param name="dark">Darkest color of the gradient</param> /// <param name="bright">Brightest color of the gradient</param> public static void GradientMap(this Bitmap image, Color dark, Color bright) { Func <Color, Color> gradientMap = (color => ColorExtension.GradientMap(color, dark, bright)); ForEachPixel(image, gradientMap); }
/// <summary> /// Changes brightness of the image /// </summary> /// <param name="image">Image to modify</param> /// <param name="delta">Between -255 and 255, if less, black, if more, white</param> public static void Brightness(this Bitmap image, int delta) { Func <Color, Color> brightness = (color => ColorExtension.Brightness(color, delta)); ForEachPixel(image, brightness); }