From 67b7ad5df61a833aa85ce18b6055cbdc8fce513f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 19 Nov 2019 14:24:18 +0200 Subject: Refactored PPC hive and color correction. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/Graphics/Mobile/color-picker.png | Bin 1376 -> 1171 bytes Software/Graphics/Mobile/color-picker@2x.png | Bin 2661 -> 2380 bytes Software/Graphics/Mobile/color-picker@3x.png | Bin 3984 -> 3541 bytes .../Dialogs/BasicColorCorrectionView.xaml | 9 +++-- .../Modules/Tango.PPC.Jobs/Images/color-picker.png | Bin 0 -> 1171 bytes .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 5 ++- .../Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs | 38 +++++++++++++++++---- .../PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml | 4 +-- .../ColorConversionSuggestionExtensions.cs | 6 +++- 11 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index b7604d584..7dd2f9afd 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index ecab6b86c..9c7e63986 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/Graphics/Mobile/color-picker.png b/Software/Graphics/Mobile/color-picker.png index e09d23190..d8d6f8470 100644 Binary files a/Software/Graphics/Mobile/color-picker.png and b/Software/Graphics/Mobile/color-picker.png differ diff --git a/Software/Graphics/Mobile/color-picker@2x.png b/Software/Graphics/Mobile/color-picker@2x.png index 8953e08a7..16f51f17f 100644 Binary files a/Software/Graphics/Mobile/color-picker@2x.png and b/Software/Graphics/Mobile/color-picker@2x.png differ diff --git a/Software/Graphics/Mobile/color-picker@3x.png b/Software/Graphics/Mobile/color-picker@3x.png index d5c95846d..0a45334dc 100644 Binary files a/Software/Graphics/Mobile/color-picker@3x.png and b/Software/Graphics/Mobile/color-picker@3x.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml index 4c100c2fc..bd31b88ce 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/BasicColorCorrectionView.xaml @@ -59,7 +59,7 @@ - Please select an alternative + Please use the closest alternative @@ -81,7 +81,7 @@ - + @@ -147,7 +147,10 @@ - More Options + + + More Options + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png new file mode 100644 index 000000000..d8d6f8470 Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color-picker.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 50cd99b01..6d5b62295 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -483,10 +483,13 @@ + + + - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index a4cf491ba..7b0a8b436 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -880,23 +880,47 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log($"Invoking triplet color adjustment dialog for brush stop {brushStop.StopIndex} at segment {brushStop.Segment.SegmentIndex}."); LogManager.Log("Retrieving color conversion suggestions for brush stop..."); - var conversionOutput = _converter.Convert(brushStop, true); + PMR.ColorLab.ConversionOutput conversionOutput = null; + + if (brushStop.IsOutOfGamut) + { + conversionOutput = _converter.Convert(brushStop, false); + } BasicColorCorrectionViewVM vm = null; - vm = await NotificationProvider.ShowDialog(new BasicColorCorrectionViewVM() + if (brushStop.IsOutOfGamut) { - InvalidBrushStop = brushStop, - Suggestions = conversionOutput.CreateTrippletSuggestions(), - }); + vm = await NotificationProvider.ShowDialog(new BasicColorCorrectionViewVM() + { + InvalidBrushStop = brushStop, + Suggestions = new List() { new ColorConversionSuggestion(conversionOutput.SingleCoordinates, 0, 0) }, + }); + } - if (vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) + if (vm == null || vm.Result == BasicColorCorrectionViewVM.ColorCorrectionDialogResult.MoreOptions) { + conversionOutput = _converter.Convert(brushStop, true); + + var suggestions = conversionOutput.CreateHiveSuggestions(); + + if (vm == null) + { + var center = suggestions.GetCenterSuggestion(); + center.Coordinates.Red = brushStop.Red; + center.Coordinates.Green = brushStop.Green; + center.Coordinates.Blue = brushStop.Blue; + + center.Coordinates.L = brushStop.L; + center.Coordinates.A = brushStop.A; + center.Coordinates.B = brushStop.B; + } + LogManager.Log("Invoking hive color conversion dialog..."); vm = await NotificationProvider.ShowDialog(new AdvancedColorCorrectionViewVM() { InvalidBrushStop = brushStop, - Suggestions = conversionOutput.CreateHiveSuggestions(), + Suggestions = suggestions, }); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 57101569a..59b024a7b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -172,7 +172,7 @@ - + @@ -343,7 +343,7 @@ - + diff --git a/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ColorConversionSuggestionExtensions.cs b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ColorConversionSuggestionExtensions.cs index 076890230..6bd0520ad 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ColorConversionSuggestionExtensions.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/ExtensionMethods/ColorConversionSuggestionExtensions.cs @@ -14,7 +14,11 @@ public static class ColorConversionSuggestionExtensions /// public static ColorConversionSuggestion GetCenterSuggestion(this IEnumerable suggestions) { - if (suggestions.Count() == 3) + if (suggestions.Count() == 1) + { + return suggestions.ElementAt(0); + } + else if (suggestions.Count() == 3) { return suggestions.ElementAt(1); } -- cgit v1.3.1