diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels')
2 files changed, 30 insertions, 32 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs index af5ed51db..92d9056bb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/ColorConversionViewVM.cs @@ -386,25 +386,16 @@ namespace Tango.MachineStudio.RML.ViewModels var output = converter.Convert(input, RML.ColorConversionVersion); - if (SourceColor.IsLab) + TargetColor = new RgbVM() { - TargetColor = new RgbVM() - { - IsLab = true, - L = output.SingleCoordinates.L, - A = output.SingleCoordinates.A, - B = output.SingleCoordinates.B, - }; - } - else - { - TargetColor = new RgbVM() - { - Red = output.SingleCoordinates.Red, - Green = output.SingleCoordinates.Green, - Blue = output.SingleCoordinates.Blue, - }; - } + SynchronizeColorSpaces = false, + L = output.SingleCoordinates.L, + A = output.SingleCoordinates.A, + B = output.SingleCoordinates.B, + Red = output.SingleCoordinates.Red, + Green = output.SingleCoordinates.Green, + Blue = output.SingleCoordinates.Blue, + }; } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs index e8b8cbe86..f06a91f90 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/RgbVM.cs @@ -17,8 +17,12 @@ namespace Tango.MachineStudio.RML.ViewModels public event EventHandler<Color> ColorChanged; + public bool SynchronizeColorSpaces { get; set; } + public RgbVM() { + SynchronizeColorSpaces = true; + _color_change_timer = new DispatcherTimer(); _color_change_timer.Interval = TimeSpan.FromMilliseconds(30); _color_change_timer.Tick += _color_change_timer_Tick; @@ -94,21 +98,24 @@ namespace Tango.MachineStudio.RML.ViewModels { _color_change_timer.Stop(); - if (!IsLab) - { - Rgb rgb = new Rgb(Red, Green, Blue); - Lab lab = rgb.To<Lab>(); - _l = lab.L; - _a = lab.A; - _b = lab.B; - } - else + if (SynchronizeColorSpaces) { - Lab lab = new Lab(L, A, B); - Rgb rgb = lab.To<Rgb>(); - _red = (int)rgb.R; - _green = (int)rgb.G; - _blue = (int)rgb.B; + if (!IsLab) + { + Rgb rgb = new Rgb(Red, Green, Blue); + Lab lab = rgb.To<Lab>(); + _l = lab.L; + _a = lab.A; + _b = lab.B; + } + else + { + Lab lab = new Lab(L, A, B); + Rgb rgb = lab.To<Rgb>(); + _red = (int)rgb.R; + _green = (int)rgb.G; + _blue = (int)rgb.B; + } } _color = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); |
