コード例 #1
0
        public void SetGamma(int gamma)
        {
            if (gamma <= 256 && gamma >= 1)
            {
                RAMP ramp = new RAMP();
                ramp.Red   = new ushort[256];
                ramp.Green = new ushort[256];
                ramp.Blue  = new ushort[256];
                for (int i = 1; i < 256; i++)
                {
                    int iArrayValue = i * (gamma + 128);

                    if (iArrayValue > 65535)
                    {
                        iArrayValue = 65535;
                    }
                    ramp.Red[i] = ramp.Blue[i] = ramp.Green[i] = (ushort)iArrayValue;
                }
                SetDeviceGammaRamp(GetDC(IntPtr.Zero), ref ramp);
            }
        }
コード例 #2
0
 public static extern bool SetDeviceGammaRamp(IntPtr hDC, ref RAMP lpRamp);