Browse Source

Fix Analyzer errors

pull/2601/head
Stefan Nikolei 2 years ago
parent
commit
2bf8d78f0f
  1. 3
      src/ImageSharp.ruleset
  2. 5
      src/ImageSharp/Formats/PixelTypeInfo.cs
  3. 4
      src/ImageSharp/PixelFormats/IPixel.cs
  4. 4
      src/ImageSharp/PixelFormats/PixelImplementations/A8.cs
  5. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
  6. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
  7. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
  8. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs
  9. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
  10. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs
  11. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs
  12. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs
  13. 4
      src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs
  14. 4
      src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs
  15. 4
      src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs
  16. 4
      src/ImageSharp/PixelFormats/PixelImplementations/L16.cs
  17. 4
      src/ImageSharp/PixelFormats/PixelImplementations/L8.cs
  18. 4
      src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
  19. 4
      src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
  20. 4
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs
  21. 4
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs
  22. 4
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs
  23. 4
      src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs
  24. 1
      src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Rgb24.PixelOperations.cs
  25. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs
  26. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
  27. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
  28. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs
  29. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
  30. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
  31. 4
      src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs
  32. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs
  33. 4
      src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs

3
src/ImageSharp.ruleset

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="ImageSharp" ToolsVersion="17.0">
<Include Path="..\shared-infrastructure\sixlabors.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.CSharp.NetAnalyzers">
<Rule Id="CA1000" Action="None"/>
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1011" Action="None" />
</Rules>

5
src/ImageSharp/Formats/PixelTypeInfo.cs

@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Formats;
public readonly struct PixelTypeInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="PixelTypeInfo"/> class.
/// Initializes a new instance of the <see cref="PixelTypeInfo"/> struct.
/// </summary>
/// <param name="bitsPerPixel">Color depth, in number of bits per pixel.</param>
public PixelTypeInfo(int bitsPerPixel)
@ -26,6 +26,9 @@ public readonly struct PixelTypeInfo
/// </summary>
public int BitsPerPixel { get; init; }
/// <summary>
/// Gets the count of the color components
/// </summary>
public byte ComponentCount { get; init; }
/// <summary>

4
src/ImageSharp/PixelFormats/IPixel.cs

@ -15,6 +15,10 @@ namespace SixLabors.ImageSharp.PixelFormats;
public interface IPixel<TSelf> : IPixel, IEquatable<TSelf>
where TSelf : unmanaged, IPixel<TSelf>
{
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
static abstract PixelTypeInfo GetPixelTypeInfo();
/// <summary>

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

@ -56,6 +56,10 @@ public partial struct A8 : IPixel<A8>, IPackedVector<byte>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(A8 left, A8 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<A8>(1, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -184,6 +184,10 @@ public partial struct Abgr32 : IPixel<Abgr32>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Abgr32 left, Abgr32 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Abgr32>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -184,6 +184,10 @@ public partial struct Argb32 : IPixel<Argb32>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Argb32 left, Argb32 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Argb32>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -88,6 +88,10 @@ public partial struct Bgr24 : IPixel<Bgr24>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Bgr24 left, Bgr24 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgr24>(3, PixelAlphaRepresentation.None);
/// <inheritdoc/>

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

@ -60,6 +60,10 @@ public partial struct Bgr565 : IPixel<Bgr565>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Bgr565 left, Bgr565 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgr565>(3, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -137,6 +137,10 @@ public partial struct Bgra32 : IPixel<Bgra32>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Bgra32 left, Bgra32 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra32>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>

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

@ -58,6 +58,10 @@ public partial struct Bgra4444 : IPixel<Bgra4444>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Bgra4444 left, Bgra4444 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra4444>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -61,6 +61,10 @@ public partial struct Bgra5551 : IPixel<Bgra5551>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Bgra5551 left, Bgra5551 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Bgra5551>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -61,6 +61,10 @@ public partial struct Byte4 : IPixel<Byte4>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Byte4 left, Byte4 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Byte4>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -46,6 +46,10 @@ public partial struct HalfSingle : IPixel<HalfSingle>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(HalfSingle left, HalfSingle right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfSingle>(1, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -53,6 +53,10 @@ public partial struct HalfVector2 : IPixel<HalfVector2>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(HalfVector2 left, HalfVector2 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector2>(2, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -58,6 +58,10 @@ public partial struct HalfVector4 : IPixel<HalfVector4>, IPackedVector<ulong>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(HalfVector4 left, HalfVector4 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<HalfVector4>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -48,6 +48,10 @@ public partial struct L16 : IPixel<L16>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(L16 left, L16 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<L16>(1, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -49,6 +49,10 @@ public partial struct L8 : IPixel<L8>, IPackedVector<byte>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(L8 left, L8 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<L8>(1, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -72,6 +72,10 @@ public partial struct La16 : IPixel<La16>, IPackedVector<ushort>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(La16 left, La16 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<La16>(2, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>

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

@ -74,6 +74,10 @@ public partial struct La32 : IPixel<La32>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(La32 left, La32 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<La32>(2, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc/>

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

@ -61,6 +61,10 @@ public partial struct NormalizedByte2 : IPixel<NormalizedByte2>, IPackedVector<u
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(NormalizedByte2 left, NormalizedByte2 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte2>(2, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -63,6 +63,10 @@ public partial struct NormalizedByte4 : IPixel<NormalizedByte4>, IPackedVector<u
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(NormalizedByte4 left, NormalizedByte4 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedByte4>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -62,6 +62,10 @@ public partial struct NormalizedShort2 : IPixel<NormalizedShort2>, IPackedVector
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(NormalizedShort2 left, NormalizedShort2 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort2>(2, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -64,6 +64,10 @@ public partial struct NormalizedShort4 : IPixel<NormalizedShort4>, IPackedVector
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(NormalizedShort4 left, NormalizedShort4 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<NormalizedShort4>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

1
src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Rgb24.PixelOperations.cs

@ -15,7 +15,6 @@ public partial struct Rgb24
/// </summary>
internal partial class PixelOperations : PixelOperations<Rgb24>
{
/// <inheritdoc />
internal override void PackFromRgbPlanes(
ReadOnlySpan<byte> redChannel,

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

@ -58,6 +58,10 @@ public partial struct Rg32 : IPixel<Rg32>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Rg32 left, Rg32 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rg32>(2, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -107,6 +107,10 @@ public partial struct Rgb24 : IPixel<Rgb24>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Rgb24 left, Rgb24 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgb24>(3, PixelAlphaRepresentation.None);
/// <inheritdoc/>

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

@ -70,6 +70,10 @@ public partial struct Rgb48 : IPixel<Rgb48>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Rgb48 left, Rgb48 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgb48>(3, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -61,6 +61,10 @@ public partial struct Rgba1010102 : IPixel<Rgba1010102>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Rgba1010102 left, Rgba1010102 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba1010102>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -287,6 +287,10 @@ public partial struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint>
return true;
}
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba32>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -207,6 +207,10 @@ public partial struct Rgba64 : IPixel<Rgba64>, IPackedVector<ulong>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Rgba64 left, Rgba64 right) => left.PackedValue != right.PackedValue;
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Rgba64>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -97,6 +97,10 @@ public partial struct RgbaVector : IPixel<RgbaVector>
/// </returns>
public static RgbaVector FromHex(string hex) => Color.ParseHex(hex).ToPixel<RgbaVector>();
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<RgbaVector>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

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

@ -65,6 +65,10 @@ public partial struct Short2 : IPixel<Short2>, IPackedVector<uint>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Short2 left, Short2 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short2>(2, PixelAlphaRepresentation.None);
/// <inheritdoc />

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

@ -67,6 +67,10 @@ public partial struct Short4 : IPixel<Short4>, IPackedVector<ulong>
[MethodImpl(InliningOptions.ShortMethod)]
public static bool operator !=(Short4 left, Short4 right) => !left.Equals(right);
/// <summary>
/// Gets the The pixel type information.
/// </summary>
/// <returns>PixelTypeInfo</returns>
public static PixelTypeInfo GetPixelTypeInfo() => PixelTypeInfo.Create<Short4>(4, PixelAlphaRepresentation.Unassociated);
/// <inheritdoc />

Loading…
Cancel
Save