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;
}
/// <inheritdoc />
public override void Render(DrawingContext drawingContext)
{
@ -305,8 +304,9 @@ public class DeviceVisualizer : Control
using DrawingContext context = renderTargetBitmap.CreateDrawingContext();
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)
{
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)

View File

@ -46,10 +46,10 @@ internal class DeviceVisualizerLed
try
{
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(
bitmap,
new Rect(bitmap.Size),
new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale)
scaledBitmap,
new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, scaledBitmap.Size.Width, scaledBitmap.Size.Height)
);
}
catch

View File

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

View File

@ -15,7 +15,7 @@
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaTitleBarHeightHint="450">
<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"
Classes="h5"
HorizontalAlignment="Center"

View File

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