From 947963a81c971120d88f721574f1dfd151e5ee82 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 11 Dec 2016 16:28:28 +0100 Subject: [PATCH] Updated Ambilight-Example to use the new gamma-correction --- .../AbstractAmbilightBrush.cs | 4 ++++ .../Example_Ambilight_full.csproj | 6 +++--- .../TakeAsIs/AmbilightSettings.cs | 1 + .../TakeAsIs/UI/ConfigView.xaml | 20 ++++++++++++------- .../Example_Ambilight_full/packages.config | 2 +- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs index f1c1c7a..6111808 100644 --- a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs +++ b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs @@ -84,8 +84,12 @@ namespace Example_Ambilight_full protected override CorsairColor FinalizeColor(CorsairColor color) { + if (Math.Abs(Settings.Gamma - 1f) > float.Epsilon) + ColorHelper.CorrectGamma(color, Settings.Gamma); + float lightness = (float)Math.Max((Settings.MinLightness / 100.0), (color.GetHSVValue() * ((double)Brightness < 0.0 ? 0.0f : ((double)Brightness > 1.0 ? 1f : Brightness)))); byte alpha = (byte)((double)color.A * ((double)Opacity < 0.0 ? 0.0 : ((double)Opacity > 1.0 ? 1.0 : (double)Opacity))); + return ColorHelper.ColorFromHSV(color.GetHSVHue(), color.GetHSVSaturation(), lightness, alpha); } diff --git a/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj b/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj index 3e7b809..f7bfc8c 100644 --- a/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj +++ b/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj @@ -42,7 +42,7 @@ - ..\..\..\packages\CUE.NET.1.1.0.2\lib\net45\CUE.NET.dll + ..\..\..\packages\CUE.NET.1.1.0.3-CI00000\lib\net45\CUE.NET.dll True @@ -152,12 +152,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + + + - + + + + - - + + + Minimum="0.1" Maximum="10" + HasDecimals="True" Interval="0.1" StringFormat="F1" + Value="{Binding Path=Settings.Gamma, Mode=TwoWay}" /> diff --git a/Examples/Ambilight/Example_Ambilight_full/packages.config b/Examples/Ambilight/Example_Ambilight_full/packages.config index fc59ecf..53451a1 100644 --- a/Examples/Ambilight/Example_Ambilight_full/packages.config +++ b/Examples/Ambilight/Example_Ambilight_full/packages.config @@ -1,6 +1,6 @@  - +