1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 16:58:29 +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.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);
}

View File

@ -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));

View File

@ -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));

View File

@ -41,8 +41,8 @@
<ApplicationIcon>Resources\ambilight.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CUE.NET, Version=1.1.0.2, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\CUE.NET.1.1.0.2\lib\net45\CUE.NET.dll</HintPath>
<Reference Include="CUE.NET, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\CUE.NET.1.1.1\lib\net45\CUE.NET.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
@ -152,12 +152,12 @@
<Resource Include="Resources\ambilight.ico" />
</ItemGroup>
<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">
<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>
</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>
<!-- 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.

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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="MahApps.Metro" version="1.4.0-ALPHA026" targetFramework="net45" />
<package id="SharpDX" version="3.1.1" targetFramework="net45" />