mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 08:48:30 +00:00
Updated Ambilight-Example to use the new gamma-correction
This commit is contained in:
parent
eb3f92d7b0
commit
947963a81c
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
</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>
|
||||
<HintPath>..\..\..\packages\CUE.NET.1.1.0.3-CI00000\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.0.3-CI00000\build\net45\CUE.NET.targets" Condition="Exists('..\..\..\packages\CUE.NET.1.1.0.3-CI00000\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.0.3-CI00000\build\net45\CUE.NET.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\CUE.NET.1.1.0.3-CI00000\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.
|
||||
|
||||
@ -35,6 +35,7 @@ namespace Example_Ambilight_full.TakeAsIs
|
||||
public FlipMode FlipMode { get; set; } = FlipMode.Vertical;
|
||||
|
||||
public double MinLightness { get; set; } = 0;
|
||||
public float Gamma { get; set; } = 1f;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -80,23 +80,29 @@
|
||||
<controls:NumericUpDown Grid.Row="0" Grid.Column="1"
|
||||
Minimum="1" Maximum="60"
|
||||
Value="{Binding Path=UpdateRate, Mode=TwoWay}" />
|
||||
|
||||
<!-- AmbienceCreatorType -->
|
||||
|
||||
<!-- AmbienceCreatorType & Downsampling-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Ambilight-Mode:"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource AmbienceCreatorTypeValues}}"
|
||||
SelectedItem="{Binding Path=Settings.AmbienceCreatorType}" />
|
||||
|
||||
<!-- MirrorAmount & Downsampling-->
|
||||
<TextBlock Grid.Row="1" Grid.Column="3" Text="Downsampling:" />
|
||||
<controls:NumericUpDown Grid.Row="1" Grid.Column="4"
|
||||
Minimum="1" Maximum="20"
|
||||
Value="{Binding Path=Settings.Downsampling, Mode=TwoWay}" />
|
||||
|
||||
<!-- MirrorAmount & Gamma-->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Mirrored Amount (%):" />
|
||||
<controls:NumericUpDown Grid.Row="2" Grid.Column="1"
|
||||
Minimum="0" Maximum="100"
|
||||
Value="{Binding Path=Settings.MirroredAmount, Mode=TwoWay}" />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="3" Text="Downsampling:" />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="3" Text="Gamma:" />
|
||||
<controls:NumericUpDown Grid.Row="2" Grid.Column="4"
|
||||
Minimum="1" Maximum="20"
|
||||
Value="{Binding Path=Settings.Downsampling, Mode=TwoWay}" />
|
||||
Minimum="0.1" Maximum="10"
|
||||
HasDecimals="True" Interval="0.1" StringFormat="F1"
|
||||
Value="{Binding Path=Settings.Gamma, Mode=TwoWay}" />
|
||||
|
||||
<!-- SmoothMode -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Smoothing:" />
|
||||
|
||||
@ -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.0.3-CI00000" 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" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user