コード例 #1
0
ファイル: GammaRamp.cs プロジェクト: Soinou/MeliMelo
        /// <summary>
        /// Creates a new GammaRamp filled with the given temperature
        /// </summary>
        /// <param name="temperature">Temperature</param>
        /// <returns>GammaRamp</returns>
        public static GammaRamp Create(int temperature)
        {
            var alpha = (temperature % 100) / 100.0;
            var temp_index = ((temperature - 1000) / 100) * 3;
            var white_point = InterpolateColor(alpha, temp_index, temp_index + 3);

            var ramp = new GammaRamp();

            ramp.red = new ushort[256];
            ramp.green = new ushort[256];
            ramp.blue = new ushort[256];

            for (int i = 0; i < kGammaRampSize; i++)
            {
                ushort value = (ushort)(((double)i) / kGammaRampSize * 65536);

                ramp.red[i] = GetValue(value, white_point[0]);
                ramp.green[i] = GetValue(value, white_point[1]);
                ramp.blue[i] = GetValue(value, white_point[2]);
            }

            return ramp;
        }
コード例 #2
0
ファイル: NativeMethods.cs プロジェクト: Soinou/MeliMelo
 internal static extern bool SetDeviceGammaRamp(IntPtr hDC, ref GammaRamp lpRamp);