Browse Source

Add PixelColorType

pull/2601/head
James Jackson-South 2 years ago
parent
commit
1d352513e5
  1. 46
      src/ImageSharp/PixelFormats/PixelColorType.cs
  2. 6
      src/ImageSharp/PixelFormats/PixelImplementations/A8.cs
  3. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
  4. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
  5. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
  6. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs
  7. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
  8. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs
  9. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs
  10. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs
  11. 6
      src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs
  12. 6
      src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs
  13. 6
      src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs
  14. 6
      src/ImageSharp/PixelFormats/PixelImplementations/L16.cs
  15. 6
      src/ImageSharp/PixelFormats/PixelImplementations/L8.cs
  16. 6
      src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
  17. 6
      src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
  18. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs
  19. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs
  20. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs
  21. 6
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs
  22. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs
  23. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
  24. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
  25. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs
  26. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
  27. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
  28. 6
      src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs
  29. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs
  30. 6
      src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs
  31. 10
      src/ImageSharp/PixelFormats/PixelTypeInfo.cs
  32. 6
      tests/ImageSharp.Tests/Color/RgbaDouble.cs
  33. 1
      tests/ImageSharp.Tests/PixelFormats/A8Tests.cs
  34. 1
      tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs
  35. 1
      tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs
  36. 1
      tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs
  37. 1
      tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs
  38. 1
      tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs
  39. 1
      tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs
  40. 1
      tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs
  41. 1
      tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs
  42. 1
      tests/ImageSharp.Tests/PixelFormats/HalfSingleTests.cs
  43. 1
      tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs
  44. 1
      tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs
  45. 1
      tests/ImageSharp.Tests/PixelFormats/L16Tests.cs
  46. 1
      tests/ImageSharp.Tests/PixelFormats/L8Tests.cs
  47. 1
      tests/ImageSharp.Tests/PixelFormats/La16Tests.cs
  48. 1
      tests/ImageSharp.Tests/PixelFormats/La32Tests.cs
  49. 1
      tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs
  50. 1
      tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs
  51. 1
      tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs
  52. 1
      tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs
  53. 1
      tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs
  54. 1
      tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs
  55. 1
      tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs
  56. 1
      tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs
  57. 1
      tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs
  58. 1
      tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs
  59. 1
      tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs
  60. 1
      tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs
  61. 1
      tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs
  62. 6
      tests/ImageSharp.Tests/TestFormat.cs

46
src/ImageSharp/PixelFormats/PixelColorType.cs

@ -0,0 +1,46 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.PixelFormats;
/// <summary>
/// Represents the color type and format of a pixel.
/// </summary>
[Flags]
public enum PixelColorType
{
/// <summary>
/// Represents the Red component of the color.
/// </summary>
Red = 1 << 0,
/// <summary>
/// Represents the Green component of the color.
/// </summary>
Green = 1 << 1,
/// <summary>
/// Represents the Blue component of the color.
/// </summary>
Blue = 1 << 2,
/// <summary>
/// Represents the Alpha component of the color for transparency.
/// </summary>
Alpha = 1 << 3,
/// <summary>
/// Indicates that the color is in grayscale.
/// </summary>
Grayscale = 1 << 4,
/// <summary>
/// Indicates that the color is in RGB (Red, Green, Blue) format.
/// </summary>
RGB = Red | Green | Blue | (1 << 5),
/// <summary>
/// Indicates that the color is in BGR (Blue, Green, Red) format.
/// </summary>
BGR = Blue | Green | Red | (1 << 6)
}

6
src/ImageSharp/PixelFormats/PixelImplementations/A8.cs

@ -56,7 +56,11 @@ public partial struct A8 : IPixel<A8>, IPackedVector<byte>
public static bool operator !=(A8 left, A8 right) => !left.Equals(right);
/// <inheritdoc/>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<A8>(PixelComponentInfo.Create<A8>(1, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<A8>(
PixelComponentInfo.Create<A8>(1, 8),
PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<A8> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs

@ -168,7 +168,11 @@ public partial struct Abgr32 : IPixel<Abgr32>, IPackedVector<uint>
public static bool operator !=(Abgr32 left, Abgr32 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Abgr32>(PixelComponentInfo.Create<Abgr32>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Abgr32>(
PixelComponentInfo.Create<Abgr32>(4, 8, 8, 8, 8),
PixelColorType.Alpha | PixelColorType.BGR,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Abgr32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs

@ -168,7 +168,11 @@ public partial struct Argb32 : IPixel<Argb32>, IPackedVector<uint>
public static bool operator !=(Argb32 left, Argb32 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Argb32>(PixelComponentInfo.Create<Argb32>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Argb32>(
PixelComponentInfo.Create<Argb32>(4, 8, 8, 8, 8),
PixelColorType.Alpha | PixelColorType.RGB,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Argb32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs

@ -72,7 +72,11 @@ public partial struct Bgr24 : IPixel<Bgr24>
public static bool operator !=(Bgr24 left, Bgr24 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgr24>(PixelComponentInfo.Create<Bgr24>(3, 8, 8, 8), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Bgr24>(
PixelComponentInfo.Create<Bgr24>(3, 8, 8, 8),
PixelColorType.BGR,
PixelAlphaRepresentation.None);
/// <inheritdoc/>
public readonly PixelOperations<Bgr24> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs

@ -60,7 +60,11 @@ public partial struct Bgr565 : IPixel<Bgr565>, IPackedVector<ushort>
public static bool operator !=(Bgr565 left, Bgr565 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgr565>(PixelComponentInfo.Create<Bgr565>(3, 5, 6, 5), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Bgr565>(
PixelComponentInfo.Create<Bgr565>(3, 5, 6, 5),
PixelColorType.BGR,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<Bgr565> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs

@ -121,7 +121,11 @@ public partial struct Bgra32 : IPixel<Bgra32>, IPackedVector<uint>
public static bool operator !=(Bgra32 left, Bgra32 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra32>(PixelComponentInfo.Create<Bgra32>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Bgra32>(
PixelComponentInfo.Create<Bgra32>(4, 8, 8, 8, 8),
PixelColorType.BGR | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>
public readonly PixelOperations<Bgra32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs

@ -58,7 +58,11 @@ public partial struct Bgra4444 : IPixel<Bgra4444>, IPackedVector<ushort>
public static bool operator !=(Bgra4444 left, Bgra4444 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra4444>(PixelComponentInfo.Create<Bgra4444>(4, 4, 4, 4, 4), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Bgra4444>(
PixelComponentInfo.Create<Bgra4444>(4, 4, 4, 4, 4),
PixelColorType.BGR | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Bgra4444> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs

@ -61,7 +61,11 @@ public partial struct Bgra5551 : IPixel<Bgra5551>, IPackedVector<ushort>
public static bool operator !=(Bgra5551 left, Bgra5551 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra5551>(PixelComponentInfo.Create<Bgra5551>(4, 5, 5, 5, 1), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Bgra5551>(
PixelComponentInfo.Create<Bgra5551>(4, 5, 5, 5, 1),
PixelColorType.BGR | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Bgra5551> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs

@ -61,7 +61,11 @@ public partial struct Byte4 : IPixel<Byte4>, IPackedVector<uint>
public static bool operator !=(Byte4 left, Byte4 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Byte4>(PixelComponentInfo.Create<Byte4>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Byte4>(
PixelComponentInfo.Create<Byte4>(4, 8, 8, 8, 8),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Byte4> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs

@ -46,7 +46,11 @@ public partial struct HalfSingle : IPixel<HalfSingle>, IPackedVector<ushort>
public static bool operator !=(HalfSingle left, HalfSingle right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfSingle>(PixelComponentInfo.Create<HalfSingle>(1, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<HalfSingle>(
PixelComponentInfo.Create<HalfSingle>(1, 16),
PixelColorType.Red,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public PixelOperations<HalfSingle> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs

@ -53,7 +53,11 @@ public partial struct HalfVector2 : IPixel<HalfVector2>, IPackedVector<uint>
public static bool operator !=(HalfVector2 left, HalfVector2 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector2>(PixelComponentInfo.Create<HalfVector2>(2, 16, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<HalfVector2>(
PixelComponentInfo.Create<HalfVector2>(2, 16, 16),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<HalfVector2> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs

@ -58,7 +58,11 @@ public partial struct HalfVector4 : IPixel<HalfVector4>, IPackedVector<ulong>
public static bool operator !=(HalfVector4 left, HalfVector4 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector4>(PixelComponentInfo.Create<HalfVector4>(4, 16, 16, 16, 16), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<HalfVector4>(
PixelComponentInfo.Create<HalfVector4>(4, 16, 16, 16, 16),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<HalfVector4> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/L16.cs

@ -48,7 +48,11 @@ public partial struct L16 : IPixel<L16>, IPackedVector<ushort>
public static bool operator !=(L16 left, L16 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<L16>(PixelComponentInfo.Create<L16>(1, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<L16>(
PixelComponentInfo.Create<L16>(1, 16),
PixelColorType.Grayscale,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<L16> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/L8.cs

@ -49,7 +49,11 @@ public partial struct L8 : IPixel<L8>, IPackedVector<byte>
public static bool operator !=(L8 left, L8 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<L8>(PixelComponentInfo.Create<L8>(1, 8), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<L8>(
PixelComponentInfo.Create<L8>(1, 8),
PixelColorType.Grayscale,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<L8> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/La16.cs

@ -72,7 +72,11 @@ public partial struct La16 : IPixel<La16>, IPackedVector<ushort>
public static bool operator !=(La16 left, La16 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<La16>(PixelComponentInfo.Create<La16>(2, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<La16>(
PixelComponentInfo.Create<La16>(2, 8, 8),
PixelColorType.Grayscale | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>
public readonly PixelOperations<La16> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/La32.cs

@ -74,7 +74,11 @@ public partial struct La32 : IPixel<La32>, IPackedVector<uint>
public static bool operator !=(La32 left, La32 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<La32>(PixelComponentInfo.Create<La32>(2, 16, 16), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<La32>(
PixelComponentInfo.Create<La32>(2, 16, 16),
PixelColorType.Grayscale | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>
public readonly PixelOperations<La32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs

@ -61,7 +61,11 @@ public partial struct NormalizedByte2 : IPixel<NormalizedByte2>, IPackedVector<u
public static bool operator !=(NormalizedByte2 left, NormalizedByte2 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte2>(PixelComponentInfo.Create<NormalizedByte2>(2, 8, 8), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<NormalizedByte2>(
PixelComponentInfo.Create<NormalizedByte2>(2, 8, 8),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<NormalizedByte2> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs

@ -63,7 +63,11 @@ public partial struct NormalizedByte4 : IPixel<NormalizedByte4>, IPackedVector<u
public static bool operator !=(NormalizedByte4 left, NormalizedByte4 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte4>(PixelComponentInfo.Create<NormalizedByte4>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<NormalizedByte4>(
PixelComponentInfo.Create<NormalizedByte4>(4, 8, 8, 8, 8),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<NormalizedByte4> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs

@ -62,7 +62,11 @@ public partial struct NormalizedShort2 : IPixel<NormalizedShort2>, IPackedVector
public static bool operator !=(NormalizedShort2 left, NormalizedShort2 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort2>(PixelComponentInfo.Create<NormalizedShort2>(2, 16, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<NormalizedShort2>(
PixelComponentInfo.Create<NormalizedShort2>(2, 16, 16),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<NormalizedShort2> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs

@ -64,7 +64,11 @@ public partial struct NormalizedShort4 : IPixel<NormalizedShort4>, IPackedVector
public static bool operator !=(NormalizedShort4 left, NormalizedShort4 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort4>(PixelComponentInfo.Create<NormalizedShort4>(4, 16, 16, 16, 16), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<NormalizedShort4>(
PixelComponentInfo.Create<NormalizedShort4>(4, 16, 16, 16, 16),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<NormalizedShort4> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs

@ -58,7 +58,11 @@ public partial struct Rg32 : IPixel<Rg32>, IPackedVector<uint>
public static bool operator !=(Rg32 left, Rg32 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rg32>(PixelComponentInfo.Create<Rg32>(2, 16, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rg32>(
PixelComponentInfo.Create<Rg32>(2, 16, 16),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<Rg32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs

@ -91,7 +91,11 @@ public partial struct Rgb24 : IPixel<Rgb24>
public static bool operator !=(Rgb24 left, Rgb24 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgb24>(PixelComponentInfo.Create<Rgb24>(3, 8, 8, 8), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rgb24>(
PixelComponentInfo.Create<Rgb24>(3, 8, 8, 8),
PixelColorType.RGB,
PixelAlphaRepresentation.None);
/// <inheritdoc/>
public readonly PixelOperations<Rgb24> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs

@ -70,7 +70,11 @@ public partial struct Rgb48 : IPixel<Rgb48>
public static bool operator !=(Rgb48 left, Rgb48 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgb48>(PixelComponentInfo.Create<Rgb48>(3, 16, 16, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rgb48>(
PixelComponentInfo.Create<Rgb48>(3, 16, 16, 16),
PixelColorType.RGB,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<Rgb48> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs

@ -61,7 +61,11 @@ public partial struct Rgba1010102 : IPixel<Rgba1010102>, IPackedVector<uint>
public static bool operator !=(Rgba1010102 left, Rgba1010102 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba1010102>(PixelComponentInfo.Create<Rgba1010102>(4, 10, 10, 10, 2), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rgba1010102>(
PixelComponentInfo.Create<Rgba1010102>(4, 10, 10, 10, 2),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Rgba1010102> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs

@ -271,7 +271,11 @@ public partial struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint>
}
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba32>(PixelComponentInfo.Create<Rgba32>(4, 8, 8, 8, 8), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rgba32>(
PixelComponentInfo.Create<Rgba32>(4, 8, 8, 8, 8),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Rgba32> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs

@ -191,7 +191,11 @@ public partial struct Rgba64 : IPixel<Rgba64>, IPackedVector<ulong>
public static bool operator !=(Rgba64 left, Rgba64 right) => left.PackedValue != right.PackedValue;
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba64>(PixelComponentInfo.Create<Rgba64>(4, 16, 16, 16, 16), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Rgba64>(
PixelComponentInfo.Create<Rgba64>(4, 16, 16, 16, 16),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Rgba64> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs

@ -97,7 +97,11 @@ public partial struct RgbaVector : IPixel<RgbaVector>
public static RgbaVector FromHex(string hex) => Color.ParseHex(hex).ToPixel<RgbaVector>();
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<RgbaVector>(PixelComponentInfo.Create<RgbaVector>(4, 32, 32, 32, 32), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<RgbaVector>(
PixelComponentInfo.Create<RgbaVector>(4, 32, 32, 32, 32),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<RgbaVector> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs

@ -65,7 +65,11 @@ public partial struct Short2 : IPixel<Short2>, IPackedVector<uint>
public static bool operator !=(Short2 left, Short2 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short2>(PixelComponentInfo.Create<Short2>(2, 16, 16), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Short2>(
PixelComponentInfo.Create<Short2>(2, 16, 16),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
/// <inheritdoc />
public readonly PixelOperations<Short2> CreatePixelOperations() => new PixelOperations();

6
src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs

@ -67,7 +67,11 @@ public partial struct Short4 : IPixel<Short4>, IPackedVector<ulong>
public static bool operator !=(Short4 left, Short4 right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short4>(PixelComponentInfo.Create<Short4>(4, 16, 16, 16, 16), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<Short4>(
PixelComponentInfo.Create<Short4>(4, 16, 16, 16, 16),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<Short4> CreatePixelOperations() => new PixelOperations();

10
src/ImageSharp/PixelFormats/PixelTypeInfo.cs

@ -23,10 +23,15 @@ public readonly struct PixelTypeInfo(int bitsPerPixel)
public int BitsPerPixel { get; init; } = bitsPerPixel;
/// <summary>
/// Gets the maximum precision of components within the pixel.
/// Gets the component bit depth and padding within the pixel.
/// </summary>
public PixelComponentInfo? ComponentInfo { get; init; }
/// <summary>
/// Gets the pixel color type.
/// </summary>
public PixelColorType? ColorType { get; init; }
/// <summary>
/// Gets the pixel alpha transparency behavior.
/// <see langword="null"/> means unknown, unspecified.
@ -38,16 +43,19 @@ public readonly struct PixelTypeInfo(int bitsPerPixel)
/// </summary>
/// <typeparam name="TPixel">The type of pixel format.</typeparam>
/// <param name="info">The pixel component info.</param>
/// <param name="colorType">The pixel color type.</param>
/// <param name="alphaRepresentation">The pixel alpha representation.</param>
/// <returns>The <see cref="PixelComponentInfo"/>.</returns>
public static PixelTypeInfo Create<TPixel>(
PixelComponentInfo info,
PixelColorType colorType,
PixelAlphaRepresentation alphaRepresentation)
where TPixel : unmanaged, IPixel<TPixel>
=> new()
{
BitsPerPixel = Unsafe.SizeOf<TPixel>() * 8,
ComponentInfo = info,
ColorType = colorType,
AlphaRepresentation = alphaRepresentation
};
}

6
tests/ImageSharp.Tests/Color/RgbaDouble.cs

@ -77,7 +77,11 @@ public partial struct RgbaDouble(double r, double g, double b, double a = 1) : I
public static bool operator !=(RgbaDouble left, RgbaDouble right) => !left.Equals(right);
/// <inheritdoc />
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<RgbaDouble>(PixelComponentInfo.Create<RgbaDouble>(4, 64, 64, 64, 64), PixelAlphaRepresentation.Unassociated);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<RgbaDouble>(
PixelComponentInfo.Create<RgbaDouble>(4, 64, 64, 64, 64),
PixelColorType.RGB | PixelColorType.Alpha,
PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />
public readonly PixelOperations<RgbaDouble> CreatePixelOperations() => new();

1
tests/ImageSharp.Tests/PixelFormats/A8Tests.cs

@ -116,6 +116,7 @@ public class A8Tests
PixelTypeInfo info = A8.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<A8>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(1, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs

@ -151,6 +151,7 @@ public class Abgr32Tests
PixelTypeInfo info = Abgr32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Abgr32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Alpha | PixelColorType.BGR, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs

@ -149,6 +149,7 @@ public class Argb32Tests
PixelTypeInfo info = Argb32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Argb32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Alpha | PixelColorType.RGB, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs

@ -134,6 +134,7 @@ public class Bgr24Tests
PixelTypeInfo info = Bgr24.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Bgr24>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.BGR, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(3, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs

@ -256,6 +256,7 @@ public class Bgr565Tests
PixelTypeInfo info = Bgr565.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Bgr565>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.BGR, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(3, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs

@ -151,6 +151,7 @@ public class Bgra32Tests
PixelTypeInfo info = Bgra32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Bgra32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.BGR | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs

@ -252,6 +252,7 @@ public class Bgra4444Tests
PixelTypeInfo info = Bgra4444.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Bgra4444>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.BGR | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs

@ -278,6 +278,7 @@ public class Bgra5551Tests
PixelTypeInfo info = Bgra5551.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Bgra5551>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.BGR | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs

@ -245,6 +245,7 @@ public class Byte4Tests
PixelTypeInfo info = Byte4.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Byte4>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/HalfSingleTests.cs

@ -74,6 +74,7 @@ public class HalfSingleTests
PixelTypeInfo info = HalfSingle.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<HalfSingle>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(1, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs

@ -96,6 +96,7 @@ public class HalfVector2Tests
PixelTypeInfo info = HalfVector2.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<HalfVector2>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red | PixelColorType.Green, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs

@ -87,6 +87,7 @@ public class HalfVector4Tests
PixelTypeInfo info = HalfVector4.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<HalfVector4>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/L16Tests.cs

@ -166,6 +166,7 @@ public class L16Tests
PixelTypeInfo info = L16.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<L16>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Grayscale, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(1, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/L8Tests.cs

@ -261,6 +261,7 @@ public class L8Tests
PixelTypeInfo info = L8.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<L8>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Grayscale, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(1, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/La16Tests.cs

@ -265,6 +265,7 @@ public class La16Tests
PixelTypeInfo info = La16.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<La16>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Grayscale | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/La32Tests.cs

@ -172,6 +172,7 @@ public class La32Tests
PixelTypeInfo info = La32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<La32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Grayscale | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs

@ -88,6 +88,7 @@ public class NormalizedByte2Tests
PixelTypeInfo info = NormalizedByte2.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<NormalizedByte2>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red | PixelColorType.Green, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs

@ -238,6 +238,7 @@ public class NormalizedByte4Tests
PixelTypeInfo info = NormalizedByte4.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<NormalizedByte4>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs

@ -92,6 +92,7 @@ public class NormalizedShort2Tests
PixelTypeInfo info = NormalizedShort2.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<NormalizedShort2>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red | PixelColorType.Green, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs

@ -239,6 +239,7 @@ public class NormalizedShort4Tests
PixelTypeInfo info = NormalizedShort4.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<NormalizedShort4>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs

@ -90,6 +90,7 @@ public class Rg32Tests
PixelTypeInfo info = Rg32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rg32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red | PixelColorType.Green, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs

@ -137,6 +137,7 @@ public class Rgb24Tests
PixelTypeInfo info = Rgb24.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rgb24>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(3, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs

@ -82,6 +82,7 @@ public class Rgb48Tests
PixelTypeInfo info = Rgb48.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rgb48>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(3, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs

@ -253,6 +253,7 @@ public class Rgba1010102Tests
PixelTypeInfo info = Rgba1010102.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rgba1010102>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs

@ -313,6 +313,7 @@ public class Rgba32Tests
PixelTypeInfo info = Rgba32.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rgba32>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs

@ -315,6 +315,7 @@ public class Rgba64Tests
PixelTypeInfo info = Rgba64.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Rgba64>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs

@ -211,6 +211,7 @@ public class RgbaVectorTests
PixelTypeInfo info = RgbaVector.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<RgbaVector>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs

@ -167,6 +167,7 @@ public class Short2Tests
PixelTypeInfo info = Short2.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Short2>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelColorType.Red | PixelColorType.Green, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(2, componentInfo.ComponentCount);

1
tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs

@ -220,6 +220,7 @@ public class Short4Tests
PixelTypeInfo info = Short4.GetPixelTypeInfo();
Assert.Equal(Unsafe.SizeOf<Short4>() * 8, info.BitsPerPixel);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelColorType.RGB | PixelColorType.Alpha, info.ColorType);
PixelComponentInfo componentInfo = info.ComponentInfo.Value;
Assert.Equal(4, componentInfo.ComponentCount);

6
tests/ImageSharp.Tests/TestFormat.cs

@ -263,7 +263,11 @@ public class TestFormat : IImageFormatConfigurationModule, IImageFormat
public struct TestPixelForAgnosticDecode : IPixel<TestPixelForAgnosticDecode>
{
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<TestPixelForAgnosticDecode>(PixelComponentInfo.Create<TestPixelForAgnosticDecode>(2, 8, 8), PixelAlphaRepresentation.None);
public static PixelTypeInfo GetPixelTypeInfo()
=> PixelTypeInfo.Create<TestPixelForAgnosticDecode>(
PixelComponentInfo.Create<TestPixelForAgnosticDecode>(2, 8, 8),
PixelColorType.Red | PixelColorType.Green,
PixelAlphaRepresentation.None);
public PixelOperations<TestPixelForAgnosticDecode> CreatePixelOperations() => new();

Loading…
Cancel
Save