Browse Source

Improved naming in Combine and Separate Color

CPKreuz 11 months ago
parent
commit
940798d49d

+ 24 - 15
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CombineSeparate/CombineColorNode.cs

@@ -13,11 +13,20 @@ public class CombineColorNode : Node
 
     public InputProperty<CombineSeparateColorMode> Mode { get; }
 
-    public FuncInputProperty<Float1> R { get; }
+    /// <summary>
+    /// Represents either Red 'R' or Hue 'H' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncInputProperty<Float1> V1 { get; }
 
-    public FuncInputProperty<Float1> G { get; }
+    /// <summary>
+    /// Represents either Green 'G' or Saturation 'S' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncInputProperty<Float1> V2 { get; }
 
-    public FuncInputProperty<Float1> B { get; }
+    /// <summary>
+    /// Represents either Blue 'B', Value 'V' or Lightness 'L' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncInputProperty<Float1> V3 { get; }
 
     public FuncInputProperty<Float1> A { get; }
 
@@ -26,9 +35,9 @@ public class CombineColorNode : Node
         Color = CreateFuncOutput(nameof(Color), "COLOR", GetColor);
         Mode = CreateInput("Mode", "MODE", CombineSeparateColorMode.RGB);
 
-        R = CreateFuncInput<Float1>("R", "R", 0d);
-        G = CreateFuncInput<Float1>("G", "G", 0d);
-        B = CreateFuncInput<Float1>("B", "B", 0d);
+        V1 = CreateFuncInput<Float1>("R", "R", 0d);
+        V2 = CreateFuncInput<Float1>("G", "G", 0d);
+        V3 = CreateFuncInput<Float1>("B", "B", 0d);
         A = CreateFuncInput<Float1>("A", "A", 0d);
     }
 
@@ -42,9 +51,9 @@ public class CombineColorNode : Node
 
     private Half4 GetRgb(FuncContext ctx)
     {
-        var r = ctx.GetValue(R);
-        var g = ctx.GetValue(G);
-        var b = ctx.GetValue(B);
+        var r = ctx.GetValue(V1);
+        var g = ctx.GetValue(V2);
+        var b = ctx.GetValue(V3);
         var a = ctx.GetValue(A);
 
         return ctx.NewHalf4(r, g, b, a); 
@@ -52,9 +61,9 @@ public class CombineColorNode : Node
 
     private Half4 GetHsv(FuncContext ctx)
     {
-        var h = ctx.GetValue(R);
-        var s = ctx.GetValue(G);
-        var v = ctx.GetValue(B);
+        var h = ctx.GetValue(V1);
+        var s = ctx.GetValue(V2);
+        var v = ctx.GetValue(V3);
         var a = ctx.GetValue(A);
 
         return ctx.HsvaToRgba(h, s, v, a);
@@ -62,9 +71,9 @@ public class CombineColorNode : Node
     
     private Half4 GetHsl(FuncContext ctx)
     {
-        var h = ctx.GetValue(R);
-        var s = ctx.GetValue(G);
-        var l = ctx.GetValue(B);
+        var h = ctx.GetValue(V1);
+        var s = ctx.GetValue(V2);
+        var l = ctx.GetValue(V3);
         var a = ctx.GetValue(A);
 
         return ctx.HslaToRgba(h, s, l, a);

+ 16 - 7
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CombineSeparate/SeparateColorNode.cs

@@ -16,20 +16,29 @@ public class SeparateColorNode : Node
     
     public InputProperty<CombineSeparateColorMode> Mode { get; }
 
-    public FuncOutputProperty<Float1> R { get; }
+    /// <summary>
+    /// Represents either Red 'R' or Hue 'H' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncOutputProperty<Float1> V1 { get; }
     
-    public FuncOutputProperty<Float1> G { get; }
+    /// <summary>
+    /// Represents either Green 'G' or Saturation 'S' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncOutputProperty<Float1> V2 { get; }
     
-    public FuncOutputProperty<Float1> B { get; }
+    /// <summary>
+    /// Represents either Blue 'B', Value 'V' or Lightness 'L' depending on <see cref="Mode"/>
+    /// </summary>
+    public FuncOutputProperty<Float1> V3 { get; }
     
     public FuncOutputProperty<Float1> A { get; }
     
     public SeparateColorNode()
     {
-        R = CreateFuncOutput<Float1>(nameof(R), "R", ctx => GetColor(ctx).R);
-        G = CreateFuncOutput<Float1>(nameof(G), "G", ctx => GetColor(ctx).G);
-        B = CreateFuncOutput<Float1>(nameof(B), "B", ctx => GetColor(ctx).B);
-        A = CreateFuncOutput<Float1>(nameof(A), "A", ctx => GetColor(ctx).A);
+        V1 = CreateFuncOutput<Float1>("R", "R", ctx => GetColor(ctx).R);
+        V2 = CreateFuncOutput<Float1>("G", "G", ctx => GetColor(ctx).G);
+        V3 = CreateFuncOutput<Float1>("B", "B", ctx => GetColor(ctx).B);
+        A = CreateFuncOutput<Float1>("A", "A", ctx => GetColor(ctx).A);
         Mode = CreateInput("Mode", "MODE", CombineSeparateColorMode.RGB);
         Color = CreateFuncInput<Half4>(nameof(Color), "COLOR", new Color());
     }