From 8404985a554a077a26d1cbd8312a370f15b58586 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Thu, 5 Jan 2017 20:21:02 +0100 Subject: [PATCH] Adjusted ambilight-example to take profit from the latest version --- .../Example_Ambilight_full/AbstractAmbilightBrush.cs | 8 ++++---- .../Example_Ambilight_full/AmbilightExtendBrush.cs | 3 +-- .../Example_Ambilight_full/AmbilightMirrorBrush.cs | 5 ++--- .../Example_Ambilight_full/Example_Ambilight_full.csproj | 8 ++++---- Examples/Ambilight/Example_Ambilight_full/packages.config | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs index 27f5ce6..7b820e7 100644 --- a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs +++ b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Drawing; using CUE.NET.Brushes; +using CUE.NET.ColorCorrection; using CUE.NET.Devices.Generic; using CUE.NET.Helper; using Example_Ambilight_full.TakeAsIs; @@ -84,13 +85,12 @@ namespace Example_Ambilight_full protected override CorsairColor FinalizeColor(CorsairColor color) { - //TODO DarthAffe 05.01.2017: Adopt example once the new version is released! - //if (Math.Abs(Settings.Gamma - 1f) > float.Epsilon) - // ColorHelper.CorrectGamma(color, Settings.Gamma); + // Apply our gamma-correction + ((GammaCorrection)Settings.Gamma).ApplyTo(color); 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/AmbilightExtendBrush.cs b/Examples/Ambilight/Example_Ambilight_full/AmbilightExtendBrush.cs index f5835da..8686457 100644 --- a/Examples/Ambilight/Example_Ambilight_full/AmbilightExtendBrush.cs +++ b/Examples/Ambilight/Example_Ambilight_full/AmbilightExtendBrush.cs @@ -22,8 +22,7 @@ namespace Example_Ambilight_full protected override CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) { - //TODO DarthAffe 05.11.2016: The Key-Rectangle is missing in the render-target, I'll fix that with a future version of CUE.NET. Until then we consider the size of each key to be 10x10mm. - float keyWidth = 10; + float keyWidth = renderTarget.Rectangle.Width; int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth)); diff --git a/Examples/Ambilight/Example_Ambilight_full/AmbilightMirrorBrush.cs b/Examples/Ambilight/Example_Ambilight_full/AmbilightMirrorBrush.cs index a05c6bb..bddb751 100644 --- a/Examples/Ambilight/Example_Ambilight_full/AmbilightMirrorBrush.cs +++ b/Examples/Ambilight/Example_Ambilight_full/AmbilightMirrorBrush.cs @@ -22,9 +22,8 @@ namespace Example_Ambilight_full protected override CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) { - //TODO DarthAffe 05.11.2016: The Key-Rectangle is missing in the render-target, I'll fix that with a future version of CUE.NET. Until then we consider the size of each key to be 10x10mm. - float keyWidth = 10; - float keyHeight = 10; + float keyWidth = renderTarget.Rectangle.Width; + float keyHeight = renderTarget.Rectangle.Height; int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth)); int heightPixels = Math.Max(1, (int)(KeyHeightProportion * keyHeight)); diff --git a/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj b/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj index 3e7b809..2bafaa4 100644 --- a/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj +++ b/Examples/Ambilight/Example_Ambilight_full/Example_Ambilight_full.csproj @@ -41,8 +41,8 @@ Resources\ambilight.ico - - ..\..\..\packages\CUE.NET.1.1.0.2\lib\net45\CUE.NET.dll + + ..\..\..\packages\CUE.NET.1.1.1\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}. - +