public override ColorBgra Apply(ColorBgra color) { byte value = (byte)(Math.Abs(color.GetBrightness() - FilterColor.GetBrightness()) * 255); if (Grayscale) { if (!Invert) { value = (byte)(255 - value); } return(ColorBgra.FromBgr(value, value, value)); } return(value < Tolerance ? TransparentColor : OpaqueColor); }