1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

BitmapInterpolationMode fixes

This commit is contained in:
Robert 2023-05-11 23:33:36 +02:00
parent bf6674e44f
commit f04d7cf897
5 changed files with 26 additions and 25 deletions

View File

@ -41,7 +41,6 @@ public class DeviceVisualizer : Control
PropertyChanged += OnPropertyChanged; PropertyChanged += OnPropertyChanged;
} }
/// <inheritdoc /> /// <inheritdoc />
public override void Render(DrawingContext drawingContext) public override void Render(DrawingContext drawingContext)
{ {
@ -305,8 +304,9 @@ public class DeviceVisualizer : Control
using DrawingContext context = renderTargetBitmap.CreateDrawingContext(); using DrawingContext context = renderTargetBitmap.CreateDrawingContext();
using Bitmap bitmap = new(device.Layout.Image.LocalPath); using Bitmap bitmap = new(device.Layout.Image.LocalPath);
using Bitmap scaledBitmap = bitmap.CreateScaledBitmap(renderTargetBitmap.PixelSize);
context.DrawImage(bitmap, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size)); context.DrawImage(scaledBitmap, new Rect(scaledBitmap.Size));
lock (_deviceVisualizerLeds) lock (_deviceVisualizerLeds)
{ {
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds) foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)

View File

@ -46,10 +46,10 @@ internal class DeviceVisualizerLed
try try
{ {
using Bitmap bitmap = new(Led.Layout.Image.LocalPath); using Bitmap bitmap = new(Led.Layout.Image.LocalPath);
using Bitmap scaledBitmap = bitmap.CreateScaledBitmap(new PixelSize((Led.RgbLed.Size.Width * scale).RoundToInt(), (Led.RgbLed.Size.Height * scale).RoundToInt()));
drawingContext.DrawImage( drawingContext.DrawImage(
bitmap, scaledBitmap,
new Rect(bitmap.Size), new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, scaledBitmap.Size.Width, scaledBitmap.Size.Height)
new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale)
); );
} }
catch catch

View File

@ -11,13 +11,14 @@
x:Class="Artemis.UI.Screens.Device.DeviceSettingsView"> x:Class="Artemis.UI.Screens.Device.DeviceSettingsView">
<Border Classes="card" Padding="0" Width="200" ClipToBounds="True" Margin="5"> <Border Classes="card" Padding="0" Width="200" ClipToBounds="True" Margin="5">
<Grid RowDefinitions="140,*,Auto"> <Grid RowDefinitions="140,*,Auto">
<Rectangle Grid.Row="0" Fill="{DynamicResource CheckerboardBrush}"/> <Rectangle Grid.Row="0" Fill="{DynamicResource CheckerboardBrush}" />
<shared:DeviceVisualizer VerticalAlignment="Center" <shared:DeviceVisualizer Grid.Row="0"
VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Margin="5" Margin="5"
ShowColors="False" ShowColors="False"
Device="{CompiledBinding Device}" Device="{CompiledBinding Device}"
Grid.Row="0" /> RenderOptions.BitmapInterpolationMode="HighQuality" />
<Button Grid.Row="0" <Button Grid.Row="0"
Classes="icon-button icon-button-large" Classes="icon-button icon-button-large"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"

View File

@ -15,7 +15,7 @@
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaTitleBarHeightHint="450"> ExtendClientAreaTitleBarHeightHint="450">
<Grid RowDefinitions="250,50,Auto,*" IsHitTestVisible="False"> <Grid RowDefinitions="250,50,Auto,*" IsHitTestVisible="False">
<Image Grid.Column="0" Stretch="Uniform" Width="200" Height="150" Source="/Assets/Images/Logo/bow.png" VerticalAlignment="Bottom"/> <Image Grid.Column="0" Stretch="Uniform" Width="200" Height="150" Source="/Assets/Images/Logo/bow.png" VerticalAlignment="Bottom" RenderOptions.BitmapInterpolationMode="HighQuality"/>
<TextBlock Grid.Row="1" <TextBlock Grid.Row="1"
Classes="h5" Classes="h5"
HorizontalAlignment="Center" HorizontalAlignment="Center"

View File

@ -27,7 +27,7 @@
</Style> </Style>
</Grid.Styles> </Grid.Styles>
<shared:DeviceVisualizer Device="{CompiledBinding Device}" ShowColors="True" /> <shared:DeviceVisualizer Device="{CompiledBinding Device}" ShowColors="True" RenderOptions.BitmapInterpolationMode="HighQuality"/>
<Border x:Name="SurfaceDeviceBorder" <Border x:Name="SurfaceDeviceBorder"
Classes="selection-border" Classes="selection-border"
Classes.selected="{CompiledBinding IsSelected}" Classes.selected="{CompiledBinding IsSelected}"