Browse Source

Rename property, use int.

pull/2601/head
James Jackson-South 2 years ago
parent
commit
d1c231bb85
  1. 2
      src/ImageSharp/Color/Color.cs
  2. 8
      src/ImageSharp/Formats/PixelTypeInfo.cs
  3. 2
      src/ImageSharp/PixelFormats/PixelComponentPrecision.cs
  4. 2
      tests/ImageSharp.Tests/PixelFormats/A8Tests.cs
  5. 2
      tests/ImageSharp.Tests/PixelFormats/Abgr32Tests.cs
  6. 2
      tests/ImageSharp.Tests/PixelFormats/Argb32Tests.cs
  7. 2
      tests/ImageSharp.Tests/PixelFormats/Bgr24Tests.cs
  8. 2
      tests/ImageSharp.Tests/PixelFormats/Bgr565Tests.cs
  9. 2
      tests/ImageSharp.Tests/PixelFormats/Bgra32Tests.cs
  10. 2
      tests/ImageSharp.Tests/PixelFormats/Bgra4444Tests.cs
  11. 2
      tests/ImageSharp.Tests/PixelFormats/Bgra5551Tests.cs
  12. 2
      tests/ImageSharp.Tests/PixelFormats/Byte4Tests.cs
  13. 2
      tests/ImageSharp.Tests/PixelFormats/HalfSingleTests.cs
  14. 2
      tests/ImageSharp.Tests/PixelFormats/HalfVector2Tests.cs
  15. 2
      tests/ImageSharp.Tests/PixelFormats/HalfVector4Tests.cs
  16. 2
      tests/ImageSharp.Tests/PixelFormats/L16Tests.cs
  17. 2
      tests/ImageSharp.Tests/PixelFormats/L8Tests.cs
  18. 2
      tests/ImageSharp.Tests/PixelFormats/La16Tests.cs
  19. 2
      tests/ImageSharp.Tests/PixelFormats/La32Tests.cs
  20. 2
      tests/ImageSharp.Tests/PixelFormats/NormalizedByte2Tests.cs
  21. 2
      tests/ImageSharp.Tests/PixelFormats/NormalizedByte4Tests.cs
  22. 2
      tests/ImageSharp.Tests/PixelFormats/NormalizedShort2Tests.cs
  23. 2
      tests/ImageSharp.Tests/PixelFormats/NormalizedShort4Tests.cs
  24. 2
      tests/ImageSharp.Tests/PixelFormats/Rg32Tests.cs
  25. 2
      tests/ImageSharp.Tests/PixelFormats/Rgb24Tests.cs
  26. 2
      tests/ImageSharp.Tests/PixelFormats/Rgb48Tests.cs
  27. 2
      tests/ImageSharp.Tests/PixelFormats/Rgba1010102Tests.cs
  28. 2
      tests/ImageSharp.Tests/PixelFormats/Rgba32Tests.cs
  29. 2
      tests/ImageSharp.Tests/PixelFormats/Rgba64Tests.cs
  30. 2
      tests/ImageSharp.Tests/PixelFormats/RgbaVectorTests.cs
  31. 2
      tests/ImageSharp.Tests/PixelFormats/Short2Tests.cs
  32. 2
      tests/ImageSharp.Tests/PixelFormats/Short4Tests.cs

2
src/ImageSharp/Color/Color.cs

@ -127,7 +127,7 @@ public readonly partial struct Color : IEquatable<Color>
}
PixelTypeInfo info = TPixel.GetPixelTypeInfo();
if (info.ComponentPrecision <= PixelComponentPrecision.Byte)
if (info.MaxComponentPrecision <= PixelComponentPrecision.Byte)
{
Rgba32 p = default;
pixel.ToRgba32(ref p);

8
src/ImageSharp/Formats/PixelTypeInfo.cs

@ -26,12 +26,12 @@ public readonly struct PixelTypeInfo(int bitsPerPixel)
/// <summary>
/// Gets the count of the color components
/// </summary>
public byte ComponentCount { get; init; }
public int ComponentCount { get; init; }
/// <summary>
/// Gets the pixel component precision.
/// Gets the maximum precision of components within the pixel.
/// </summary>
public PixelComponentPrecision? ComponentPrecision { get; init; }
public PixelComponentPrecision? MaxComponentPrecision { get; init; }
/// <summary>
/// Gets the pixel alpha transparency behavior.
@ -48,7 +48,7 @@ public readonly struct PixelTypeInfo(int bitsPerPixel)
{
BitsPerPixel = Unsafe.SizeOf<TPixel>() * 8,
ComponentCount = componentCount,
ComponentPrecision = componentPrecision,
MaxComponentPrecision = componentPrecision,
AlphaRepresentation = pixelAlphaRepresentation
};
}

2
src/ImageSharp/PixelFormats/PixelComponentPrecision.cs

@ -4,7 +4,7 @@
namespace SixLabors.ImageSharp.PixelFormats;
/// <summary>
/// Provides enumeration of the maximum precision of individual components within a pixel format.
/// Provides enumeration of the precision of individual components within a pixel format.
/// </summary>
public enum PixelComponentPrecision
{

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

@ -118,6 +118,6 @@ public class A8Tests
Assert.Equal(Unsafe.SizeOf<A8>() * 8, info.BitsPerPixel);
Assert.Equal(1, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -153,6 +153,6 @@ public class Abgr32Tests
Assert.Equal(Unsafe.SizeOf<Abgr32>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -151,6 +151,6 @@ public class Argb32Tests
Assert.Equal(Unsafe.SizeOf<Argb32>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -136,6 +136,6 @@ public class Bgr24Tests
Assert.Equal(Unsafe.SizeOf<Bgr24>() * 8, info.BitsPerPixel);
Assert.Equal(3, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -258,6 +258,6 @@ public class Bgr565Tests
Assert.Equal(Unsafe.SizeOf<Bgr565>() * 8, info.BitsPerPixel);
Assert.Equal(3, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -153,6 +153,6 @@ public class Bgra32Tests
Assert.Equal(Unsafe.SizeOf<Bgra32>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -254,6 +254,6 @@ public class Bgra4444Tests
Assert.Equal(Unsafe.SizeOf<Bgra4444>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -280,6 +280,6 @@ public class Bgra5551Tests
Assert.Equal(Unsafe.SizeOf<Bgra5551>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -247,6 +247,6 @@ public class Byte4Tests
Assert.Equal(Unsafe.SizeOf<Byte4>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -76,6 +76,6 @@ public class HalfSingleTests
Assert.Equal(Unsafe.SizeOf<HalfSingle>() * 8, info.BitsPerPixel);
Assert.Equal(1, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Half, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Half, info.MaxComponentPrecision);
}
}

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

@ -98,6 +98,6 @@ public class HalfVector2Tests
Assert.Equal(Unsafe.SizeOf<HalfVector2>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Half, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Half, info.MaxComponentPrecision);
}
}

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

@ -89,6 +89,6 @@ public class HalfVector4Tests
Assert.Equal(Unsafe.SizeOf<HalfVector4>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Half, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Half, info.MaxComponentPrecision);
}
}

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

@ -168,6 +168,6 @@ public class L16Tests
Assert.Equal(Unsafe.SizeOf<L16>() * 8, info.BitsPerPixel);
Assert.Equal(1, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -263,7 +263,7 @@ public class L8Tests
Assert.Equal(Unsafe.SizeOf<L8>() * 8, info.BitsPerPixel);
Assert.Equal(1, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}
}

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

@ -267,7 +267,7 @@ public class La16Tests
Assert.Equal(Unsafe.SizeOf<La16>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}
}

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

@ -174,6 +174,6 @@ public class La32Tests
Assert.Equal(Unsafe.SizeOf<La32>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -90,6 +90,6 @@ public class NormalizedByte2Tests
Assert.Equal(Unsafe.SizeOf<NormalizedByte2>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.SByte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.SByte, info.MaxComponentPrecision);
}
}

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

@ -240,6 +240,6 @@ public class NormalizedByte4Tests
Assert.Equal(Unsafe.SizeOf<NormalizedByte4>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.SByte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.SByte, info.MaxComponentPrecision);
}
}

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

@ -94,6 +94,6 @@ public class NormalizedShort2Tests
Assert.Equal(Unsafe.SizeOf<NormalizedShort2>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Short, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Short, info.MaxComponentPrecision);
}
}

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

@ -241,6 +241,6 @@ public class NormalizedShort4Tests
Assert.Equal(Unsafe.SizeOf<NormalizedShort4>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Short, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Short, info.MaxComponentPrecision);
}
}

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

@ -92,6 +92,6 @@ public class Rg32Tests
Assert.Equal(Unsafe.SizeOf<Rg32>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -139,6 +139,6 @@ public class Rgb24Tests
Assert.Equal(Unsafe.SizeOf<Rgb24>() * 8, info.BitsPerPixel);
Assert.Equal(3, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -84,6 +84,6 @@ public class Rgb48Tests
Assert.Equal(Unsafe.SizeOf<Rgb48>() * 8, info.BitsPerPixel);
Assert.Equal(3, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -255,6 +255,6 @@ public class Rgba1010102Tests
Assert.Equal(Unsafe.SizeOf<Rgba1010102>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -315,6 +315,6 @@ public class Rgba32Tests
Assert.Equal(Unsafe.SizeOf<Rgba32>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Byte, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Byte, info.MaxComponentPrecision);
}
}

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

@ -317,6 +317,6 @@ public class Rgba64Tests
Assert.Equal(Unsafe.SizeOf<Rgba64>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.UShort, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.UShort, info.MaxComponentPrecision);
}
}

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

@ -213,6 +213,6 @@ public class RgbaVectorTests
Assert.Equal(Unsafe.SizeOf<RgbaVector>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Float, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Float, info.MaxComponentPrecision);
}
}

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

@ -169,6 +169,6 @@ public class Short2Tests
Assert.Equal(Unsafe.SizeOf<Short2>() * 8, info.BitsPerPixel);
Assert.Equal(2, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.None, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Short, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Short, info.MaxComponentPrecision);
}
}

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

@ -222,6 +222,6 @@ public class Short4Tests
Assert.Equal(Unsafe.SizeOf<Short4>() * 8, info.BitsPerPixel);
Assert.Equal(4, info.ComponentCount);
Assert.Equal(PixelAlphaRepresentation.Unassociated, info.AlphaRepresentation);
Assert.Equal(PixelComponentPrecision.Short, info.ComponentPrecision);
Assert.Equal(PixelComponentPrecision.Short, info.MaxComponentPrecision);
}
}

Loading…
Cancel
Save