public void SetModulateColor(sd.Color color) { //white is really no color at all if (color.ToArgb() == sd.Color.White.ToArgb()) { CurrentImageAttributes.ClearColorMatrix(ColorAdjustType.Bitmap); return; } float r = color.R / 255.0f; float g = color.G / 255.0f; float b = color.B / 255.0f; float a = color.A / 255.0f; float[][] colorMatrixElements = { new float[] {r, 0, 0, 0, 0}, new float[] {0, g, 0, 0, 0}, new float[] {0, 0, b, 0, 0}, new float[] {0, 0, 0, a, 0}, new float[] {0, 0, 0, 0, 1}}; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements); CurrentImageAttributes.SetColorMatrix(colorMatrix,ColorMatrixFlag.Default, ColorAdjustType.Bitmap); }
public void SetClearColor(sd.Color color) { _clearColor = color.ToArgb(); }