mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Merge pull request #475 from diogotr7/feature/modifier-hue
Added a data binding modifier that rotates the hue of a color
This commit is contained in:
commit
9e39a849e9
@ -0,0 +1,25 @@
|
||||
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 float h, out float s, out float l);
|
||||
|
||||
h += (float)parameterValue;
|
||||
|
||||
return SKColor.FromHsl(h % 360, s, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,6 +74,7 @@ namespace Artemis.Core.Services
|
||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorSumModifierType());
|
||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorBrightenModifierType());
|
||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorDarkenModifierType());
|
||||
RegisterModifierType(Constants.CorePluginInfo, new SKColorRotateHueModifierType());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user