mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-13 09:08:34 +00:00
Added MinLightness-Setting to the Ambilight-example
This commit is contained in:
parent
633636efda
commit
8373863f8c
@ -2,6 +2,8 @@
|
|||||||
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.Devices.Generic;
|
||||||
|
using CUE.NET.Helper;
|
||||||
using Example_Ambilight_full.TakeAsIs;
|
using Example_Ambilight_full.TakeAsIs;
|
||||||
using Example_Ambilight_full.TakeAsIs.Model;
|
using Example_Ambilight_full.TakeAsIs.Model;
|
||||||
using Example_Ambilight_full.TakeAsIs.Model.Extensions;
|
using Example_Ambilight_full.TakeAsIs.Model.Extensions;
|
||||||
@ -74,12 +76,19 @@ namespace Example_Ambilight_full
|
|||||||
|
|
||||||
KeyWidthProportion = EffectiveSourceWidth / rectangle.Width;
|
KeyWidthProportion = EffectiveSourceWidth / rectangle.Width;
|
||||||
KeyHeightProportion = EffectiveSourceHeight / rectangle.Height;
|
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*/));
|
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);
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,8 @@ namespace Example_Ambilight_full.TakeAsIs
|
|||||||
public BlackBarDetectionMode BlackBarDetectionMode { get; set; } = BlackBarDetectionMode.Bottom;
|
public BlackBarDetectionMode BlackBarDetectionMode { get; set; } = BlackBarDetectionMode.Bottom;
|
||||||
public FlipMode FlipMode { get; set; } = FlipMode.Vertical;
|
public FlipMode FlipMode { get; set; } = FlipMode.Vertical;
|
||||||
|
|
||||||
|
public double MinLightness { get; set; } = 0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|||||||
@ -104,6 +104,12 @@
|
|||||||
ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}"
|
ItemsSource="{Binding Source={StaticResource SmoothModeEnumValues}}"
|
||||||
SelectedItem="{Binding Path=Settings.SmoothMode}" />
|
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 -->
|
<!-- FlipMode -->
|
||||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Flip Horizontal:" />
|
<TextBlock Grid.Row="4" Grid.Column="0" Text="Flip Horizontal:" />
|
||||||
<CheckBox Grid.Row="4" Grid.Column="1"
|
<CheckBox Grid.Row="4" Grid.Column="1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user