1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-13 00:58:31 +00:00

Adjusted ambilight-example to take profit from the latest version

This commit is contained in:
Darth Affe 2017-01-05 20:21:02 +01:00
parent 46c6fc62e3
commit 8404985a55
5 changed files with 12 additions and 14 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using CUE.NET.Brushes; using CUE.NET.Brushes;
using CUE.NET.ColorCorrection;
using CUE.NET.Devices.Generic; using CUE.NET.Devices.Generic;
using CUE.NET.Helper; using CUE.NET.Helper;
using Example_Ambilight_full.TakeAsIs; using Example_Ambilight_full.TakeAsIs;
@ -84,13 +85,12 @@ namespace Example_Ambilight_full
protected override CorsairColor FinalizeColor(CorsairColor color) protected override CorsairColor FinalizeColor(CorsairColor color)
{ {
//TODO DarthAffe 05.01.2017: Adopt example once the new version is released! // Apply our gamma-correction
//if (Math.Abs(Settings.Gamma - 1f) > float.Epsilon) ((GammaCorrection)Settings.Gamma).ApplyTo(color);
// 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)))); 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))); 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); return ColorHelper.ColorFromHSV(color.GetHSVHue(), color.GetHSVSaturation(), lightness, alpha);
} }

View File

@ -22,8 +22,7 @@ namespace Example_Ambilight_full
protected override CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) 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 = renderTarget.Rectangle.Width;
float keyWidth = 10;
int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth)); int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth));

View File

@ -22,9 +22,8 @@ namespace Example_Ambilight_full
protected override CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget) 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 = renderTarget.Rectangle.Width;
float keyWidth = 10; float keyHeight = renderTarget.Rectangle.Height;
float keyHeight = 10;
int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth)); int widthPixels = Math.Max(1, (int)(KeyWidthProportion * keyWidth));
int heightPixels = Math.Max(1, (int)(KeyHeightProportion * keyHeight)); int heightPixels = Math.Max(1, (int)(KeyHeightProportion * keyHeight));

View File

@ -41,8 +41,8 @@
<ApplicationIcon>Resources\ambilight.ico</ApplicationIcon> <ApplicationIcon>Resources\ambilight.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CUE.NET, Version=1.1.0.2, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="CUE.NET, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\CUE.NET.1.1.0.2\lib\net45\CUE.NET.dll</HintPath> <HintPath>..\..\..\packages\CUE.NET.1.1.1\lib\net45\CUE.NET.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
@ -152,12 +152,12 @@
<Resource Include="Resources\ambilight.ico" /> <Resource Include="Resources\ambilight.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\packages\CUE.NET.1.1.0.2\build\net45\CUE.NET.targets" Condition="Exists('..\..\..\packages\CUE.NET.1.1.0.2\build\net45\CUE.NET.targets')" /> <Import Project="..\..\..\packages\CUE.NET.1.1.1\build\net45\CUE.NET.targets" Condition="Exists('..\..\..\packages\CUE.NET.1.1.1\build\net45\CUE.NET.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>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}.</ErrorText> <ErrorText>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}.</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\CUE.NET.1.1.0.2\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CUE.NET.1.1.0.2\build\net45\CUE.NET.targets'))" /> <Error Condition="!Exists('..\..\..\packages\CUE.NET.1.1.1\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CUE.NET.1.1.1\build\net45\CUE.NET.targets'))" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CUE.NET" version="1.1.0.2" targetFramework="net45" /> <package id="CUE.NET" version="1.1.1" targetFramework="net45" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net45" /> <package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net45" />
<package id="MahApps.Metro" version="1.4.0-ALPHA026" targetFramework="net45" /> <package id="MahApps.Metro" version="1.4.0-ALPHA026" targetFramework="net45" />
<package id="SharpDX" version="3.1.1" targetFramework="net45" /> <package id="SharpDX" version="3.1.1" targetFramework="net45" />