/// <summary> /// Converts an SwiftBitmap to sepia tone /// </summary> /// <param name="Image">Image to change</param> /// <returns>A SwiftBitmap object of the sepia tone image</returns> public static SwiftBitmap SepiaTone(this SwiftBitmap Image) { Contract.Requires<ArgumentNullException>(Image != null, "Image"); return Image.ApplyColorMatrix(new ColorMatrix(new float[][]{ new float[] {.393f, .349f, .272f, 0, 0}, new float[] {.769f, .686f, .534f, 0, 0}, new float[] {.189f, .168f, .131f, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} })); }
/// <summary> /// Converts an SwiftBitmap to black and white /// </summary> /// <param name="Image">Image to change</param> /// <returns>A SwiftBitmap object of the black and white image</returns> public static SwiftBitmap BlackAndWhite(this SwiftBitmap Image) { Contract.Requires<ArgumentNullException>(Image != null, "Image"); return Image.ApplyColorMatrix(new ColorMatrix(new float[][]{ new float[] {.3f, .3f, .3f, 0, 0}, new float[] {.59f, .59f, .59f, 0, 0}, new float[] {.11f, .11f, .11f, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} })); }
/// <summary> /// Gets the Red filter for an image /// </summary> /// <param name="Image">Image to change</param> /// <returns>A SwiftBitmap image</returns> public static SwiftBitmap RedFilter(this SwiftBitmap Image) { Contract.Requires<ArgumentNullException>(Image != null, "Image"); return Image.ApplyColorMatrix(new ColorMatrix(new float[][]{ new float[] {1, 0, 0, 0, 0}, new float[] {0, 0, 0, 0, 0}, new float[] {0, 0, 0, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} })); }
/// <summary> /// Adjusts the brightness /// </summary> /// <param name="Image">Image to change</param> /// <param name="Value">The value.</param> /// <returns>Modified Image object</returns> public static SwiftBitmap AdjustBrightness(this SwiftBitmap Image, int Value = 0) { Contract.Requires<ArgumentNullException>(Image != null, "Image"); float FinalValue = (float)Value / 255.0f; return Image.ApplyColorMatrix(new ColorMatrix(new float[][]{ new float[] {1, 0, 0, 0, 0}, new float[] {0, 1, 0, 0, 0}, new float[] {0, 0, 1, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {FinalValue, FinalValue, FinalValue, 1, 1} })); }