现在的位置: 首页 > 综合 > 正文

三原色光模式(RGB color model)的颜色融合,C#代码

2013年10月18日 ⁄ 综合 ⁄ 共 428字 ⁄ 字号 评论关闭
        /// <summary>
        /// 三原色光模式(RGB color model)的颜色融合,例如:green + red = yellow,yellow + blue = white
        /// </summary>
        /// <param name="c1">颜色1</param>
        /// <param name="c2">颜色2</param>
        /// <returns>融合后的颜色color_mixing</returns>
        private Color ColorMixing( Color c1,Color c2 )
        {
            int r = Math.Min(c1.R + c2.R, 255);
            int g = Math.Min(c1.G + c2.G, 255);
            int b = Math.Min(c1.B + c2.B, 255);
            Color color_mixing = Color.FromArgb(Convert.ToByte(r), Convert.ToByte(g), Convert.ToByte(b));
            return color_mixing;
        }

抱歉!评论已关闭.