diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-11 15:19:58 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-11 15:19:58 +0300 |
| commit | a495866908071d2204c8eab85dc0163308c5e53e (patch) | |
| tree | 1fa86362c45889c7fb935116886aa0aea2a8a22f /Software/Visual_Studio | |
| parent | 2b1c20945dc03d5136fba48ee9d165b412620e66 (diff) | |
| download | Tango-a495866908071d2204c8eab85dc0163308c5e53e.tar.gz Tango-a495866908071d2204c8eab85dc0163308c5e53e.zip | |
VFT. Add warning on the “correction” preview.
Related Work Items: #8553
Diffstat (limited to 'Software/Visual_Studio')
4 files changed, 72 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml index 0e72c6aa0..99b78d7ec 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialog.xaml @@ -548,7 +548,18 @@ <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Correction</TextBlock> <Border Grid.Row="1" Height="220" Margin="0 10 0 0" CornerRadius="0 0 0 0" BorderThickness="0" BorderBrush="{StaticResource TangoGrayBrush}" Background="{Binding VisualCorrectionModel.ManualColorBrush}" > - <UniformGrid Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <StackPanel Grid.Row="0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding VisualCorrectionModel.IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Image Margin="30 0 24 0" Stretch="Fill" Width="47" Height="43" RenderOptions.BitmapScalingMode="Fant" Source="../Images/ColorSelection/Exclamation.png" HorizontalAlignment="Center"></Image> + <!--<Border Margin=" 0 10 0 0" MinWidth="115" Height="31" Background="{StaticResource TangoDarkForegroundBrush}" CornerRadius="2"> + <TextBlock Margin="10 0" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Text="This color is not supported." ></TextBlock> + </Border>--> + </StackPanel> + <UniformGrid Grid.Row="1" Rows="3" Columns="1" VerticalAlignment="Bottom" Background="Transparent"> <TextBlock FontWeight="Medium" Margin="10 10 0 0" VerticalAlignment="Center" Foreground="{Binding VisualCorrectionModel.ManualColorBrush, Converter={StaticResource ColorContrastConverter}}" FontSize="{StaticResource TangoSmallFontSize}"> <Run Text="L:" ></Run> <Run Text="{Binding VisualCorrectionModel.L, StringFormat={}{0:F2}}"></Run> @@ -562,7 +573,8 @@ <Run Text="{Binding VisualCorrectionModel.B, StringFormat={}{0:F2}}"></Run> </TextBlock> </UniformGrid> - </Border> + </Grid> + </Border> </StackPanel> <StackPanel Orientation="Vertical" Grid.Column="2" Grid.Row="1" Margin="0 10 0 0" Visibility="{Binding IsTargetVisible, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}"> <TextBlock FontSize="{StaticResource TangoSmallFontSize}" FontWeight="SemiBold" Margin="10 0 0 -5" HorizontalAlignment="Left" >Target</TextBlock> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs index e473fa420..b9149b81f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/VectorFineTuningDialogVM.cs @@ -1319,6 +1319,7 @@ namespace Tango.PPC.Jobs.Dialogs ActiveLogModel.VectorCorrectionL = VisualCorrectionModel.L; ActiveLogModel.VectorCorrectionA = VisualCorrectionModel.A; ActiveLogModel.VectorCorrectionB = VisualCorrectionModel.B; + VisualCorrectionModel.IsOutOfGamut = IsOutOfGammot(); TestCommand.RaiseCanExecuteChanged(); ByPassTestCommand.RaiseCanExecuteChanged(); @@ -1333,6 +1334,7 @@ namespace Tango.PPC.Jobs.Dialogs ActiveLogModel.VectorCorrectionL = VisualCorrectionModel.L; ActiveLogModel.VectorCorrectionA = VisualCorrectionModel.A; ActiveLogModel.VectorCorrectionB = VisualCorrectionModel.B; + VisualCorrectionModel.IsOutOfGamut = IsOutOfGammot(); TestCommand.RaiseCanExecuteChanged(); ByPassTestCommand.RaiseCanExecuteChanged(); } @@ -1347,10 +1349,25 @@ namespace Tango.PPC.Jobs.Dialogs ActiveLogModel.VectorCorrectionL = VisualCorrectionModel.L; ActiveLogModel.VectorCorrectionA = VisualCorrectionModel.A; ActiveLogModel.VectorCorrectionB = VisualCorrectionModel.B; + VisualCorrectionModel.IsOutOfGamut = IsOutOfGammot(); TestCommand.RaiseCanExecuteChanged(); ByPassTestCommand.RaiseCanExecuteChanged(); } + private bool IsOutOfGammot() + { + BrushStopModel.ColorSpace = ColorSpaces.LAB; + BrushStopModel.PreventPropertyUpdate = true; + BrushStopModel.L = ActiveLogModel.VectorCorrectionL; + BrushStopModel.A = ActiveLogModel.VectorCorrectionA; + BrushStopModel.B = ActiveLogModel.VectorCorrectionB; + BrushStopModel.PreventPropertyUpdate = false; + BrushStopModel.IsOutputOfGamut(ColorSpaces.LAB); + + return BrushStopModel.IsOutOfGamut; + + } + #endregion #region Job diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index d415dbb79..5464aa5ed 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -1796,6 +1796,25 @@ namespace Tango.PPC.Jobs.Models } } + public void IsOutputOfGamut(ColorSpaces colorSpace) + { + try + { + BrushStop stop = CreateBrushStop(colorSpace); + Configuration configuration = SegmentModel.Job.Machine.Configuration; + Rml rml = SegmentModel.Job.Rml; + IsOutOfGamut = _converter.IsOutOfGamut(stop, configuration, rml); + } + catch (Exception ex) + { + LogManager.Log(ex, "An error occurred while trying to test IsOutputOfGammut from conversion engine." + ex); + BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); + } + finally + { + IsBusy = false; + } + } #endregion } } 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 a0b6156a3..74651992e 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 @@ -237,7 +237,24 @@ namespace Tango.PPC.Jobs.Models return new SolidColorBrush() { Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B) }; } } - + + private bool _isOutOfGamut; + /// <summary> + /// Gets or sets a value indicating whether this instance is out of gamut. + /// </summary> + public bool IsOutOfGamut + { + get { return _isOutOfGamut; } + set + { + if (_isOutOfGamut != value) + { + _isOutOfGamut = value; + RaisePropertyChangedAuto(); + } + } + } + #endregion public VisualOffsetModel() @@ -248,7 +265,9 @@ namespace Tango.PPC.Jobs.Models MaxChroma = new VisualLCHOffset(TypeColorCorrection.Chroma, 1); MinHue = new VisualLCHOffset(TypeColorCorrection.Hue, -1); MaxHue = new VisualLCHOffset(TypeColorCorrection.Hue, 1); - + IsOutOfGamut = false; + + } public void InitLAB(double l, double a, double b, double c, double h) @@ -292,6 +311,7 @@ namespace Tango.PPC.Jobs.Models B = b; C = last_LCH.C; H = last_LCH.h; + IsOutOfGamut = false; } |
