mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Added a data binding modifier that rotates the hue of a color
This commit is contained in:
parent
5b80c1e4fe
commit
b0928faccc
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using SkiaSharp;
|
||||||
|
|
||||||
|
namespace Artemis.Core.DefaultTypes
|
||||||
|
{
|
||||||
|
internal class SKColorRotateHueModifierType : DataBindingModifierType
|
||||||
|
{
|
||||||
|
public override IReadOnlyCollection<Type> CompatibleTypes => new List<Type> {typeof(SKColor)};
|
||||||
|
public override Type ParameterType => typeof(float);
|
||||||
|
|
||||||
|
public override string Name => "Rotate Hue by";
|
||||||
|
public override string Icon => "RotateRight";
|
||||||
|
public override string Description => "Rotates the hue of the color by the amount in degrees";
|
||||||
|
|
||||||
|
public override object Apply(object currentValue, object parameterValue)
|
||||||
|
{
|
||||||
|
((SKColor) currentValue).ToHsl(out var h, out var s, out var l);
|
||||||
|
|
||||||
|
h += (float)parameterValue;
|
||||||
|
|
||||||
|
var a = SKColor.FromHsl(h % 360, s, l);
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -74,6 +74,7 @@ namespace Artemis.Core.Services
|
|||||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorSumModifierType());
|
RegisterModifierType(Constants.CorePluginInfo, new SKColorSumModifierType());
|
||||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorBrightenModifierType());
|
RegisterModifierType(Constants.CorePluginInfo, new SKColorBrightenModifierType());
|
||||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorDarkenModifierType());
|
RegisterModifierType(Constants.CorePluginInfo, new SKColorDarkenModifierType());
|
||||||
|
RegisterModifierType(Constants.CorePluginInfo, new SKColorRotateHueModifierType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user