mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Further RGB.NET updates
This commit is contained in:
parent
5bcba8a4a5
commit
4b914718e6
@ -49,7 +49,7 @@ namespace Artemis.Core.LayerBrushes
|
|||||||
LedGroup.ZIndex = 1;
|
LedGroup.ZIndex = 1;
|
||||||
|
|
||||||
List<Led> missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
List<Led> missingLeds = Layer.Leds.Where(l => !LedGroup.ContainsLed(l.RgbLed)).Select(l => l.RgbLed).ToList();
|
||||||
List<Led> extraLeds = LedGroup.GetLeds().Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
List<Led> extraLeds = LedGroup.Where(l => Layer.Leds.All(layerLed => layerLed.RgbLed != l)).ToList();
|
||||||
LedGroup.AddLeds(missingLeds);
|
LedGroup.AddLeds(missingLeds);
|
||||||
LedGroup.RemoveLeds(extraLeds);
|
LedGroup.RemoveLeds(extraLeds);
|
||||||
LedGroup.Brush = GetBrush();
|
LedGroup.Brush = GetBrush();
|
||||||
@ -78,7 +78,7 @@ namespace Artemis.Core.LayerBrushes
|
|||||||
throw new ArtemisCoreException("Cannot dispose RGB.NET layer brush because RgbService is not set");
|
throw new ArtemisCoreException("Cannot dispose RGB.NET layer brush because RgbService is not set");
|
||||||
|
|
||||||
Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated;
|
Layer.RenderPropertiesUpdated -= LayerOnRenderPropertiesUpdated;
|
||||||
LedGroup?.Detach(RgbService.Surface);
|
LedGroup?.Detach();
|
||||||
LedGroup = null;
|
LedGroup = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Artemis.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a SkiaSharp-based RGB.NET PixelTexture
|
/// Represents a SkiaSharp-based RGB.NET PixelTexture
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class SKTexture : PixelTexture<byte>
|
public sealed class SKTexture : PixelTexture<byte>, IDisposable
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
@ -42,6 +42,12 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected override ReadOnlySpan<byte> Data => Bitmap.GetPixelSpan();
|
protected override ReadOnlySpan<byte> Data => Bitmap.GetPixelSpan();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Bitmap.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,10 +258,8 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
private void InvalidateBitmap()
|
private void InvalidateBitmap()
|
||||||
{
|
{
|
||||||
|
|
||||||
lock (_bitmapLock)
|
lock (_bitmapLock)
|
||||||
{
|
{
|
||||||
_bitmap?.Dispose();
|
|
||||||
_bitmap = null;
|
_bitmap = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace Artemis.Core.Services
|
|||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
ledGroup.Detach(_rgbService.Surface);
|
ledGroup.Detach();
|
||||||
|
|
||||||
if (blinkCount < 5)
|
if (blinkCount < 5)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -136,8 +136,11 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
public void UpdateTexture(SKBitmap bitmap)
|
public void UpdateTexture(SKBitmap bitmap)
|
||||||
{
|
{
|
||||||
|
SKTexture? oldTexture = Texture;
|
||||||
Texture = new SKTexture(bitmap);
|
Texture = new SKTexture(bitmap);
|
||||||
TextureBrush.Texture = Texture;
|
TextureBrush.Texture = Texture;
|
||||||
|
|
||||||
|
oldTexture?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SurfaceOnLayoutChanged(SurfaceLayoutChangedEventArgs args) => UpdateLedGroup();
|
private void SurfaceOnLayoutChanged(SurfaceLayoutChangedEventArgs args) => UpdateLedGroup();
|
||||||
@ -161,7 +164,7 @@ namespace Artemis.Core.Services
|
|||||||
lock (_surfaceLedGroup)
|
lock (_surfaceLedGroup)
|
||||||
{
|
{
|
||||||
// Clean up the old background
|
// Clean up the old background
|
||||||
_surfaceLedGroup.Detach(Surface);
|
_surfaceLedGroup.Detach();
|
||||||
|
|
||||||
// Apply the application wide brush and decorator
|
// Apply the application wide brush and decorator
|
||||||
_surfaceLedGroup = new ListLedGroup(Surface, LedMap.Select(l => l.Key)) { Brush = TextureBrush };
|
_surfaceLedGroup = new ListLedGroup(Surface, LedMap.Select(l => l.Key)) { Brush = TextureBrush };
|
||||||
|
|||||||
@ -43,7 +43,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
|||||||
{
|
{
|
||||||
base.OnDialogClosed(sender, e);
|
base.OnDialogClosed(sender, e);
|
||||||
_inputService.DeviceIdentified -= InputServiceOnDeviceIdentified;
|
_inputService.DeviceIdentified -= InputServiceOnDeviceIdentified;
|
||||||
_ledGroup.Detach(_rgbService.Surface);
|
_ledGroup.Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InputServiceOnDeviceIdentified(object sender, EventArgs e)
|
private void InputServiceOnDeviceIdentified(object sender, EventArgs e)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user