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

Fixed layer shape missing in some instances

This commit is contained in:
SpoinkyNL 2020-02-06 19:10:47 +01:00
parent dd9c701738
commit 8f073a5d42
3 changed files with 12 additions and 1 deletions

View File

@ -35,6 +35,9 @@ namespace Artemis.Core.Models.Profile
_properties = new Dictionary<string, BaseLayerProperty>();
CreateDefaultProperties();
CreateShapeType();
ShapeTypeProperty.ValueChanged += (sender, args) => CreateShapeType();
}
internal Layer(Profile profile, ProfileElement parent, LayerEntity layerEntity)

View File

@ -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));
}
/// <inheritdoc />

View File

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