mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Devices - Ported color correction code to RGB.NET
This commit is contained in:
1 parent
2e859bc84c
commit
1ea2e2bee7
6 files changed
+55
-30
No files matched your search
@@ -5,23 +5,17 @@ using SkiaSharp;
|
||||
|
||||
namespace Artemis.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SkiaSharp-based RGB.NET PixelTexture
|
||||
/// </summary>
|
||||
public sealed class SKTexture : PixelTexture<byte>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private readonly SKBitmap _bitmap;
|
||||
public SKBitmap Bitmap => _bitmap;
|
||||
|
||||
protected override ReadOnlySpan<byte> Data => _bitmap.GetPixelSpan();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public SKTexture(SKBitmap bitmap)
|
||||
internal SKTexture(SKBitmap bitmap)
|
||||
: base(bitmap.Width, bitmap.Height, 4, new AverageByteSampler())
|
||||
{
|
||||
this._bitmap = bitmap;
|
||||
Bitmap = bitmap;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -29,8 +23,25 @@ namespace Artemis.Core
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColor(in ReadOnlySpan<byte> pixel) => new(pixel[0], pixel[1], pixel[2]);
|
||||
protected override Color GetColor(in ReadOnlySpan<byte> pixel)
|
||||
{
|
||||
return new(pixel[0], pixel[1], pixel[2]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SKBitmap backing this texture
|
||||
/// </summary>
|
||||
public SKBitmap Bitmap { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color data in RGB format
|
||||
/// </summary>
|
||||
protected override ReadOnlySpan<byte> Data => Bitmap.GetPixelSpan();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user