38 lines
848 B
C#
38 lines
848 B
C#
using System.Runtime.CompilerServices;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace View_by_Distance.ThumbHash.Models;
|
|
|
|
public static partial class ThumbHash
|
|
{
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
private readonly struct RGBA
|
|
{
|
|
|
|
public byte R { init; get; }
|
|
public byte G { init; get; }
|
|
public byte B { init; get; }
|
|
public byte A { init; get; }
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public RGBA(byte r, byte g, byte b, byte a)
|
|
{
|
|
R = r;
|
|
G = g;
|
|
B = b;
|
|
A = a;
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public void Deconstruct(out byte r, out byte g, out byte b, out byte a)
|
|
{
|
|
r = R;
|
|
g = G;
|
|
b = B;
|
|
a = A;
|
|
}
|
|
|
|
}
|
|
|
|
} |