/// <summary> /// Set Gdi Ramp from floating-point input ramps. /// </summary> /// <param name="r">Gdi Ramp.</param> /// <param name="red">Red floating-point ramp.</param> /// <param name="green">Green floating-point ramp.</param> /// <param name="blue">Blue floating-point ramp.</param> private static void SetGdiRamp(IList<double> red, IList<double> green, IList<double> blue) { EGdi.RAMP r = new EGdi.RAMP(null); EVector.Map(r.Red, UInt16.MinValue, UInt16.MaxValue, red, 0, 1); EVector.Map(r.Green, UInt16.MinValue, UInt16.MaxValue, green, 0, 1); EVector.Map(r.Blue, UInt16.MinValue, UInt16.MaxValue, blue, 0, 1); EGdi.SetDeviceGammaRamp(EUser.GetDC(IntPtr.Zero), ref r); }
/// <summary> /// Get the current gamma ramp. /// </summary> private static void GetGdiRamp() { EGdi.RAMP r = new EGdi.RAMP(null); EGdi.GetDeviceGammaRamp(EUser.GetDC(IntPtr.Zero), ref r); IList<double> red = EVector.Map(null, 0, 1, r.Red, UInt16.MinValue, UInt16.MaxValue); IList<double> green = EVector.Map(null, 0, 1, r.Green, UInt16.MinValue, UInt16.MaxValue); IList<double> blue = EVector.Map(null, 0, 1, r.Blue, UInt16.MinValue, UInt16.MaxValue); Console.WriteLine("Red"); EVector.Print(red); Console.WriteLine("Green"); EVector.Print(green); Console.WriteLine("Blue"); EVector.Print(blue); }