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

Added MinLightness-Setting to the Ambilight-example

This commit is contained in:
Darth Affe 2016-11-12 13:46:22 +01:00
parent 633636efda
commit 8373863f8c
3 changed files with 18 additions and 1 deletions

View File

@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Drawing;
using CUE.NET.Brushes;
using CUE.NET.Devices.Generic;
using CUE.NET.Helper;
using Example_Ambilight_full.TakeAsIs;
using Example_Ambilight_full.TakeAsIs.Model;
using Example_Ambilight_full.TakeAsIs.Model.Extensions;
@ -74,12 +76,19 @@ namespace Example_Ambilight_full
KeyWidthProportion = EffectiveSourceWidth / rectangle.Width;
KeyHeightProportion = EffectiveSourceHeight / rectangle.Height;
Opacity = Settings.SmoothMode == SmoothMode.Low ? 0.25f : (Settings.SmoothMode == SmoothMode.Medium ? 0.075f : (Settings.SmoothMode == SmoothMode.High ? 0.025f : 1f /*None*/));
base.PerformRender(rectangle, renderTargets);
}
protected override CorsairColor FinalizeColor(CorsairColor 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);
}
#endregion
}
}

View File

@ -34,6 +34,8 @@ namespace Example_Ambilight_full.TakeAsIs
public BlackBarDetectionMode BlackBarDetectionMode { get; set; } = BlackBarDetectionMode.Bottom;
public FlipMode FlipMode { get; set; } = FlipMode.Vertical;
public double MinLightness { get; set; } = 0;
#endregion
#region Events

View File

@ -104,6 +104,12 @@
ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}"
SelectedItem="{Binding Path=Settings.SmoothMode}" />
<!-- Min Lightness -->
<TextBlock Grid.Row="3" Grid.Column="3" Text="Min Lightness (%):" />
<controls:NumericUpDown Grid.Row="3" Grid.Column="4"
Minimum="0" Maximum="100"
Value="{Binding Path=Settings.MinLightness, Mode=TwoWay}" />
<!-- FlipMode -->
<TextBlock Grid.Row="4" Grid.Column="0" Text="Flip Horizontal:" />
<CheckBox Grid.Row="4" Grid.Column="1"