今天调整了极化模式中红色转白色的方法,公式更简单粗暴:
//传入图片中每一个像素的r,g,b值
protected override void Adjust(ref byte BValue, ref byte GValue, ref byte RValue)
{
if (RValue < BValue || RValue < GValue || RValue == 0) { return ; }
rgb.SetRGB(ref RValue, ref GValue, ref BValue);
//if (rgb.SN == 0) { return ; } //无色面域返回
byte SP;
if (GValue > BValue)
{
SP = (byte)(RValue - GValue);
}
else
{
SP = (byte)(RValue - BValue);
}
if (numberN > 0) //Number是TRACKBAR传入的的数值,大于0表示向右移动
{
RValue += (byte)(SP * numberN / 255 * (255 - RValue) / 255);
GValue += (byte)(SP * numberN / 255 * (255 - GValue) / 255);
BValue += (byte)(SP * numberN / 255 * (255 - BValue) / 255);
}
else
{
rgb.Z -= (byte)( SP * numberN / 255 ); //高强模式
}
}
红色转换白色
最新推荐文章于 2019-07-13 04:32:27 发布