|
|
|
@ -4,6 +4,8 @@ |
|
|
|
// <auto-generated />
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Buffers; |
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
@ -24,6 +26,7 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> source, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
source.CopyTo(destPixels); |
|
|
|
@ -32,109 +35,167 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
sourcePixels.CopyTo(destPixels); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgr24> destPixels) |
|
|
|
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
this.RunRgba32CompatibleFromVector4Conversion(configuration, sourceVectors, destPixels); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors) |
|
|
|
{ |
|
|
|
this.RunRgba32CompatibleToVector4Conversion(configuration, sourcePixels, destVectors); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
this.RunRgba32CompatibleFromVector4Conversion(configuration, sourceVectors, destPixels); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors) |
|
|
|
{ |
|
|
|
this.RunRgba32CompatibleToVector4Conversion(configuration, sourcePixels, destVectors); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); |
|
|
|
ref uint destRef = ref Unsafe.As<Rgba32, uint>(ref MemoryMarshal.GetReference(destPixels)); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
uint sp = Unsafe.Add(ref sourceRef, i); |
|
|
|
Unsafe.Add(ref destRef, i) = PixelConverter.FromArgb32.ToRgba32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels) |
|
|
|
internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); |
|
|
|
ref uint destRef = ref Unsafe.As<Argb32, uint>(ref MemoryMarshal.GetReference(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Bgra32 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
uint sp = Unsafe.Add(ref sourceRef, i); |
|
|
|
Unsafe.Add(ref destRef, i) = PixelConverter.FromRgba32.ToArgb32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); |
|
|
|
ref uint destRef = ref Unsafe.As<Bgra32, uint>(ref MemoryMarshal.GetReference(destPixels)); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
uint sp = Unsafe.Add(ref sourceRef, i); |
|
|
|
Unsafe.Add(ref destRef, i) = PixelConverter.FromArgb32.ToBgra32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Argb32> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); |
|
|
|
ref uint destRef = ref Unsafe.As<Argb32, uint>(ref MemoryMarshal.GetReference(destPixels)); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
uint sp = Unsafe.Add(ref sourceRef, i); |
|
|
|
Unsafe.Add(ref destRef, i) = PixelConverter.FromBgra32.ToArgb32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray8> destPixels) |
|
|
|
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgr24> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Gray8 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Gray8 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray16> destPixels) |
|
|
|
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray8> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
ref Gray8 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Gray16 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
ref Gray8 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb24> destPixels) |
|
|
|
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray16> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
ref Gray16 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
ref Gray16 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels) |
|
|
|
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb24> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
ref Rgba32 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels); |
|
|
|
|
|
|
|
for (int i = 0; i < sourcePixels.Length; i++) |
|
|
|
{ |
|
|
|
ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); |
|
|
|
ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); |
|
|
|
|
|
|
|
dp.FromArgb32(sp); |
|
|
|
} |
|
|
|
@ -143,6 +204,7 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb48> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
@ -160,6 +222,7 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// <inheritdoc />
|
|
|
|
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba64> destPixels) |
|
|
|
{ |
|
|
|
Guard.NotNull(configuration, nameof(configuration)); |
|
|
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
|
|
|
|
|
|
|
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
|
|
|
|