mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Editor - Fixed layer visualization with new render scaling
UI - Changed default render scale to 25% (won't affect existing installations)
This commit is contained in:
parent
55cfa65bb5
commit
23b14c6365
@ -36,7 +36,7 @@ namespace Artemis.Core.Services
|
|||||||
_pluginManagementService = pluginManagementService;
|
_pluginManagementService = pluginManagementService;
|
||||||
_deviceRepository = deviceRepository;
|
_deviceRepository = deviceRepository;
|
||||||
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
|
_targetFrameRateSetting = settingsService.GetSetting("Core.TargetFrameRate", 25);
|
||||||
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.5);
|
_renderScaleSetting = settingsService.GetSetting("Core.RenderScale", 0.25);
|
||||||
|
|
||||||
Surface = new RGBSurface();
|
Surface = new RGBSurface();
|
||||||
Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value);
|
Utilities.RenderScaleMultiplier = (int) (1 / _renderScaleSetting.Value);
|
||||||
|
|||||||
@ -216,11 +216,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
|
|||||||
|
|
||||||
public double RenderScale
|
public double RenderScale
|
||||||
{
|
{
|
||||||
get => _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
get => _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_settingsService.GetSetting("Core.RenderScale", 0.5).Value = value;
|
_settingsService.GetSetting("Core.RenderScale", 0.25).Value = value;
|
||||||
_settingsService.GetSetting("Core.RenderScale", 0.5).Save();
|
_settingsService.GetSetting("Core.RenderScale", 0.25).Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -108,7 +108,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
|||||||
set => SetAndNotify(ref _colorFirstLedOnly, value);
|
set => SetAndNotify(ref _colorFirstLedOnly, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||||
public double MaxTextureSizeIndicatorThickness => 2 / PanZoomViewModel.Zoom;
|
public double MaxTextureSizeIndicatorThickness => 2 / PanZoomViewModel.Zoom;
|
||||||
|
|
||||||
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
|
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
|
||||||
|
|||||||
@ -103,7 +103,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
|||||||
if (x < 0 || y < 0)
|
if (x < 0 || y < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.5).Value;
|
double maxTextureSize = 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value;
|
||||||
if (x + Device.Rectangle.Width > maxTextureSize || y + Device.Rectangle.Height > maxTextureSize)
|
if (x + Device.Rectangle.Width > maxTextureSize || y + Device.Rectangle.Height > maxTextureSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using RGB.NET.Core;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SkiaSharp.Views.WPF;
|
using SkiaSharp.Views.WPF;
|
||||||
|
using Point = System.Windows.Point;
|
||||||
|
|
||||||
namespace Artemis.UI.Services
|
namespace Artemis.UI.Services
|
||||||
{
|
{
|
||||||
@ -12,12 +15,15 @@ namespace Artemis.UI.Services
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Rect GetLayerBounds(Layer layer)
|
public Rect GetLayerBounds(Layer layer)
|
||||||
{
|
{
|
||||||
// Adjust the render rectangle for the difference in render scale
|
return new Rect(
|
||||||
return new(
|
new Point(
|
||||||
layer.Bounds.Left,
|
layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.X),
|
||||||
layer.Bounds.Top,
|
layer.Leds.Min(l => l.RgbLed.AbsoluteBoundary.Location.Y
|
||||||
Math.Max(0, layer.Bounds.Width),
|
)),
|
||||||
Math.Max(0, layer.Bounds.Height)
|
new Point(
|
||||||
|
layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.X + l.RgbLed.AbsoluteBoundary.Size.Width),
|
||||||
|
layer.Leds.Max(l => l.RgbLed.AbsoluteBoundary.Location.Y + l.RgbLed.AbsoluteBoundary.Size.Height
|
||||||
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,15 +100,16 @@ namespace Artemis.UI.Services
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public SKPoint GetScaledPoint(Layer layer, SKPoint point, bool absolute)
|
public SKPoint GetScaledPoint(Layer layer, SKPoint point, bool absolute)
|
||||||
{
|
{
|
||||||
|
SKRect bounds = GetLayerBounds(layer).ToSKRect();
|
||||||
if (absolute)
|
if (absolute)
|
||||||
return new SKPoint(
|
return new SKPoint(
|
||||||
100f / layer.Bounds.Width * (point.X - layer.Bounds.Left) / 100f,
|
100 / bounds.Width * (point.X - bounds.Left) / 100,
|
||||||
100f / layer.Bounds.Height * (point.Y - layer.Bounds.Top) / 100f
|
100 / bounds.Height * (point.Y - bounds.Top) / 100
|
||||||
);
|
);
|
||||||
|
|
||||||
return new SKPoint(
|
return new SKPoint(
|
||||||
100f / layer.Bounds.Width * point.X / 100f,
|
100 / bounds.Width * point.X / 100,
|
||||||
100f / layer.Bounds.Height * point.Y / 100f
|
100 / bounds.Height * point.Y / 100
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user