mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Nodes - Added more HSV and HSL nodes
This commit is contained in:
parent
a1086df41a
commit
0200839a26
@ -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()
|
||||||
|
|||||||
31
src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs
Normal file
31
src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs
Normal 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
|
||||||
|
}
|
||||||
36
src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs
Normal file
36
src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs
Normal 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
|
||||||
|
}
|
||||||
36
src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs
Normal file
36
src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs
Normal 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
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user