BitmapInterpolationMode fixes

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

No files matched your search

@@ -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)
@@ -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