mirror of https://github.com/SixLabors/ImageSharp
48 changed files with 1466 additions and 65 deletions
@ -0,0 +1,252 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
// <auto-generated />
|
||||
|
|
||||
|
using SixLabors.ImageSharp.PixelFormats.Utils; |
||||
|
using System; |
||||
|
using System.Buffers; |
||||
|
using System.Numerics; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
|
||||
|
namespace SixLabors.ImageSharp.PixelFormats |
||||
|
{ |
||||
|
/// <content>
|
||||
|
/// Provides optimized overrides for bulk operations.
|
||||
|
/// </content>
|
||||
|
public partial struct La16 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Provides optimized overrides for bulk operations.
|
||||
|
/// </summary>
|
||||
|
internal class PixelOperations : PixelOperations<La16> |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
internal override void FromLa16(Configuration configuration, ReadOnlySpan<La16> source, Span<La16> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
source.CopyTo(destPixels); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToLa16(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<La16> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
sourcePixels.CopyTo(destPixels); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Argb32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Argb32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Argb32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Bgr24> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Bgra32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgra32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToL8(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<L8> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref L8 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref L8 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToL16(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<L16> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref L16 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToLa32(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<La32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref La32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref La32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Rgb24> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Rgba32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgba32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Rgb48> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Rgba64> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgra5551(Configuration configuration, ReadOnlySpan<La16> sourcePixels, Span<Bgra5551> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La16 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa16(sp); |
||||
|
} |
||||
|
} |
||||
|
/// <inheritdoc />
|
||||
|
internal override void From<TSourcePixel>( |
||||
|
Configuration configuration, |
||||
|
ReadOnlySpan<TSourcePixel> sourcePixels, |
||||
|
Span<La16> destinationPixels) |
||||
|
{ |
||||
|
PixelOperations<TSourcePixel>.Instance.ToLa16(configuration, sourcePixels, destinationPixels); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
<#@include file="_Common.ttinclude" #> |
||||
|
<#@ output extension=".cs" #> |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.PixelFormats |
||||
|
{ |
||||
|
/// <content> |
||||
|
/// Provides optimized overrides for bulk operations. |
||||
|
/// </content> |
||||
|
public partial struct La16 |
||||
|
{ |
||||
|
/// <summary> |
||||
|
/// Provides optimized overrides for bulk operations. |
||||
|
/// </summary> |
||||
|
internal class PixelOperations : PixelOperations<La16> |
||||
|
{ |
||||
|
<# GenerateAllDefaultConversionMethods("La16"); #> |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,252 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
// <auto-generated />
|
||||
|
|
||||
|
using SixLabors.ImageSharp.PixelFormats.Utils; |
||||
|
using System; |
||||
|
using System.Buffers; |
||||
|
using System.Numerics; |
||||
|
using System.Runtime.CompilerServices; |
||||
|
using System.Runtime.InteropServices; |
||||
|
|
||||
|
|
||||
|
namespace SixLabors.ImageSharp.PixelFormats |
||||
|
{ |
||||
|
/// <content>
|
||||
|
/// Provides optimized overrides for bulk operations.
|
||||
|
/// </content>
|
||||
|
public partial struct La32 |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Provides optimized overrides for bulk operations.
|
||||
|
/// </summary>
|
||||
|
internal class PixelOperations : PixelOperations<La32> |
||||
|
{ |
||||
|
/// <inheritdoc />
|
||||
|
internal override void FromLa32(Configuration configuration, ReadOnlySpan<La32> source, Span<La32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
source.CopyTo(destPixels); |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToLa32(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<La32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
sourcePixels.CopyTo(destPixels); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Argb32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Argb32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Argb32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Bgr24> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgr24 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Bgra32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgra32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToL8(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<L8> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref L8 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref L8 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToL16(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<L16> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref L16 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref L16 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToLa16(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<La16> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref La16 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref La16 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Rgb24> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgb24 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Rgba32> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgba32 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Rgb48> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgb48 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Rgba64> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Rgba64 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <inheritdoc />
|
||||
|
internal override void ToBgra5551(Configuration configuration, ReadOnlySpan<La32> sourcePixels, Span<Bgra5551> destPixels) |
||||
|
{ |
||||
|
Guard.NotNull(configuration, nameof(configuration)); |
||||
|
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); |
||||
|
|
||||
|
ref La32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); |
||||
|
ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destPixels); |
||||
|
|
||||
|
for (int i = 0; i < sourcePixels.Length; i++) |
||||
|
{ |
||||
|
ref La32 sp = ref Unsafe.Add(ref sourceRef, i); |
||||
|
ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); |
||||
|
|
||||
|
dp.FromLa32(sp); |
||||
|
} |
||||
|
} |
||||
|
/// <inheritdoc />
|
||||
|
internal override void From<TSourcePixel>( |
||||
|
Configuration configuration, |
||||
|
ReadOnlySpan<TSourcePixel> sourcePixels, |
||||
|
Span<La32> destinationPixels) |
||||
|
{ |
||||
|
PixelOperations<TSourcePixel>.Instance.ToLa32(configuration, sourcePixels, destinationPixels); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
<#@include file="_Common.ttinclude" #> |
||||
|
<#@ output extension=".cs" #> |
||||
|
|
||||
|
namespace SixLabors.ImageSharp.PixelFormats |
||||
|
{ |
||||
|
/// <content> |
||||
|
/// Provides optimized overrides for bulk operations. |
||||
|
/// </content> |
||||
|
public partial struct La32 |
||||
|
{ |
||||
|
/// <summary> |
||||
|
/// Provides optimized overrides for bulk operations. |
||||
|
/// </summary> |
||||
|
internal class PixelOperations : PixelOperations<La32> |
||||
|
{ |
||||
|
<# GenerateAllDefaultConversionMethods("La32"); #> |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue