1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 01:42:02 +00:00

Added Downsampling-option to the ambilight

This commit is contained in:
Darth Affe 2016-11-01 15:08:05 +01:00
parent 3f306ed86d
commit e9cc4ad22c
4 changed files with 13 additions and 5 deletions

View File

@ -41,12 +41,13 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.AmbienceCreator
if (widthPixels <= 0 || heightPixels <= 0 || (relevantSourceHeight + relevantOffsetTop > sourceHeight) || effectiveSourceWidth > sourceWidth) if (widthPixels <= 0 || heightPixels <= 0 || (relevantSourceHeight + relevantOffsetTop > sourceHeight) || effectiveSourceWidth > sourceWidth)
return colors.ToBGRArray(); return colors.ToBGRArray();
for (int y = 0; y < relevantSourceHeight; y += 2) int increment = Math.Max(1, Math.Min(20, settings.Downsampling));
for (int y = 0; y < relevantSourceHeight; y += increment)
{ {
int targetWidthIndex = 0; int targetWidthIndex = 0;
double widthCounter = widthPixels; double widthCounter = widthPixels;
for (int x = 0; x < effectiveSourceWidth; x += 2) for (int x = 0; x < effectiveSourceWidth; x += increment)
{ {
if (x >= widthCounter) if (x >= widthCounter)
{ {

View File

@ -44,7 +44,8 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.AmbienceCreator
int targetHeightIndex = 0; int targetHeightIndex = 0;
double heightCounter = heightPixels; double heightCounter = heightPixels;
for (int y = 0; y < relevantSourceHeight; y += 2) int increment = Math.Max(1, Math.Min(20, settings.Downsampling));
for (int y = 0; y < relevantSourceHeight; y += increment)
{ {
if (y >= heightCounter) if (y >= heightCounter)
{ {
@ -55,7 +56,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.AmbienceCreator
int targetWidthIndex = 0; int targetWidthIndex = 0;
double widthCounter = widthPixels; double widthCounter = widthPixels;
for (int x = 0; x < effectiveSourceWidth; x += 2) for (int x = 0; x < effectiveSourceWidth; x += increment)
{ {
if (x >= widthCounter) if (x >= widthCounter)
{ {

View File

@ -20,6 +20,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight
public int OffsetTop { get; set; } = 0; public int OffsetTop { get; set; } = 0;
public int OffsetBottom { get; set; } = 0; public int OffsetBottom { get; set; } = 0;
public int Downsampling { get; set; } = 2;
public double MirroredAmount { get; set; } = 10; public double MirroredAmount { get; set; } = 10;
public SmoothMode SmoothMode { get; set; } = SmoothMode.Low; public SmoothMode SmoothMode { get; set; } = SmoothMode.Low;

View File

@ -61,11 +61,16 @@
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<!-- MirrorAmount --> <!-- MirrorAmount & Downsampling-->
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Mirrored Amount (%):" <TextBlock Grid.Row="1" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Mirrored Amount (%):"
Height="18" VerticalAlignment="Top" /> Height="18" VerticalAlignment="Top" />
<controls:NumericUpDown Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Minimum="0" Maximum="100" <controls:NumericUpDown Grid.Row="1" Grid.Column="1" VerticalAlignment="Top" Minimum="0" Maximum="100"
Value="{Binding Path=LayerModel.Properties.MirroredAmount, Mode=TwoWay}" Margin="10,12,10,2" Height="24" /> Value="{Binding Path=LayerModel.Properties.MirroredAmount, Mode=TwoWay}" Margin="10,12,10,2" Height="24" />
<TextBlock Grid.Row="1" Grid.Column="2" Margin="10,13,10,10" FontSize="13.333" Text="Downsampling:"
Height="18" VerticalAlignment="Top" />
<controls:NumericUpDown Grid.Row="1" Grid.Column="3" VerticalAlignment="Top" Minimum="1" Maximum="20"
Value="{Binding Path=LayerModel.Properties.Downsampling, Mode=TwoWay}" Margin="10,12,10,2" Height="24" />
<!-- SmoothMode --> <!-- SmoothMode -->
<TextBlock Grid.Row="2" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Smoothing:" <TextBlock Grid.Row="2" Grid.Column="0" Margin="10,13,10,10" FontSize="13.333" Text="Smoothing:"