From 3adc39c488df3c933668e4f03aa817771dff33fb Mon Sep 17 00:00:00 2001 From: SpoinkyNL Date: Thu, 6 Feb 2020 19:10:47 +0100 Subject: [PATCH] Fixed layer shape missing in some instances --- src/Artemis.Core/Models/Profile/Layer.cs | 3 +++ src/Artemis.Core/RGB.NET/BitmapBrush.cs | 7 ++++++- .../ProfileEditor/Visualization/ProfileLayerViewModel.cs | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 089379fc2..72e419954 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -35,6 +35,9 @@ namespace Artemis.Core.Models.Profile _properties = new Dictionary(); CreateDefaultProperties(); + CreateShapeType(); + + ShapeTypeProperty.ValueChanged += (sender, args) => CreateShapeType(); } internal Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity) diff --git a/src/Artemis.Core/RGB.NET/BitmapBrush.cs b/src/Artemis.Core/RGB.NET/BitmapBrush.cs index beb528044..9f03294a2 100644 --- a/src/Artemis.Core/RGB.NET/BitmapBrush.cs +++ b/src/Artemis.Core/RGB.NET/BitmapBrush.cs @@ -75,9 +75,14 @@ namespace Artemis.Core.RGB.NET { foreach (var renderTarget in renderTargets) { + if (renderTarget.Led.Id == LedId.Keyboard_W) + Console.WriteLine(); var scaledLocation = renderTarget.Point * Scale; if (scaledLocation.X < Bitmap.Width && scaledLocation.Y < Bitmap.Height) + { + var test = Bitmap.GetPixel(scaledLocation.X.RoundToInt(), scaledLocation.Y.RoundToInt()); RenderedTargets[renderTarget] = Bitmap.GetPixel(scaledLocation.X.RoundToInt(), scaledLocation.Y.RoundToInt()).ToRgbColor(); + } } } @@ -133,7 +138,7 @@ namespace Artemis.Core.RGB.NET { var width = Math.Min((rectangle.Location.X + rectangle.Size.Width) * Scale.Horizontal, 4096); var height = Math.Min((rectangle.Location.Y + rectangle.Size.Height) * Scale.Vertical, 4096); - Bitmap = new SKBitmap(new SKImageInfo(width.RoundToInt(), height.RoundToInt())); + Bitmap = new SKBitmap(new SKImageInfo(width.RoundToInt(), height.RoundToInt(), SKColorType.Rgb888x)); } /// diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs index 3a98d529b..e690ad9b3 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/Visualization/ProfileLayerViewModel.cs @@ -174,6 +174,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization public void Dispose() { Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated; + _profileEditorService.SelectedProfileElementChanged -= OnSelectedProfileElementChanged; + _profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated; + _profileEditorService.ProfilePreviewUpdated -= ProfileEditorServiceOnProfilePreviewUpdated; } #region Event handlers