Browse Source

Merge branch 'master' into dl/upgrade-magick-net

af/merge-core
Anton Firsov 8 years ago
committed by GitHub
parent
commit
2a1f4bbe2c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 97
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.cs
  2. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.tt
  3. 85
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.cs
  4. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.tt
  5. 97
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.cs
  6. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.tt
  7. 44
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.cs
  8. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.tt
  9. 44
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray8.PixelOperations.Generated.cs
  10. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray8.PixelOperations.Generated.tt
  11. 85
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.cs
  12. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.tt
  13. 44
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.cs
  14. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.tt
  15. 56
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.cs
  16. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.tt
  17. 44
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.cs
  18. 9
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.tt
  19. 142
      src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Argb32> internal class PixelOperations : PixelOperations<Argb32>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> source, Span<Argb32> destPixels) internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> source, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,41 +35,40 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels)
{
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels) internal override void ToVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
} }
/// <inheritdoc />
internal override void ToVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors)
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels) internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Argb32> destPixels)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true); Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors) internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -83,10 +81,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Argb32> destPixels) internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -98,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
Unsafe.Add(ref destRef, i) = PixelConverter.FromRgba32.ToArgb32(sp); Unsafe.Add(ref destRef, i) = PixelConverter.FromRgba32.ToArgb32(sp);
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -114,10 +112,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Argb32> destPixels) internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -130,10 +128,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -148,10 +146,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -166,10 +164,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -184,10 +182,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -202,10 +200,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -220,10 +218,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -237,7 +235,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromArgb32(sp); dp.FromArgb32(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Argb32.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Argb32> internal class PixelOperations : PixelOperations<Argb32>
{ {
<# <# GenerateAllDefaultConversionMethods("Argb32"); #>
GenerateAllDefaultConversionMethods("Argb32"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Bgr24> internal class PixelOperations : PixelOperations<Bgr24>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromBgr24(Configuration configuration, ReadOnlySpan<Bgr24> source, Span<Bgr24> destPixels) internal override void FromBgr24(Configuration configuration, ReadOnlySpan<Bgr24> source, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,42 +35,41 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgr24> destPixels)
{
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgr24> destPixels) internal override void ToVector4(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
} }
/// <inheritdoc />
internal override void ToVector4(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Vector4> destVectors)
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgr24> destPixels) internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgr24> destPixels)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true); Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Vector4> destVectors) internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -86,10 +84,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -104,10 +102,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -122,10 +120,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -140,10 +138,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -158,10 +156,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -176,10 +174,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -194,10 +192,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Bgr24> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -211,7 +209,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgr24(sp); dp.FromBgr24(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgr24.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Bgr24> internal class PixelOperations : PixelOperations<Bgr24>
{ {
<# <# GenerateAllDefaultConversionMethods("Bgr24"); #>
GenerateAllDefaultConversionMethods("Bgr24"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Bgra32> internal class PixelOperations : PixelOperations<Bgra32>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> source, Span<Bgra32> destPixels) internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> source, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,41 +35,40 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgra32> destPixels)
{
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgra32> destPixels) internal override void ToVector4(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
} }
/// <inheritdoc />
internal override void ToVector4(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Vector4> destVectors)
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgra32> destPixels) internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Bgra32> destPixels)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true); Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Vector4> destVectors) internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -83,10 +81,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgra32> destPixels) internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -98,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
Unsafe.Add(ref destRef, i) = PixelConverter.FromRgba32.ToBgra32(sp); Unsafe.Add(ref destRef, i) = PixelConverter.FromRgba32.ToBgra32(sp);
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -114,10 +112,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels) internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -130,10 +128,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -148,10 +146,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -166,10 +164,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -184,10 +182,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -202,10 +200,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -220,10 +218,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -237,7 +235,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromBgra32(sp); dp.FromBgra32(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Bgra32.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Bgra32> internal class PixelOperations : PixelOperations<Bgra32>
{ {
<# <# GenerateAllDefaultConversionMethods("Bgra32"); #>
GenerateAllDefaultConversionMethods("Bgra32"); }
#> }
}
}
} }

44
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.cs

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Gray16> internal class PixelOperations : PixelOperations<Gray16>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromGray16(Configuration configuration, ReadOnlySpan<Gray16> source, Span<Gray16> destPixels) internal override void FromGray16(Configuration configuration, ReadOnlySpan<Gray16> source, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,17 +35,17 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -61,10 +60,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -79,10 +78,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -97,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -115,10 +114,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -133,10 +132,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -151,10 +150,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -169,10 +168,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Gray16> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -186,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromGray16(sp); dp.FromGray16(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray16.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Gray16> internal class PixelOperations : PixelOperations<Gray16>
{ {
<# <# GenerateAllDefaultConversionMethods("Gray16"); #>
GenerateAllDefaultConversionMethods("Gray16"); }
#> }
}
}
} }

44
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray8.PixelOperations.Generated.cs

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Gray8> internal class PixelOperations : PixelOperations<Gray8>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromGray8(Configuration configuration, ReadOnlySpan<Gray8> source, Span<Gray8> destPixels) internal override void FromGray8(Configuration configuration, ReadOnlySpan<Gray8> source, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,17 +35,17 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -61,10 +60,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -79,10 +78,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -97,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -115,10 +114,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -133,10 +132,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -151,10 +150,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -169,10 +168,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Gray8> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Gray8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -186,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromGray8(sp); dp.FromGray8(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Gray8.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Gray8> internal class PixelOperations : PixelOperations<Gray8>
{ {
<# <# GenerateAllDefaultConversionMethods("Gray8"); #>
GenerateAllDefaultConversionMethods("Gray8"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgb24> internal class PixelOperations : PixelOperations<Rgb24>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromRgb24(Configuration configuration, ReadOnlySpan<Rgb24> source, Span<Rgb24> destPixels) internal override void FromRgb24(Configuration configuration, ReadOnlySpan<Rgb24> source, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,42 +35,41 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Rgb24> destPixels)
{
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Rgb24> destPixels) internal override void ToVector4(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
} }
/// <inheritdoc />
internal override void ToVector4(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Vector4> destVectors)
{
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
}
/// <inheritdoc /> /// <inheritdoc />
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Rgb24> destPixels) internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<Rgb24> destPixels)
{ {
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true); Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Vector4> destVectors) internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Vector4> destVectors)
{ {
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true); Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -86,10 +84,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -104,10 +102,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -122,10 +120,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -140,10 +138,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -158,10 +156,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -176,10 +174,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -194,10 +192,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgb24> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -211,7 +209,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb24(sp); dp.FromRgb24(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb24.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgb24> internal class PixelOperations : PixelOperations<Rgb24>
{ {
<# <# GenerateAllDefaultConversionMethods("Rgb24"); #>
GenerateAllDefaultConversionMethods("Rgb24"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgb48> internal class PixelOperations : PixelOperations<Rgb48>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromRgb48(Configuration configuration, ReadOnlySpan<Rgb48> source, Span<Rgb48> destPixels) internal override void FromRgb48(Configuration configuration, ReadOnlySpan<Rgb48> source, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,17 +35,17 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -61,10 +60,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -79,10 +78,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -97,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -115,10 +114,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -133,10 +132,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -151,10 +150,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -169,10 +168,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgb48> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -186,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgb48(sp); dp.FromRgb48(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgb48.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgb48> internal class PixelOperations : PixelOperations<Rgb48>
{ {
<# <# GenerateAllDefaultConversionMethods("Rgb48"); #>
GenerateAllDefaultConversionMethods("Rgb48"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal partial class PixelOperations : PixelOperations<Rgba32> internal partial class PixelOperations : PixelOperations<Rgba32>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> source, Span<Rgba32> destPixels) internal override void FromRgba32(Configuration configuration, ReadOnlySpan<Rgba32> source, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,16 +35,16 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -58,10 +57,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels) internal override void FromArgb32(Configuration configuration, ReadOnlySpan<Argb32> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Argb32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -73,10 +72,10 @@ namespace SixLabors.ImageSharp.PixelFormats
Unsafe.Add(ref destRef, i) = PixelConverter.FromArgb32.ToRgba32(sp); Unsafe.Add(ref destRef, i) = PixelConverter.FromArgb32.ToRgba32(sp);
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Rgba32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -89,10 +88,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba32> destPixels) internal override void FromBgra32(Configuration configuration, ReadOnlySpan<Bgra32> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<Bgra32,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -105,10 +104,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -123,10 +122,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -141,10 +140,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -159,10 +158,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -177,10 +176,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -195,10 +194,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgba32> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -212,7 +211,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba32(sp); dp.FromRgba32(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba32.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal partial class PixelOperations : PixelOperations<Rgba32> internal partial class PixelOperations : PixelOperations<Rgba32>
{ {
<# <# GenerateAllDefaultConversionMethods("Rgba32"); #>
GenerateAllDefaultConversionMethods("Rgba32"); }
#> }
}
}
} }

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

@ -23,11 +23,10 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgba64> internal class PixelOperations : PixelOperations<Rgba64>
{ {
/// <inheritdoc />
/// <inheritdoc />
internal override void FromRgba64(Configuration configuration, ReadOnlySpan<Rgba64> source, Span<Rgba64> destPixels) internal override void FromRgba64(Configuration configuration, ReadOnlySpan<Rgba64> source, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -36,17 +35,17 @@ namespace SixLabors.ImageSharp.PixelFormats
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgba64> destPixels) internal override void ToRgba64(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgba64> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Argb32> destPixels) internal override void ToArgb32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Argb32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -61,10 +60,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Bgr24> destPixels) internal override void ToBgr24(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Bgr24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -79,10 +78,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Bgra32> destPixels) internal override void ToBgra32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Bgra32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -97,10 +96,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Gray8> destPixels) internal override void ToGray8(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Gray8> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -115,10 +114,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Gray16> destPixels) internal override void ToGray16(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Gray16> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -133,10 +132,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgb24> destPixels) internal override void ToRgb24(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgb24> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -151,10 +150,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgba32> destPixels) internal override void ToRgba32(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgba32> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -169,10 +168,10 @@ namespace SixLabors.ImageSharp.PixelFormats
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgb48> destPixels) internal override void ToRgb48(Configuration configuration, ReadOnlySpan<Rgba64> sourcePixels, Span<Rgb48> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -186,7 +185,6 @@ namespace SixLabors.ImageSharp.PixelFormats
dp.FromRgba64(sp); dp.FromRgba64(sp);
} }
} }
}
} }
}
} }

9
src/ImageSharp/PixelFormats/PixelImplementations/Generated/Rgba64.PixelOperations.Generated.tt

@ -13,10 +13,7 @@ namespace SixLabors.ImageSharp.PixelFormats
/// </summary> /// </summary>
internal class PixelOperations : PixelOperations<Rgba64> internal class PixelOperations : PixelOperations<Rgba64>
{ {
<# <# GenerateAllDefaultConversionMethods("Rgba64"); #>
GenerateAllDefaultConversionMethods("Rgba64"); }
#> }
}
}
} }

142
src/ImageSharp/PixelFormats/PixelImplementations/Generated/_Common.ttinclude

@ -15,21 +15,20 @@ using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
<#+ <#+
static readonly string[] CommonPixelTypes = { "Argb32", "Bgr24", "Bgra32", "Gray8", "Gray16", "Rgb24", "Rgba32", "Rgb48", "Rgba64" }; static readonly string[] CommonPixelTypes = { "Argb32", "Bgr24", "Bgra32", "Gray8", "Gray16", "Rgb24", "Rgba32", "Rgb48", "Rgba64" };
static readonly string[] Optimized32BitTypes = { "Rgba32", "Argb32", "Bgra32" }; static readonly string[] Optimized32BitTypes = { "Rgba32", "Argb32", "Bgra32" };
// Types with Rgba32-combatible to/from Vector4 conversion // Types with Rgba32-combatible to/from Vector4 conversion
static readonly string[] Rgba32CompatibleTypes = { "Argb32", "Bgra32", "Rgb24", "Bgr24" }; static readonly string[] Rgba32CompatibleTypes = { "Argb32", "Bgra32", "Rgb24", "Bgr24" };
void GenerateDefaultSelfConversionMethods(string pixelType) void GenerateDefaultSelfConversionMethods(string pixelType)
{ {
#> #>
/// <inheritdoc />
/// <inheritdoc />
internal override void From<#=pixelType#>(Configuration configuration, ReadOnlySpan<<#=pixelType#>> source, Span<<#=pixelType#>> destPixels) internal override void From<#=pixelType#>(Configuration configuration, ReadOnlySpan<<#=pixelType#>> source, Span<<#=pixelType#>> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(source, destPixels, nameof(destPixels));
source.CopyTo(destPixels); source.CopyTo(destPixels);
@ -38,23 +37,23 @@ using System.Runtime.InteropServices;
/// <inheritdoc /> /// <inheritdoc />
internal override void To<#=pixelType#>(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<<#=pixelType#>> destPixels) internal override void To<#=pixelType#>(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<<#=pixelType#>> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
sourcePixels.CopyTo(destPixels); sourcePixels.CopyTo(destPixels);
} }
<#+ <#+
} }
void GenerateDefaultConvertToMethod(string fromPixelType, string toPixelType) void GenerateDefaultConvertToMethod(string fromPixelType, string toPixelType)
{ {
#> #>
/// <inheritdoc /> /// <inheritdoc />
internal override void To<#=toPixelType#>(Configuration configuration, ReadOnlySpan<<#=fromPixelType#>> sourcePixels, Span<<#=toPixelType#>> destPixels) internal override void To<#=toPixelType#>(Configuration configuration, ReadOnlySpan<<#=fromPixelType#>> sourcePixels, Span<<#=toPixelType#>> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref <#=fromPixelType#> sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref <#=fromPixelType#> sourceRef = ref MemoryMarshal.GetReference(sourcePixels);
@ -68,16 +67,16 @@ using System.Runtime.InteropServices;
dp.From<#=fromPixelType#>(sp); dp.From<#=fromPixelType#>(sp);
} }
} }
<#+ <#+
} }
void GenerateOptimized32BitConversionMethods(string thisPixelType, string otherPixelType) void GenerateOptimized32BitConversionMethods(string thisPixelType, string otherPixelType)
{ {
#> #>
/// <inheritdoc /> /// <inheritdoc />
internal override void To<#=otherPixelType#>(Configuration configuration, ReadOnlySpan<<#=thisPixelType#>> sourcePixels, Span<<#=otherPixelType#>> destPixels) internal override void To<#=otherPixelType#>(Configuration configuration, ReadOnlySpan<<#=thisPixelType#>> sourcePixels, Span<<#=otherPixelType#>> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<<#=thisPixelType#>,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<<#=thisPixelType#>,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -90,10 +89,10 @@ using System.Runtime.InteropServices;
} }
} }
/// <inheritdoc /> /// <inheritdoc />
internal override void From<#=otherPixelType#>(Configuration configuration, ReadOnlySpan<<#=otherPixelType#>> sourcePixels, Span<<#=thisPixelType#>> destPixels) internal override void From<#=otherPixelType#>(Configuration configuration, ReadOnlySpan<<#=otherPixelType#>> sourcePixels, Span<<#=thisPixelType#>> destPixels)
{ {
Guard.NotNull(configuration, nameof(configuration)); Guard.NotNull(configuration, nameof(configuration));
Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels)); Guard.DestinationShouldNotBeTooShort(sourcePixels, destPixels, nameof(destPixels));
ref uint sourceRef = ref Unsafe.As<<#=otherPixelType#>,uint>(ref MemoryMarshal.GetReference(sourcePixels)); ref uint sourceRef = ref Unsafe.As<<#=otherPixelType#>,uint>(ref MemoryMarshal.GetReference(sourcePixels));
@ -105,65 +104,64 @@ using System.Runtime.InteropServices;
Unsafe.Add(ref destRef, i) = PixelConverter.From<#=otherPixelType#>.To<#=thisPixelType#>(sp); Unsafe.Add(ref destRef, i) = PixelConverter.From<#=otherPixelType#>.To<#=thisPixelType#>(sp);
} }
} }
<#+ <#+
} }
void GenerateRgba32CompatibleVector4ConversionMethods(string pixelType) void GenerateRgba32CompatibleVector4ConversionMethods(string pixelType)
{ {
#> #>
/// <inheritdoc />
/// <inheritdoc /> internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<<#=pixelType#>> destPixels)
internal override void FromVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<<#=pixelType#>> destPixels) {
{ Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false);
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, false); }
}
/// <inheritdoc />
/// <inheritdoc /> internal override void ToVector4(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<Vector4> destVectors)
internal override void ToVector4(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<Vector4> destVectors) {
{ Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false);
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, false); }
}
/// <inheritdoc />
/// <inheritdoc /> internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<<#=pixelType#>> destPixels)
internal override void FromScaledVector4(Configuration configuration, ReadOnlySpan<Vector4> sourceVectors, Span<<#=pixelType#>> destPixels) {
{ Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true);
Vector4Converters.RgbaCompatible.FromVector4(configuration, this, sourceVectors, destPixels, true); }
}
/// <inheritdoc />
/// <inheritdoc /> internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<Vector4> destVectors)
internal override void ToScaledVector4(Configuration configuration, ReadOnlySpan<<#=pixelType#>> sourcePixels, Span<Vector4> destVectors) {
{ Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true);
Vector4Converters.RgbaCompatible.ToVector4(configuration, this, sourcePixels, destVectors, true); }
}
<#+
<#+
} }
void GenerateAllDefaultConversionMethods(string pixelType) void GenerateAllDefaultConversionMethods(string pixelType)
{ {
GenerateDefaultSelfConversionMethods(pixelType); GenerateDefaultSelfConversionMethods(pixelType);
if (Rgba32CompatibleTypes.Contains(pixelType)) if (Rgba32CompatibleTypes.Contains(pixelType))
{ {
GenerateRgba32CompatibleVector4ConversionMethods(pixelType); GenerateRgba32CompatibleVector4ConversionMethods(pixelType);
} }
var matching32BitTypes = Optimized32BitTypes.Contains(pixelType) ? var matching32BitTypes = Optimized32BitTypes.Contains(pixelType) ?
Optimized32BitTypes.Where(p => p != pixelType) : Optimized32BitTypes.Where(p => p != pixelType) :
Enumerable.Empty<string>(); Enumerable.Empty<string>();
foreach (string destPixelType in matching32BitTypes) foreach (string destPixelType in matching32BitTypes)
{ {
GenerateOptimized32BitConversionMethods(pixelType, destPixelType); GenerateOptimized32BitConversionMethods(pixelType, destPixelType);
} }
var otherCommonNon32Types = CommonPixelTypes var otherCommonNon32Types = CommonPixelTypes
.Where(p => p != pixelType) .Where(p => p != pixelType)
.Except(matching32BitTypes); .Except(matching32BitTypes);
foreach (string destPixelType in otherCommonNon32Types) foreach (string destPixelType in otherCommonNon32Types)
{ {
GenerateDefaultConvertToMethod(pixelType, destPixelType); GenerateDefaultConvertToMethod(pixelType, destPixelType);
} }
} }
#> #>
Loading…
Cancel
Save