diff --git a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs index 8e369df..f1c1c7a 100644 --- a/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs +++ b/Examples/Ambilight/Example_Ambilight_full/AbstractAmbilightBrush.cs @@ -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 } } diff --git a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs index d1b8302..2697b01 100644 --- a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs +++ b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/AmbilightSettings.cs @@ -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 diff --git a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigView.xaml b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigView.xaml index 6005799..8f5df40 100644 --- a/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigView.xaml +++ b/Examples/Ambilight/Example_Ambilight_full/TakeAsIs/UI/ConfigView.xaml @@ -104,6 +104,12 @@ ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}" SelectedItem="{Binding Path=Settings.SmoothMode}" /> + + + +