Browse Source
Merge pull request #2337 from stefannikolei/stefannikolei/nullable/pixelimplementations
Remove nullable disable from pixelimplementations
pull/2343/head
James Jackson-South
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with
30 additions and
58 deletions
-
src/ImageSharp/PixelFormats/PixelImplementations/A8.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/L16.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/L8.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/La16.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/La32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs
-
src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -140,7 +139,7 @@ public partial struct A8 : IPixel<A8>, IPackedVector<byte> |
|
|
|
/// </summary>
|
|
|
|
/// <param name="obj">The object to compare.</param>
|
|
|
|
/// <returns>True if the object is equal to the packed vector.</returns>
|
|
|
|
public override readonly bool Equals(object obj) => obj is A8 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is A8 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Compares another A8 packed vector with the packed vector.
|
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -335,7 +334,7 @@ public partial struct Abgr32 : IPixel<Abgr32>, IPackedVector<uint> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Abgr32 abgr32 && this.Equals(abgr32); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Abgr32 abgr32 && this.Equals(abgr32); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -334,7 +333,7 @@ public partial struct Argb32 : IPixel<Argb32>, IPackedVector<uint> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Argb32 argb32 && this.Equals(argb32); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Argb32 argb32 && this.Equals(argb32); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -232,7 +231,7 @@ public partial struct Bgr24 : IPixel<Bgr24> |
|
|
|
public readonly bool Equals(Bgr24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Bgr24 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Bgr24 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly string ToString() => $"Bgr24({this.B}, {this.G}, {this.R})"; |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -151,7 +150,7 @@ public partial struct Bgr565 : IPixel<Bgr565>, IPackedVector<ushort> |
|
|
|
(this.PackedValue & 0x1F) * (1F / 31F)); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Bgr565 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Bgr565 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -287,7 +286,7 @@ public partial struct Bgra32 : IPixel<Bgra32>, IPackedVector<uint> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Bgra32 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Bgra32 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public readonly bool Equals(Bgra32 other) => this.Bgra.Equals(other.Bgra); |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -143,7 +142,7 @@ public partial struct Bgra4444 : IPixel<Bgra4444>, IPackedVector<ushort> |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Bgra4444 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Bgra4444 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -141,7 +140,7 @@ public partial struct Byte4 : IPixel<Byte4>, IPackedVector<uint> |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Byte4 byte4 && this.Equals(byte4); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Byte4 byte4 && this.Equals(byte4); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -140,7 +139,7 @@ public partial struct HalfSingle : IPixel<HalfSingle>, IPackedVector<ushort> |
|
|
|
public readonly float ToSingle() => HalfTypeHelper.Unpack(this.PackedValue); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is HalfSingle other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is HalfSingle other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -157,7 +156,7 @@ public partial struct HalfVector2 : IPixel<HalfVector2>, IPackedVector<uint> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is HalfVector2 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is HalfVector2 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -149,7 +148,7 @@ public partial struct HalfVector4 : IPixel<HalfVector4>, IPackedVector<ulong> |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is HalfVector4 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is HalfVector4 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -153,7 +152,7 @@ public partial struct L16 : IPixel<L16>, IPackedVector<ushort> |
|
|
|
public void FromRgba64(Rgba64 source) => this.PackedValue = ColorNumerics.Get16BitBT709Luminance(source.R, source.G, source.B); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is L16 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is L16 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -143,7 +142,7 @@ public partial struct L8 : IPixel<L8>, IPackedVector<byte> |
|
|
|
ColorNumerics.DownScaleFrom16BitTo8Bit(source.B)); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is L8 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is L8 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -80,7 +79,7 @@ public partial struct La16 : IPixel<La16>, IPackedVector<ushort> |
|
|
|
public readonly bool Equals(La16 other) => this.PackedValue.Equals(other.PackedValue); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is La16 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is La16 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly string ToString() => $"La16({this.L}, {this.A})"; |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -82,7 +81,7 @@ public partial struct La32 : IPixel<La32>, IPackedVector<uint> |
|
|
|
public readonly bool Equals(La32 other) => this.PackedValue.Equals(other.PackedValue); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is La32 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is La32 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly string ToString() => $"La32({this.L}, {this.A})"; |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -162,7 +161,7 @@ public partial struct NormalizedByte2 : IPixel<NormalizedByte2>, IPackedVector<u |
|
|
|
(sbyte)((this.PackedValue >> 8) & 0xFF) / MaxPos); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is NormalizedByte2 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is NormalizedByte2 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -154,7 +153,7 @@ public partial struct NormalizedByte4 : IPixel<NormalizedByte4>, IPackedVector<u |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is NormalizedByte4 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is NormalizedByte4 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -163,7 +162,7 @@ public partial struct NormalizedShort2 : IPixel<NormalizedShort2>, IPackedVector |
|
|
|
(short)(this.PackedValue >> 0x10) / MaxPos); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is NormalizedShort2 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is NormalizedShort2 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -155,7 +154,7 @@ public partial struct NormalizedShort4 : IPixel<NormalizedShort4>, IPackedVector |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is NormalizedShort4 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is NormalizedShort4 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -146,7 +145,7 @@ public partial struct Rg32 : IPixel<Rg32>, IPackedVector<uint> |
|
|
|
public readonly Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFFFF, (this.PackedValue >> 16) & 0xFFFF) / Max; |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rg32 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rg32 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -241,7 +240,7 @@ public partial struct Rgb24 : IPixel<Rgb24> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rgb24 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rgb24 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -210,7 +209,7 @@ public partial struct Rgb48 : IPixel<Rgb48> |
|
|
|
public void FromRgb48(Rgb48 source) => this = source; |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -141,7 +140,7 @@ public partial struct Rgba1010102 : IPixel<Rgba1010102>, IPackedVector<uint> |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rgba1010102 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rgba1010102 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Buffers.Binary; |
|
|
|
using System.Globalization; |
|
|
|
@ -267,7 +266,7 @@ public partial struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint> |
|
|
|
/// The <see cref="bool"/>.
|
|
|
|
/// </returns>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
public static bool TryParseHex(string hex, out Rgba32 result) |
|
|
|
public static bool TryParseHex(string? hex, out Rgba32 result) |
|
|
|
{ |
|
|
|
result = default; |
|
|
|
if (string.IsNullOrWhiteSpace(hex)) |
|
|
|
@ -437,7 +436,7 @@ public partial struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
@ -514,7 +513,7 @@ public partial struct Rgba32 : IPixel<Rgba32>, IPackedVector<uint> |
|
|
|
/// <returns>
|
|
|
|
/// A rrggbbaa hex value.
|
|
|
|
/// </returns>
|
|
|
|
private static string ToRgbaHex(string hex) |
|
|
|
private static string? ToRgbaHex(string hex) |
|
|
|
{ |
|
|
|
if (hex[0] == '#') |
|
|
|
{ |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -444,7 +443,7 @@ public partial struct Rgba64 : IPixel<Rgba64>, IPackedVector<ulong> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Globalization; |
|
|
|
using System.Numerics; |
|
|
|
@ -193,7 +192,7 @@ public partial struct RgbaVector : IPixel<RgbaVector> |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public override readonly bool Equals(object obj) => obj is RgbaVector other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is RgbaVector other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -164,7 +163,7 @@ public partial struct Short2 : IPixel<Short2>, IPackedVector<uint> |
|
|
|
public readonly Vector2 ToVector2() => new((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10)); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Short2 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Short2 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
#nullable disable |
|
|
|
|
|
|
|
using System.Numerics; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
@ -164,7 +163,7 @@ public partial struct Short4 : IPixel<Short4>, IPackedVector<ulong> |
|
|
|
public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public override readonly bool Equals(object obj) => obj is Short4 other && this.Equals(other); |
|
|
|
public override readonly bool Equals(object? obj) => obj is Short4 other && this.Equals(other); |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
[MethodImpl(InliningOptions.ShortMethod)] |
|
|
|
|