mirror of https://github.com/SixLabors/ImageSharp
80 changed files with 2108 additions and 581 deletions
@ -0,0 +1,32 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <summary>
|
|||
/// Provides enumeration of the alpha value transparency behavior of a pixel format.
|
|||
/// </summary>
|
|||
public enum PixelAlphaRepresentation |
|||
{ |
|||
/// <summary>
|
|||
/// Indicates that the pixel format does not contain an alpha channel.
|
|||
/// </summary>
|
|||
None, |
|||
|
|||
/// <summary>
|
|||
/// Indicates that the transparency behavior is premultiplied.
|
|||
/// Each color is first scaled by the alpha value. The alpha value itself is the same
|
|||
/// in both straight and premultiplied alpha. Typically, no color channel value is
|
|||
/// greater than the alpha channel value.
|
|||
/// If a color channel value in a premultiplied format is greater than the alpha
|
|||
/// channel, the standard source-over blending math results in an additive blend.
|
|||
/// </summary>
|
|||
Associated, |
|||
|
|||
/// <summary>
|
|||
/// Indicates that the transparency behavior is not premultiplied.
|
|||
/// The alpha channel indicates the transparency of the color.
|
|||
/// </summary>
|
|||
Unassociated |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct A8 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<A8> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<A8>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgr565 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Bgr565> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgr565>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Bgra4444 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Bgra4444> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra4444>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Byte4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Byte4> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Byte4>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfSingle |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfSingle> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfSingle>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfVector2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfVector2> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector2>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct HalfVector4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<HalfVector4> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector4>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedByte2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedByte2> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte2>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedByte4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedByte4> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte4>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedShort2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedShort2> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort2>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct NormalizedShort4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<NormalizedShort4> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort4>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rg32 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Rg32> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rg32>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Rgba1010102 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Rgba1010102> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba1010102>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Short2 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Short2> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short2>(PixelAlphaRepresentation.None); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.Formats; |
|||
|
|||
namespace SixLabors.ImageSharp.PixelFormats |
|||
{ |
|||
/// <content>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </content>
|
|||
public partial struct Short4 |
|||
{ |
|||
/// <summary>
|
|||
/// Provides optimized overrides for bulk operations.
|
|||
/// </summary>
|
|||
internal class PixelOperations : PixelOperations<Short4> |
|||
{ |
|||
/// <inheritdoc />
|
|||
public override PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short4>(PixelAlphaRepresentation.Unassociated); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,718 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
// <auto-generated />
|
|||
|
|||
using System.Runtime.CompilerServices; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
|
|||
public partial class A8_OperationsTests : PixelOperationsTests<A8> |
|||
{ |
|||
public A8_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<A8.PixelOperations>(PixelOperations<A8>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = A8.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<A8>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = A8.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Argb32_OperationsTests : PixelOperationsTests<Argb32> |
|||
{ |
|||
public Argb32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Argb32.PixelOperations>(PixelOperations<Argb32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Argb32.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Argb32>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Argb32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgr24_OperationsTests : PixelOperationsTests<Bgr24> |
|||
{ |
|||
public Bgr24_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr24.PixelOperations>(PixelOperations<Bgr24>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Bgr24.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Bgr24>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Bgr24.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgr565_OperationsTests : PixelOperationsTests<Bgr565> |
|||
{ |
|||
public Bgr565_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr565.PixelOperations>(PixelOperations<Bgr565>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Bgr565.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Bgr565>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Bgr565.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra32_OperationsTests : PixelOperationsTests<Bgra32> |
|||
{ |
|||
public Bgra32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra32.PixelOperations>(PixelOperations<Bgra32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Bgra32.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Bgra32>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Bgra32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra4444_OperationsTests : PixelOperationsTests<Bgra4444> |
|||
{ |
|||
public Bgra4444_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra4444.PixelOperations>(PixelOperations<Bgra4444>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Bgra4444.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Bgra4444>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Bgra4444.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Bgra5551_OperationsTests : PixelOperationsTests<Bgra5551> |
|||
{ |
|||
public Bgra5551_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra5551.PixelOperations>(PixelOperations<Bgra5551>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Bgra5551.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Bgra5551>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Bgra5551.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Byte4_OperationsTests : PixelOperationsTests<Byte4> |
|||
{ |
|||
public Byte4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Byte4.PixelOperations>(PixelOperations<Byte4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Byte4.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Byte4>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Byte4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfSingle_OperationsTests : PixelOperationsTests<HalfSingle> |
|||
{ |
|||
public HalfSingle_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfSingle.PixelOperations>(PixelOperations<HalfSingle>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = HalfSingle.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<HalfSingle>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = HalfSingle.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfVector2_OperationsTests : PixelOperationsTests<HalfVector2> |
|||
{ |
|||
public HalfVector2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfVector2.PixelOperations>(PixelOperations<HalfVector2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = HalfVector2.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<HalfVector2>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = HalfVector2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class HalfVector4_OperationsTests : PixelOperationsTests<HalfVector4> |
|||
{ |
|||
public HalfVector4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<HalfVector4.PixelOperations>(PixelOperations<HalfVector4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = HalfVector4.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<HalfVector4>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = HalfVector4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class L16_OperationsTests : PixelOperationsTests<L16> |
|||
{ |
|||
public L16_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L16.PixelOperations>(PixelOperations<L16>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = L16.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<L16>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = L16.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class L8_OperationsTests : PixelOperationsTests<L8> |
|||
{ |
|||
public L8_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L8.PixelOperations>(PixelOperations<L8>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = L8.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<L8>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = L8.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class La16_OperationsTests : PixelOperationsTests<La16> |
|||
{ |
|||
public La16_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La16.PixelOperations>(PixelOperations<La16>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = La16.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<La16>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = La16.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class La32_OperationsTests : PixelOperationsTests<La32> |
|||
{ |
|||
public La32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La32.PixelOperations>(PixelOperations<La32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = La32.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<La32>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = La32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedByte2_OperationsTests : PixelOperationsTests<NormalizedByte2> |
|||
{ |
|||
public NormalizedByte2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedByte2.PixelOperations>(PixelOperations<NormalizedByte2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = NormalizedByte2.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<NormalizedByte2>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = NormalizedByte2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedByte4_OperationsTests : PixelOperationsTests<NormalizedByte4> |
|||
{ |
|||
public NormalizedByte4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedByte4.PixelOperations>(PixelOperations<NormalizedByte4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = NormalizedByte4.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<NormalizedByte4>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = NormalizedByte4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedShort2_OperationsTests : PixelOperationsTests<NormalizedShort2> |
|||
{ |
|||
public NormalizedShort2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedShort2.PixelOperations>(PixelOperations<NormalizedShort2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = NormalizedShort2.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<NormalizedShort2>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = NormalizedShort2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class NormalizedShort4_OperationsTests : PixelOperationsTests<NormalizedShort4> |
|||
{ |
|||
public NormalizedShort4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<NormalizedShort4.PixelOperations>(PixelOperations<NormalizedShort4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = NormalizedShort4.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<NormalizedShort4>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = NormalizedShort4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rg32_OperationsTests : PixelOperationsTests<Rg32> |
|||
{ |
|||
public Rg32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rg32.PixelOperations>(PixelOperations<Rg32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rg32.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rg32>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rg32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgb24_OperationsTests : PixelOperationsTests<Rgb24> |
|||
{ |
|||
public Rgb24_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb24.PixelOperations>(PixelOperations<Rgb24>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rgb24.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rgb24>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rgb24.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgb48_OperationsTests : PixelOperationsTests<Rgb48> |
|||
{ |
|||
public Rgb48_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb48.PixelOperations>(PixelOperations<Rgb48>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rgb48.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rgb48>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rgb48.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba1010102_OperationsTests : PixelOperationsTests<Rgba1010102> |
|||
{ |
|||
public Rgba1010102_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba1010102.PixelOperations>(PixelOperations<Rgba1010102>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rgba1010102.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rgba1010102>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rgba1010102.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba32_OperationsTests : PixelOperationsTests<Rgba32> |
|||
{ |
|||
public Rgba32_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba32.PixelOperations>(PixelOperations<Rgba32>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rgba32.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rgba32>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rgba32.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Rgba64_OperationsTests : PixelOperationsTests<Rgba64> |
|||
{ |
|||
public Rgba64_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba64.PixelOperations>(PixelOperations<Rgba64>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Rgba64.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Rgba64>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Rgba64.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class RgbaVector_OperationsTests : PixelOperationsTests<RgbaVector> |
|||
{ |
|||
public RgbaVector_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<RgbaVector.PixelOperations>(PixelOperations<RgbaVector>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = RgbaVector.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<RgbaVector>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = RgbaVector.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Short2_OperationsTests : PixelOperationsTests<Short2> |
|||
{ |
|||
public Short2_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Short2.PixelOperations>(PixelOperations<Short2>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Short2.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Short2>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Short2.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.None, alphaRepresentation); |
|||
} |
|||
} |
|||
|
|||
public partial class Short4_OperationsTests : PixelOperationsTests<Short4> |
|||
{ |
|||
public Short4_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Short4.PixelOperations>(PixelOperations<Short4>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = Short4.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<Short4>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = Short4.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(PixelAlphaRepresentation.Unassociated, alphaRepresentation); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,11 @@ |
|||
<#@include file="_Common.ttinclude" #> |
|||
<#@ output extension=".cs" #> |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
<# GenerateAllSpecializedClasses(); #> |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,117 @@ |
|||
<#@ template debug="false" hostspecific="false" language="C#" #> |
|||
<#@ assembly name="System.Core" #> |
|||
<#@ import namespace="System.Linq" #> |
|||
<#@ import namespace="System.Text" #> |
|||
<#@ import namespace="System.Collections.Generic" #> |
|||
// Copyright (c) Six Labors. |
|||
// Licensed under the Apache License, Version 2.0. |
|||
|
|||
// <auto-generated /> |
|||
|
|||
using System.Runtime.CompilerServices; |
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
<#+ |
|||
private static readonly string[] UnassociatedAlphaPixelTypes = |
|||
{ |
|||
"A8", |
|||
"Argb32", |
|||
"Bgra32", |
|||
"Bgra4444", |
|||
"Bgra5551", |
|||
"Byte4", |
|||
"HalfVector4", |
|||
"La16", |
|||
"La32", |
|||
"NormalizedByte4", |
|||
"NormalizedShort4", |
|||
"Rgba1010102", |
|||
"Rgba32", |
|||
"Rgba64", |
|||
"RgbaVector", |
|||
"Short4" |
|||
}; |
|||
|
|||
private static readonly string[] AssociatedAlphaPixelTypes = Array.Empty<string>(); |
|||
|
|||
private static readonly string[] CommonPixelTypes = |
|||
{ |
|||
"A8", |
|||
"Argb32", |
|||
"Bgr24", |
|||
"Bgr565", |
|||
"Bgra32", |
|||
"Bgra4444", |
|||
"Bgra5551", |
|||
"Byte4", |
|||
"HalfSingle", |
|||
"HalfVector2", |
|||
"HalfVector4", |
|||
"L16", |
|||
"L8", |
|||
"La16", |
|||
"La32", |
|||
"NormalizedByte2", |
|||
"NormalizedByte4", |
|||
"NormalizedShort2", |
|||
"NormalizedShort4", |
|||
"Rg32", |
|||
"Rgb24", |
|||
"Rgb48", |
|||
"Rgba1010102", |
|||
"Rgba32", |
|||
"Rgba64", |
|||
"RgbaVector", |
|||
"Short2", |
|||
"Short4", |
|||
}; |
|||
|
|||
void GenerateSpecializedClass(string pixelType, string alpha) |
|||
{ |
|||
#> |
|||
public partial class <#=pixelType#>_OperationsTests : PixelOperationsTests<<#=pixelType#>> |
|||
{ |
|||
public <#=pixelType#>_OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<<#=pixelType#>.PixelOperations>(PixelOperations<<#=pixelType#>>.Instance); |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectBitsPerPixel() |
|||
{ |
|||
var bits = <#=pixelType#>.PixelOperations.Instance.GetPixelTypeInfo().BitsPerPixel; |
|||
Assert.Equal(Unsafe.SizeOf<<#=pixelType#>>() * 8, bits); |
|||
} |
|||
|
|||
[Fact] |
|||
public void PixelTypeInfoHasCorrectAlphaRepresentation() |
|||
{ |
|||
var alphaRepresentation = <#=pixelType#>.PixelOperations.Instance.GetPixelTypeInfo().AlphaRepresentation; |
|||
Assert.Equal(<#=alpha#>, alphaRepresentation); |
|||
} |
|||
} |
|||
<#+ |
|||
} |
|||
|
|||
void GenerateAllSpecializedClasses() |
|||
{ |
|||
foreach (string pixelType in CommonPixelTypes) |
|||
{ |
|||
string alpha = "PixelAlphaRepresentation.None"; |
|||
if (AssociatedAlphaPixelTypes.Contains(pixelType)) |
|||
{ |
|||
alpha = "PixelAlphaRepresentation.Associated"; |
|||
} |
|||
else if (UnassociatedAlphaPixelTypes.Contains(pixelType)) |
|||
{ |
|||
alpha = "PixelAlphaRepresentation.Unassociated"; |
|||
} |
|||
|
|||
GenerateSpecializedClass(pixelType, alpha); |
|||
} |
|||
} |
|||
#> |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Argb32OperationsTests : PixelOperationsTests<Argb32> |
|||
{ |
|||
public Argb32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Argb32.PixelOperations>(PixelOperations<Argb32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,25 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgr24OperationsTests : PixelOperationsTests<Bgr24> |
|||
{ |
|||
public Bgr24OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
this.HasAlpha = false; |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgr24.PixelOperations>(PixelOperations<Bgr24>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgra32OperationsTests : PixelOperationsTests<Bgra32> |
|||
{ |
|||
public Bgra32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Bgra32.PixelOperations>(PixelOperations<Bgra32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,20 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Bgra5551OperationsTests : PixelOperationsTests<Bgra5551> |
|||
{ |
|||
public Bgra5551OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class L16OperationsTests : PixelOperationsTests<L16> |
|||
{ |
|||
public L16OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L16.PixelOperations>(PixelOperations<L16>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class L8OperationsTests : PixelOperationsTests<L8> |
|||
{ |
|||
public L8OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<L8.PixelOperations>(PixelOperations<L8>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class La16OperationsTests : PixelOperationsTests<La16> |
|||
{ |
|||
public La16OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La16.PixelOperations>(PixelOperations<La16>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class La32OperationsTests : PixelOperationsTests<La32> |
|||
{ |
|||
public La32OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<La32.PixelOperations>(PixelOperations<La32>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgb24OperationsTests : PixelOperationsTests<Rgb24> |
|||
{ |
|||
public Rgb24OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
this.HasAlpha = false; |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb24.PixelOperations>(PixelOperations<Rgb24>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgb48OperationsTests : PixelOperationsTests<Rgb48> |
|||
{ |
|||
public Rgb48OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgb48.PixelOperations>(PixelOperations<Rgb48>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class Rgba64OperationsTests : PixelOperationsTests<Rgba64> |
|||
{ |
|||
public Rgba64OperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<Rgba64.PixelOperations>(PixelOperations<Rgba64>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using SixLabors.ImageSharp.PixelFormats; |
|||
|
|||
using Xunit; |
|||
using Xunit.Abstractions; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations |
|||
{ |
|||
public partial class PixelOperationsTests |
|||
{ |
|||
public class RgbaVectorOperationsTests : PixelOperationsTests<RgbaVector> |
|||
{ |
|||
public RgbaVectorOperationsTests(ITestOutputHelper output) |
|||
: base(output) |
|||
{ |
|||
} |
|||
|
|||
[Fact] |
|||
public void IsSpecialImplementation() => Assert.IsType<RgbaVector.PixelOperations>(PixelOperations<RgbaVector>.Instance); |
|||
} |
|||
} |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 8b43d14d21ce9b436af3d12a70d38402cdba176b |
|||
Subproject commit cc6465910d092319ef9bf4e99698a0649996d3c5 |
|||
Loading…
Reference in new issue