1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Merge pull request #760 from Artemis-RGB/feature/hsv-hsl

Nodes - Added more HSV and HSL nodes
This commit is contained in:
RobertBeekman 2023-02-12 21:30:25 +01:00 committed by GitHub
commit 97d413183c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 1 deletions

View File

@ -3,7 +3,7 @@ using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color; namespace Artemis.VisualScripting.Nodes.Color;
[Node("HSL Color", "Creates a color from hue, saturation and lightness values", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))] [Node("HSL Color", "Creates a color from hue, saturation and lightness numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))]
public class HslSKColorNode : Node public class HslSKColorNode : Node
{ {
public HslSKColorNode() public HslSKColorNode()

View File

@ -0,0 +1,31 @@
using Artemis.Core;
using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color;
[Node("HSV Color", "Creates a color from hue, saturation and value numbers", "Color", InputType = typeof(Numeric), OutputType = typeof(SKColor))]
public class HsvSKColorNode : Node
{
public HsvSKColorNode()
{
H = CreateInputPin<Numeric>("H");
S = CreateInputPin<Numeric>("S");
V = CreateInputPin<Numeric>("V");
Output = CreateOutputPin<SKColor>();
}
public InputPin<Numeric> H { get; set; }
public InputPin<Numeric> S { get; set; }
public InputPin<Numeric> V { get; set; }
public OutputPin<SKColor> Output { get; }
#region Overrides of Node
/// <inheritdoc />
public override void Evaluate()
{
Output.Value = SKColor.FromHsv(H.Value, S.Value, V.Value);
}
#endregion
}

View File

@ -0,0 +1,36 @@
using Artemis.Core;
using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color;
[Node("Color to HSL", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))]
public class SkColorHsl : Node
{
public SkColorHsl()
{
Input = CreateInputPin<SKColor>();
H = CreateOutputPin<Numeric>("H");
S = CreateOutputPin<Numeric>("S");
L = CreateOutputPin<Numeric>("L");
}
public InputPin<SKColor> Input { get; }
public OutputPin<Numeric> H { get; }
public OutputPin<Numeric> S { get; }
public OutputPin<Numeric> L { get; }
#region Overrides of Node
/// <inheritdoc />
public override void Evaluate()
{
Input.Value.ToHsl(out float h, out float s, out float l);
H.Value = h;
S.Value = s;
L.Value = l;
}
#endregion
}

View File

@ -0,0 +1,36 @@
using Artemis.Core;
using SkiaSharp;
namespace Artemis.VisualScripting.Nodes.Color;
[Node("Color to Hsv", "Outputs H, S and L values from a color", "Color", InputType = typeof(SKColor), OutputType = typeof(Numeric))]
public class SkColorHsv : Node
{
public SkColorHsv()
{
Input = CreateInputPin<SKColor>();
H = CreateOutputPin<Numeric>("H");
S = CreateOutputPin<Numeric>("S");
V = CreateOutputPin<Numeric>("V");
}
public InputPin<SKColor> Input { get; }
public OutputPin<Numeric> H { get; }
public OutputPin<Numeric> S { get; }
public OutputPin<Numeric> V { get; }
#region Overrides of Node
/// <inheritdoc />
public override void Evaluate()
{
Input.Value.ToHsv(out float h, out float s, out float v);
H.Value = h;
S.Value = s;
V.Value = v;
}
#endregion
}