TintEffect
Applies a tint to an image.
using Windows.Win32;
using Windows.Win32.Graphics.GdiPlus;
namespace System.Drawing.Imaging.Effects
{
public class TintEffect : Effect
{
private readonly TintParams _tintParams;
public int Hue {
get {
if (_tintParams.hue >= 0)
return _tintParams.hue;
return _tintParams.hue + 360;
}
}
public int Amount => _tintParams.amount;
public TintEffect(Color color, int amount)
: this((int)color.GetHue(), (!color.IsEmpty && !(color == Color.White)) ? amount : 0)
{
}
public TintEffect(int hue, int amount)
: base(PInvoke.TintEffectGuid)
{
if ((hue < 0 || hue > 360) ? true : false)
throw new ArgumentOutOfRangeException("hue");
if (hue > 180)
hue -= 360;
_tintParams = new TintParams {
hue = hue,
amount = amount
};
SetParameters(ref _tintParams);
}
}
}