Browse Source

Merge pull request #1443 from SixLabors/bp/bmpEnsureSpanLengthIsEqual

Ensure Span length of source and destination are equal during pixel conversion
js/color-alpha-handling
Brian Popow 5 years ago
committed by GitHub
parent
commit
9b9043f922
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
  2. 22
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs
  3. 22
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs
  4. 22
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs
  5. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs
  6. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs
  7. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs
  8. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs
  9. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs
  10. 22
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs
  11. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs
  12. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs
  13. 21
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs
  14. 6
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude

17
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

@ -262,7 +262,9 @@ namespace SixLabors.ImageSharp.Formats.Bmp
private void Write24Bit<TPixel>(Stream stream, Buffer2D<TPixel> pixels)
where TPixel : unmanaged, IPixel<TPixel>
{
using (IManagedByteBuffer row = this.AllocateRow(pixels.Width, 3))
int width = pixels.Width;
int rowBytesWithoutPadding = width * 3;
using (IManagedByteBuffer row = this.AllocateRow(width, 3))
{
for (int y = pixels.Height - 1; y >= 0; y--)
{
@ -270,8 +272,8 @@ namespace SixLabors.ImageSharp.Formats.Bmp
PixelOperations<TPixel>.Instance.ToBgr24Bytes(
this.configuration,
pixelSpan,
row.GetSpan(),
pixelSpan.Length);
row.Slice(0, rowBytesWithoutPadding),
width);
stream.Write(row.Array, 0, row.Length());
}
}
@ -286,7 +288,9 @@ namespace SixLabors.ImageSharp.Formats.Bmp
private void Write16Bit<TPixel>(Stream stream, Buffer2D<TPixel> pixels)
where TPixel : unmanaged, IPixel<TPixel>
{
using (IManagedByteBuffer row = this.AllocateRow(pixels.Width, 2))
int width = pixels.Width;
int rowBytesWithoutPadding = width * 2;
using (IManagedByteBuffer row = this.AllocateRow(width, 2))
{
for (int y = pixels.Height - 1; y >= 0; y--)
{
@ -295,7 +299,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
PixelOperations<TPixel>.Instance.ToBgra5551Bytes(
this.configuration,
pixelSpan,
row.GetSpan(),
row.Slice(0, rowBytesWithoutPadding),
pixelSpan.Length);
stream.Write(row.Array, 0, row.Length());
@ -341,7 +345,8 @@ namespace SixLabors.ImageSharp.Formats.Bmp
using IndexedImageFrame<TPixel> quantized = frameQuantizer.BuildPaletteAndQuantizeFrame(image, image.Bounds());
ReadOnlySpan<TPixel> quantizedColors = quantized.Palette.Span;
PixelOperations<TPixel>.Instance.ToBgra32(this.configuration, quantizedColors, MemoryMarshal.Cast<byte, Bgra32>(colorPalette));
var quantizedColorBytes = quantizedColors.Length * 4;
PixelOperations<TPixel>.Instance.ToBgra32(this.configuration, quantizedColors, MemoryMarshal.Cast<byte, Bgra32>(colorPalette.Slice(0, quantizedColorBytes)));
Span<uint> colorPaletteAsUInt = MemoryMarshal.Cast<byte, uint>(colorPalette);
for (int i = 0; i < colorPaletteAsUInt.Length; i++)
{

22
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Argb32>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> source, Span<Argb32> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void FromVector4Destructive(
Configuration configuration,
@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale));
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Argb32, byte>(destinationPixels);
PixelConverter.FromRgba32.ToArgb32(source, dest);
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Argb32, byte>(destinationPixels);
PixelConverter.FromBgra32.ToArgb32(source, dest);
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Argb32, byte>(destinationPixels);
PixelConverter.FromRgb24.ToArgb32(source, dest);
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Argb32, byte>(destinationPixels);
PixelConverter.FromBgr24.ToArgb32(source, dest);
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Argb32> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToArgb32(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToArgb32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

22
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Bgr24>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromBgr24(Configuration configuration, ReadOnlySpan<Bgr24> source, Span<Bgr24> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void FromVector4Destructive(
Configuration configuration,
@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply));
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgr24, byte>(destinationPixels);
PixelConverter.FromRgba32.ToBgr24(source, dest);
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgr24, byte>(destinationPixels);
PixelConverter.FromArgb32.ToBgr24(source, dest);
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgr24, byte>(destinationPixels);
PixelConverter.FromBgra32.ToBgr24(source, dest);
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgr24, byte>(destinationPixels);
PixelConverter.FromRgb24.ToBgr24(source, dest);
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Bgr24> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToBgr24(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToBgr24(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

22
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Bgra32>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> source, Span<Bgra32> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void FromVector4Destructive(
Configuration configuration,
@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale));
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgra32, byte>(destinationPixels);
PixelConverter.FromRgba32.ToBgra32(source, dest);
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgra32, byte>(destinationPixels);
PixelConverter.FromArgb32.ToBgra32(source, dest);
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgra32, byte>(destinationPixels);
PixelConverter.FromRgb24.ToBgra32(source, dest);
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Bgra32, byte>(destinationPixels);
PixelConverter.FromBgr24.ToBgra32(source, dest);
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Bgra32> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToBgra32(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToBgra32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Bgra5551>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromBgra5551(Configuration configuration, ReadOnlySpan<Bgra5551> source, Span<Bgra5551> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra5551(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Bgra5551> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToBgra5551(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToBgra5551(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<L16>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromL16(Configuration configuration, ReadOnlySpan<L16> source, Span<L16> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL16(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<L16> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToL16(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToL16(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<L8>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromL8(Configuration configuration, ReadOnlySpan<L8> source, Span<L8> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromL8(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<L8> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToL8(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToL8(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<La16>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromLa16(Configuration configuration, ReadOnlySpan<La16> source, Span<La16> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa16(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<La16> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToLa16(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToLa16(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La32.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<La32>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromLa32(Configuration configuration, ReadOnlySpan<La32> source, Span<La32> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromLa32(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<La32> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToLa32(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToLa32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

22
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Rgb24>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromRgb24(Configuration configuration, ReadOnlySpan<Rgb24> source, Span<Rgb24> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void FromVector4Destructive(
Configuration configuration,
@ -59,7 +57,6 @@ namespace SixLabors.ImageSharp.PixelFormats
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, modifiers.Remove(PixelConversionModifiers.Scale | PixelConversionModifiers.Premultiply));
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -87,7 +84,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgb24, byte>(destinationPixels);
PixelConverter.FromRgba32.ToRgb24(source, dest);
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -115,7 +111,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgb24, byte>(destinationPixels);
PixelConverter.FromArgb32.ToRgb24(source, dest);
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -143,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgb24, byte>(destinationPixels);
PixelConverter.FromBgra32.ToRgb24(source, dest);
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -171,7 +165,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgb24, byte>(destinationPixels);
PixelConverter.FromBgr24.ToRgb24(source, dest);
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -192,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -213,7 +205,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -234,7 +225,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -255,7 +245,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -276,7 +265,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -297,7 +285,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -318,14 +305,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Rgb24> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToRgb24(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToRgb24(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Rgb48>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromRgb48(Configuration configuration, ReadOnlySpan<Rgb48> source, Span<Rgb48> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Rgb48> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToRgb48(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToRgb48(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba32.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Rgba32>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> source, Span<Rgba32> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -67,7 +65,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgba32, byte>(destinationPixels);
PixelConverter.FromArgb32.ToRgba32(source, dest);
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -95,7 +92,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgba32, byte>(destinationPixels);
PixelConverter.FromBgra32.ToRgba32(source, dest);
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -123,7 +119,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgba32, byte>(destinationPixels);
PixelConverter.FromRgb24.ToRgba32(source, dest);
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -151,7 +146,6 @@ namespace SixLabors.ImageSharp.PixelFormats
Span<byte> dest = MemoryMarshal.Cast<Rgba32, byte>(destinationPixels);
PixelConverter.FromBgr24.ToRgba32(source, dest);
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -172,7 +166,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -193,7 +186,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -214,7 +206,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -235,7 +226,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -256,7 +246,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToRgba64(
Configuration configuration,
@ -277,7 +266,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -298,14 +286,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Rgba32> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToRgba32(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToRgba32(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

21
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgba64.PixelOperations.Generated.cs

@ -21,14 +21,13 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary>
internal partial class PixelOperations : PixelOperations<Rgba64>
{
/// <inheritdoc />
/// <inheritdoc />
public override void FromRgba64(Configuration configuration, ReadOnlySpan<Rgba64> source, Span<Rgba64> destinationPixels)
{
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -37,9 +36,8 @@ namespace SixLabors.ImageSharp.PixelFormats
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
/// <inheritdoc />
public override void ToArgb32(
Configuration configuration,
@ -60,7 +58,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToBgr24(
Configuration configuration,
@ -81,7 +78,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToBgra32(
Configuration configuration,
@ -102,7 +98,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToL8(
Configuration configuration,
@ -123,7 +118,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToL16(
Configuration configuration,
@ -144,7 +138,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToLa16(
Configuration configuration,
@ -165,7 +158,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToLa32(
Configuration configuration,
@ -186,7 +178,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToRgb24(
Configuration configuration,
@ -207,7 +198,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToRgba32(
Configuration configuration,
@ -228,7 +218,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToRgb48(
Configuration configuration,
@ -249,7 +238,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void ToBgra5551(
Configuration configuration,
@ -270,14 +258,13 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp);
}
}
/// <inheritdoc />
public override void From<TSourcePixel>(
Configuration configuration,
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<Rgba64> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.ToRgba64(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.ToRgba64(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
}

6
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude

@ -57,7 +57,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils;
ReadOnlySpan<TSourcePixel> sourcePixels,
Span<<#=pixelType#>> destinationPixels)
{
PixelOperations<TSourcePixel>.Instance.To<#=pixelType#>(configuration, sourcePixels, destinationPixels);
PixelOperations<TSourcePixel>.Instance.To<#=pixelType#>(configuration, sourcePixels, destinationPixels.Slice(0, sourcePixels.Length));
}
<#+
@ -72,7 +72,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils;
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destinationPixels, nameof(destinationPixels));
source.CopyTo(destinationPixels);
source.CopyTo(destinationPixels.Slice(0, source.Length));
}
/// <inheritdoc />
@ -81,7 +81,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils;
Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationPixels, nameof(destinationPixels));
sourcePixels.CopyTo(destinationPixels);
sourcePixels.CopyTo(destinationPixels.Slice(0, sourcePixels.Length));
}
<#+
}

Loading…
Cancel
Save