diff --git a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs index cba686c38..15ce66d84 100644 --- a/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs +++ b/src/Artemis.VisualScripting/Nodes/Color/HslSKColorNode.cs @@ -3,7 +3,7 @@ using SkiaSharp; 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 HslSKColorNode() diff --git a/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs new file mode 100644 index 000000000..2544ccec2 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/HsvSKColorNode.cs @@ -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("H"); + S = CreateInputPin("S"); + V = CreateInputPin("V"); + Output = CreateOutputPin(); + } + + public InputPin H { get; set; } + public InputPin S { get; set; } + public InputPin V { get; set; } + public OutputPin Output { get; } + + #region Overrides of Node + + /// + public override void Evaluate() + { + Output.Value = SKColor.FromHsv(H.Value, S.Value, V.Value); + } + + #endregion +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs new file mode 100644 index 000000000..aaa1c6e26 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsl.cs @@ -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(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + L = CreateOutputPin("L"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin L { get; } + + #region Overrides of Node + + /// + 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 +} \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs new file mode 100644 index 000000000..95a2dffb1 --- /dev/null +++ b/src/Artemis.VisualScripting/Nodes/Color/SkColorHsv.cs @@ -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(); + H = CreateOutputPin("H"); + S = CreateOutputPin("S"); + V = CreateOutputPin("V"); + } + + public InputPin Input { get; } + public OutputPin H { get; } + public OutputPin S { get; } + public OutputPin V { get; } + + #region Overrides of Node + + /// + 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 +} \ No newline at end of file