diff options
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs index 9ea714d4e..f7bf43ee0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/VisualOffsetModel.cs @@ -188,9 +188,9 @@ namespace Tango.PPC.Jobs.Models } } - private double LightnessOffset { get; set; } - private double ChromaOffset { get; set; } - private double HueOffset { get; set; } + public double LightnessOffset { get; set; } + public double ChromaOffset { get; set; } + public double HueOffset { get; set; } @@ -219,6 +219,10 @@ namespace Tango.PPC.Jobs.Models { //Lch lch = new Lch() { L = L, C = C, H = H }; //IRgb rgb = lch.ToRgb(); + if(LightnessOffset == 0 && ChromaOffset == 0 && HueOffset == 0) + { + return SourceColorBrush; + } Lab lab = new Lab(L, A, B); Rgb rgb = new Rgb(lab.ToRgb()); return new SolidColorBrush() { Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B) }; @@ -240,13 +244,24 @@ namespace Tango.PPC.Jobs.Models public void InitLAB(double l, double a, double b, double c, double h) { - SourceL = L = l; - SourceA = A = a; - SourceB = B = b; - SourceC = C = c; - SourceH = H = h; + L = l; + A = a; + B = b; + C = c; + H = h; LightnessOffset = ChromaOffset = HueOffset = 0; + _sourcel = l; + RaisePropertyChanged(nameof(SourceL)); + _sourcea = a; + RaisePropertyChanged(nameof(SourceA)); + _sourceb = b; + RaisePropertyChanged(nameof(SourceB)); + _sourcec = c; + RaisePropertyChanged(nameof(SourceC)); + _sourceh = h; + RaisePropertyChanged(nameof(SourceH)); + Lch lch = Correction(-6, 0, 0); MinLightness.Init(lch); lch = Correction(6, 0, 0); @@ -259,8 +274,7 @@ namespace Tango.PPC.Jobs.Models MinHue.Init(lch); lch = Correction(0, 0, 6); MaxHue.Init(lch); - LightnessOffset = ChromaOffset = HueOffset = 0; - ManualCorrection(0, 0, 0); + RaisePropertyChanged(nameof(SourceColorBrush)); RaisePropertyChanged(nameof(ManualColorBrush)); } @@ -288,12 +302,17 @@ namespace Tango.PPC.Jobs.Models lch = Correction(0, 0, 6); MaxHue.Init(lch); - ManualCorrection(0, 0, 0); + //ManualCorrection(0, 0, 0); RaisePropertyChanged(nameof(SourceColorBrush)); RaisePropertyChanged(nameof(ManualColorBrush)); } - + /// <summary> + /// Manuals the correction. During change lightnessOffset, chromaOffset or hueOffset in app caused to change LAB of visual correction. + /// </summary> + /// <param name="lightnessOffset">The lightness offset.</param> + /// <param name="chromaOffset">The chroma offset.</param> + /// <param name="hueOffset">The hue offset.</param> public void ManualCorrection(double lightnessOffset, double chromaOffset, double hueOffset) { Lch lch = Correction(lightnessOffset, chromaOffset, hueOffset); @@ -306,11 +325,18 @@ namespace Tango.PPC.Jobs.Models } + /// <summary> + /// Calculate Lch on the specified lightness offset. + /// </summary> + /// <param name="lightnessOffset">The lightness offset.</param> + /// <param name="chromaOffset">The chroma offset.</param> + /// <param name="hueOffset">The hue offset.</param> + /// <returns></returns> public Lch Correction( double lightnessOffset, double chromaOffset, double hueOffset) { - LightnessOffset = lightnessOffset; - ChromaOffset = chromaOffset; - HueOffset = hueOffset; + //LightnessOffset = lightnessOffset; + //ChromaOffset = chromaOffset; + //HueOffset = hueOffset; double L1 = SourceL; double C1 = SourceC; |
