diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-03-22 18:06:50 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-03-22 18:06:50 +0200 |
| commit | 15a3a16275590dec76658cffd0fb1f9be540798c (patch) | |
| tree | 1700d3d563fd246ddea7b0fc240526cf1eb863f8 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | c4a8675454df38bb1e604ee0fdbd4cc387b431fb (diff) | |
| download | Tango-15a3a16275590dec76658cffd0fb1f9be540798c.tar.gz Tango-15a3a16275590dec76658cffd0fb1f9be540798c.zip | |
Fixed issue in RML module => Color Conversion => RGB/LAB final display.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
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); |
