diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs index 444221d88..cf55a2245 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/A8.cs @@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(A8 left, A8 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -73,7 +73,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(0, 0, 0, this.PackedValue / 255F); + public Vector4 ToVector4() => new Vector4(0, 0, 0, this.PackedValue / 255F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -136,7 +136,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The object to compare. /// True if the object is equal to the packed vector. - public override readonly bool Equals(object obj) => obj is A8 other && this.Equals(other); + public override bool Equals(object obj) => obj is A8 other && this.Equals(other); /// /// Compares another A8 packed vector with the packed vector. @@ -144,17 +144,17 @@ namespace SixLabors.ImageSharp.PixelFormats /// The A8 packed vector to compare. /// True if the packed vectors are equal. [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(A8 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(A8 other) => this.PackedValue.Equals(other.PackedValue); /// /// Gets a string representation of the packed vector. /// /// A string representation of the packed vector. - public override readonly string ToString() => $"A8({this.PackedValue})"; + public override string ToString() => $"A8({this.PackedValue})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// /// Packs a into a byte. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs index d5f4c54fb..4dc5c9fb5 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Argb32.cs @@ -129,7 +129,7 @@ namespace SixLabors.ImageSharp.PixelFormats public uint Argb { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; @@ -138,10 +138,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// public uint PackedValue { - [MethodImpl(InliningOptions.ShortMethod)] - readonly get => this.Argb; - - [MethodImpl(InliningOptions.ShortMethod)] + get => this.Argb; set => this.Argb = value; } @@ -184,7 +181,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Argb32 left, Argb32 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -192,7 +189,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -200,7 +197,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; + public Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -323,21 +320,21 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is Argb32 argb32 && this.Equals(argb32); + public override bool Equals(object obj) => obj is Argb32 argb32 && this.Equals(argb32); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Argb32 other) => this.Argb == other.Argb; + public bool Equals(Argb32 other) => this.Argb == other.Argb; /// /// Gets a string representation of the packed vector. /// /// A string representation of the packed vector. - public override readonly string ToString() => $"Argb({this.A}, {this.R}, {this.G}, {this.B})"; + public override string ToString() => $"Argb({this.A}, {this.R}, {this.G}, {this.B})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.Argb.GetHashCode(); + public override int GetHashCode() => this.Argb.GetHashCode(); /// /// Packs the four floats into a color. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index 0a2f58409..1cd0b8027 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Bgr24 left, Bgr24 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -110,7 +110,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Rgba32(this.R, this.G, this.B, byte.MaxValue).ToVector4(); + public Vector4 ToVector4() => new Rgba32(this.R, this.G, this.B, byte.MaxValue).ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -219,16 +219,16 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Bgr24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); + public bool Equals(Bgr24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); /// - public override readonly bool Equals(object obj) => obj is Bgr24 other && this.Equals(other); + public override bool Equals(object obj) => obj is Bgr24 other && this.Equals(other); /// - public override readonly string ToString() => $"Bgra({this.B}, {this.G}, {this.R})"; + public override string ToString() => $"Bgra({this.B}, {this.G}, {this.R})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); + public override int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs index 2659689bd..4a7bbded9 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr565.cs @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Bgr565 left, Bgr565 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.ToVector3(), 1F); + public Vector4 ToVector4() => new Vector4(this.ToVector3(), 1F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -144,7 +144,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector3 ToVector3() + public Vector3 ToVector3() { return new Vector3( ((this.PackedValue >> 11) & 0x1F) * (1F / 31F), @@ -153,14 +153,14 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is Bgr565 other && this.Equals(other); + public override bool Equals(object obj) => obj is Bgr565 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Bgr565 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Bgr565 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector3(); return FormattableString.Invariant($"Bgr565({vector.Z:#0.##}, {vector.Y:#0.##}, {vector.X:#0.##})"); @@ -168,7 +168,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static ushort Pack(ref Vector3 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs index 0f2991a35..e4ae35c26 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra32.cs @@ -85,7 +85,7 @@ namespace SixLabors.ImageSharp.PixelFormats public uint Bgra { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; @@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// public uint PackedValue { - readonly get => this.Bgra; + get => this.Bgra; set => this.Bgra = value; } @@ -137,7 +137,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Bgra32 left, Bgra32 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -145,7 +145,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; + public Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -276,16 +276,16 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is Bgra32 other && this.Equals(other); + public override bool Equals(object obj) => obj is Bgra32 other && this.Equals(other); /// - public readonly bool Equals(Bgra32 other) => this.Bgra.Equals(other.Bgra); + public bool Equals(Bgra32 other) => this.Bgra.Equals(other.Bgra); /// - public override readonly int GetHashCode() => this.Bgra.GetHashCode(); + public override int GetHashCode() => this.Bgra.GetHashCode(); /// - public override readonly string ToString() => $"Bgra32({this.B}, {this.G}, {this.R}, {this.A})"; + public override string ToString() => $"Bgra32({this.B}, {this.G}, {this.R}, {this.A})"; /// /// Packs a into a color. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs index f06831284..f4479603f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra4444.cs @@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Bgra4444 left, Bgra4444 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { const float Max = 1 / 15F; @@ -142,14 +142,14 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Bgra4444 other && this.Equals(other); + public override bool Equals(object obj) => obj is Bgra4444 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Bgra4444 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Bgra4444 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"Bgra4444({vector.Z:#0.##}, {vector.Y:#0.##}, {vector.X:#0.##}, {vector.W:#0.##})"); @@ -157,7 +157,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static ushort Pack(ref Vector4 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs index 92f2a3f75..b3d7015cf 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgra5551.cs @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Bgra5551 left, Bgra5551 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( ((this.PackedValue >> 10) & 0x1F) / 31F, @@ -147,10 +147,10 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Bgra5551 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Bgra5551 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"Bgra5551({vector.Z:#0.##}, {vector.Y:#0.##}, {vector.X:#0.##}, {vector.W:#0.##})"); @@ -158,7 +158,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static ushort Pack(ref Vector4 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs index 728966b00..6583670f1 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Byte4.cs @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Byte4 left, Byte4 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4() / 255F; + public Vector4 ToScaledVector4() => this.ToVector4() / 255F; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( this.PackedValue & 0xFF, @@ -143,18 +143,18 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Byte4 byte4 && this.Equals(byte4); + public override bool Equals(object obj) => obj is Byte4 byte4 && this.Equals(byte4); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Byte4 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Byte4 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"Byte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs index 977df78b8..4d6c4985a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfSingle.cs @@ -61,7 +61,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { float single = this.ToSingle() + 1F; single /= 2F; @@ -74,7 +74,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.ToSingle(), 0, 0, 1F); + public Vector4 ToVector4() => new Vector4(this.ToSingle(), 0, 0, 1F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -136,20 +136,20 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly float ToSingle() => HalfTypeHelper.Unpack(this.PackedValue); + public float ToSingle() => HalfTypeHelper.Unpack(this.PackedValue); /// - public override readonly bool Equals(object obj) => obj is HalfSingle other && this.Equals(other); + public override bool Equals(object obj) => obj is HalfSingle other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(HalfSingle other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(HalfSingle other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() => FormattableString.Invariant($"HalfSingle({this.ToSingle():#0.##})"); + public override string ToString() => FormattableString.Invariant($"HalfSingle({this.ToSingle():#0.##})"); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs index 1ecaa05da..300458cb2 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector2.cs @@ -54,7 +54,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(HalfVector2 left, HalfVector2 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector2(); scaled += Vector2.One; @@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { var vector = this.ToVector2(); return new Vector4(vector.X, vector.Y, 0F, 1F); @@ -147,7 +147,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector2 ToVector2() + public Vector2 ToVector2() { Vector2 vector; vector.X = HalfTypeHelper.Unpack((ushort)this.PackedValue); @@ -156,14 +156,14 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is HalfVector2 other && this.Equals(other); + public override bool Equals(object obj) => obj is HalfVector2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(HalfVector2 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(HalfVector2 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector2(); return FormattableString.Invariant($"HalfVector2({vector.X:#0.##}, {vector.Y:#0.##})"); @@ -171,7 +171,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static uint Pack(float x, float y) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs index 35822779f..5ccc09e9f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/HalfVector4.cs @@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(HalfVector4 left, HalfVector4 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector4(); scaled += Vector4.One; @@ -86,7 +86,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( HalfTypeHelper.Unpack((ushort)this.PackedValue), @@ -151,14 +151,14 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is HalfVector4 other && this.Equals(other); + public override bool Equals(object obj) => obj is HalfVector4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(HalfVector4 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(HalfVector4 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"HalfVector4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})"); @@ -166,7 +166,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// /// Packs a into a . diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs index 7235abd21..cbe34745c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L16.cs @@ -48,7 +48,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(L16 left, L16 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -56,7 +56,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -64,7 +64,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { float scaled = this.PackedValue / Max; return new Vector4(scaled, scaled, scaled, 1F); @@ -160,18 +160,18 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.PackedValue = ImageMaths.Get16BitBT709Luminance(source.R, source.G, source.B); /// - public override readonly bool Equals(object obj) => obj is L16 other && this.Equals(other); + public override bool Equals(object obj) => obj is L16 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(L16 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(L16 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() => $"L16({this.PackedValue})"; + public override string ToString() => $"L16({this.PackedValue})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] internal void ConvertFromRgbaScaledVector4(Vector4 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs index c622f1750..b4911ec1c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/L8.cs @@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(L8 left, L8 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -57,7 +57,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { float rgb = this.PackedValue / 255F; return new Vector4(rgb, rgb, rgb, 1F); @@ -138,18 +138,18 @@ namespace SixLabors.ImageSharp.PixelFormats ImageMaths.DownScaleFrom16BitTo8Bit(source.B)); /// - public override readonly bool Equals(object obj) => obj is L8 other && this.Equals(other); + public override bool Equals(object obj) => obj is L8 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(L8 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(L8 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() => $"L8({this.PackedValue})"; + public override string ToString() => $"L8({this.PackedValue})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] internal void ConvertFromRgbaScaledVector4(Vector4 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs index 66cb757c3..2ab5da158 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La16.cs @@ -45,7 +45,8 @@ namespace SixLabors.ImageSharp.PixelFormats /// public ushort PackedValue { - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); + set => Unsafe.As(ref this) = value; } @@ -72,21 +73,21 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(La16 left, La16 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(La16 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(La16 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly bool Equals(object obj) => obj is La16 other && this.Equals(other); + public override bool Equals(object obj) => obj is La16 other && this.Equals(other); /// - public override readonly string ToString() => $"La16({this.L}, {this.A})"; + public override string ToString() => $"La16({this.L}, {this.A})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -203,11 +204,11 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { const float Max = 255F; float rgb = this.L / Max; diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs index 4885dae61..b13c43827 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/La32.cs @@ -45,10 +45,8 @@ namespace SixLabors.ImageSharp.PixelFormats /// public uint PackedValue { - [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); - [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; } @@ -75,21 +73,21 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(La32 left, La32 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(La32 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(La32 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly bool Equals(object obj) => obj is La32 other && this.Equals(other); + public override bool Equals(object obj) => obj is La32 other && this.Equals(other); /// - public override readonly string ToString() => $"La32({this.L}, {this.A})"; + public override string ToString() => $"La32({this.L}, {this.A})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -220,11 +218,11 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { float scaled = this.L / Max; return new Vector4(scaled, scaled, scaled, this.A / Max); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs index 54effcb22..d6362dacc 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte2.cs @@ -60,20 +60,20 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(NormalizedByte2 left, NormalizedByte2 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] public void FromScaledVector4(Vector4 vector) { - Vector2 scaled = new Vector2(vector.X, vector.Y) * 2F; + var scaled = new Vector2(vector.X, vector.Y) * 2F; scaled -= Vector2.One; this.PackedValue = Pack(scaled); } /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector2(); scaled += Vector2.One; @@ -91,7 +91,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.ToVector2(), 0F, 1F); + public Vector4 ToVector4() => new Vector4(this.ToVector2(), 0F, 1F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -151,7 +151,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector2 ToVector2() + public Vector2 ToVector2() { return new Vector2( (sbyte)((this.PackedValue >> 0) & 0xFF) / 127F, @@ -159,18 +159,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is NormalizedByte2 other && this.Equals(other); + public override bool Equals(object obj) => obj is NormalizedByte2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(NormalizedByte2 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(NormalizedByte2 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector2(); return FormattableString.Invariant($"NormalizedByte2({vector.X:#0.##}, {vector.Y:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs index 3a4b92ff3..f6c5d2580 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedByte4.cs @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(NormalizedByte4 left, NormalizedByte4 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector4(); scaled += Vector4.One; @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( (sbyte)((this.PackedValue >> 0) & 0xFF) / 127F, @@ -154,18 +154,18 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is NormalizedByte4 other && this.Equals(other); + public override bool Equals(object obj) => obj is NormalizedByte4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(NormalizedByte4 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(NormalizedByte4 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"NormalizedByte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs index 6be347bcc..989c03e22 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort2.cs @@ -60,20 +60,20 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(NormalizedShort2 left, NormalizedShort2 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] public void FromScaledVector4(Vector4 vector) { - Vector2 scaled = new Vector2(vector.X, vector.Y) * 2F; + var scaled = new Vector2(vector.X, vector.Y) * 2F; scaled -= Vector2.One; this.PackedValue = Pack(scaled); } /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector2(); scaled += Vector2.One; @@ -91,7 +91,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.ToVector2(), 0, 1); + public Vector4 ToVector4() => new Vector4(this.ToVector2(), 0, 1); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector2 ToVector2() + public Vector2 ToVector2() { const float MaxVal = 0x7FFF; @@ -164,18 +164,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is NormalizedShort2 other && this.Equals(other); + public override bool Equals(object obj) => obj is NormalizedShort2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(NormalizedShort2 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(NormalizedShort2 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector2(); return FormattableString.Invariant($"NormalizedShort2({vector.X:#0.##}, {vector.Y:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs index 052e44f71..ed849a6c7 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/NormalizedShort4.cs @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(NormalizedShort4 left, NormalizedShort4 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector4(); scaled += Vector4.One; @@ -89,7 +89,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { const float MaxVal = 0x7FFF; @@ -156,18 +156,18 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is NormalizedShort4 other && this.Equals(other); + public override bool Equals(object obj) => obj is NormalizedShort4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(NormalizedShort4 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(NormalizedShort4 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"NormalizedShort4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs index 60c401003..a7385d5af 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rg32.cs @@ -59,7 +59,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Rg32 left, Rg32 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -67,7 +67,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.ToVector2(), 0F, 1F); + public Vector4 ToVector4() => new Vector4(this.ToVector2(), 0F, 1F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -142,17 +142,17 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFFFF, (this.PackedValue >> 16) & 0xFFFF) / Max; + public Vector2 ToVector2() => new Vector2(this.PackedValue & 0xFFFF, (this.PackedValue >> 16) & 0xFFFF) / Max; /// - public override readonly bool Equals(object obj) => obj is Rg32 other && this.Equals(other); + public override bool Equals(object obj) => obj is Rg32 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rg32 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Rg32 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector2(); return FormattableString.Invariant($"Rg32({vector.X:#0.##}, {vector.Y:#0.##})"); @@ -160,7 +160,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static uint Pack(Vector2 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs index 5eb7b74b2..65191e86f 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb24.cs @@ -108,7 +108,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Rgb24 left, Rgb24 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -116,7 +116,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -124,7 +124,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Rgba32(this.R, this.G, this.B, byte.MaxValue).ToVector4(); + public Vector4 ToVector4() => new Rgba32(this.R, this.G, this.B, byte.MaxValue).ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -232,18 +232,18 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is Rgb24 other && this.Equals(other); + public override bool Equals(object obj) => obj is Rgb24 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rgb24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); + public bool Equals(Rgb24 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); + public override int GetHashCode() => HashCode.Combine(this.R, this.B, this.G); /// - public override readonly string ToString() => $"Rgb24({this.R}, {this.G}, {this.B})"; + public override string ToString() => $"Rgb24({this.R}, {this.G}, {this.B})"; /// /// Packs a into a color. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs index e494ff68e..c78219a48 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgb48.cs @@ -71,7 +71,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Rgb48 left, Rgb48 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -79,7 +79,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -93,7 +93,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R / Max, this.G / Max, this.B / Max, 1F); + public Vector4 ToVector4() => new Vector4(this.R / Max, this.G / Max, this.B / Max, 1F); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -201,17 +201,17 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgb48(Rgb48 source) => this = source; /// - public override readonly bool Equals(object obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); + public override bool Equals(object obj) => obj is Rgb48 rgb48 && this.Equals(rgb48); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rgb48 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); + public bool Equals(Rgb48 other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B); /// - public override readonly string ToString() => $"Rgb48({this.R}, {this.G}, {this.B})"; + public override string ToString() => $"Rgb48({this.R}, {this.G}, {this.B})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs index 2b5670778..330f5a8ee 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba1010102.cs @@ -62,7 +62,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Rgba1010102 left, Rgba1010102 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( (this.PackedValue >> 0) & 0x03FF, @@ -143,14 +143,14 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Rgba1010102 other && this.Equals(other); + public override bool Equals(object obj) => obj is Rgba1010102 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rgba1010102 other) => this.PackedValue == other.PackedValue; + public bool Equals(Rgba1010102 other) => this.PackedValue == other.PackedValue; /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"Rgba1010102({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})"); @@ -158,7 +158,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); [MethodImpl(InliningOptions.ShortMethod)] private static uint Pack(ref Vector4 vector) diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs index 8f67f2166..62f8d97e8 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba32.cs @@ -125,7 +125,7 @@ namespace SixLabors.ImageSharp.PixelFormats public uint Rgba { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; @@ -137,7 +137,7 @@ namespace SixLabors.ImageSharp.PixelFormats public Rgb24 Rgb { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => new Rgb24(this.R, this.G, this.B); + get => new Rgb24(this.R, this.G, this.B); [MethodImpl(InliningOptions.ShortMethod)] set @@ -154,7 +154,7 @@ namespace SixLabors.ImageSharp.PixelFormats public Bgr24 Bgr { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => new Bgr24(this.R, this.G, this.B); + get => new Bgr24(this.R, this.G, this.B); [MethodImpl(InliningOptions.ShortMethod)] set @@ -169,7 +169,7 @@ namespace SixLabors.ImageSharp.PixelFormats public uint PackedValue { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => this.Rgba; + get => this.Rgba; [MethodImpl(InliningOptions.ShortMethod)] set => this.Rgba = value; @@ -287,7 +287,7 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -295,7 +295,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -303,7 +303,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; + public Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / MaxBytes; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -422,25 +422,25 @@ namespace SixLabors.ImageSharp.PixelFormats /// Converts the value of this instance to a hexadecimal string. /// /// A hexadecimal string representation of the value. - public readonly string ToHex() + public string ToHex() { uint hexOrder = (uint)(this.A << 0 | this.B << 8 | this.G << 16 | this.R << 24); return hexOrder.ToString("X8"); } /// - public override readonly bool Equals(object obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); + public override bool Equals(object obj) => obj is Rgba32 rgba32 && this.Equals(rgba32); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rgba32 other) => this.Rgba.Equals(other.Rgba); + public bool Equals(Rgba32 other) => this.Rgba.Equals(other.Rgba); /// - public override readonly string ToString() => $"Rgba32({this.R}, {this.G}, {this.B}, {this.A})"; + public override string ToString() => $"Rgba32({this.R}, {this.G}, {this.B}, {this.A})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.Rgba.GetHashCode(); + public override int GetHashCode() => this.Rgba.GetHashCode(); /// /// Packs a into a color returning a new instance as a result. diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs index 88ef1dc98..56bc6f455 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Rgba64.cs @@ -140,7 +140,7 @@ namespace SixLabors.ImageSharp.PixelFormats public Rgb48 Rgb { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; @@ -150,7 +150,7 @@ namespace SixLabors.ImageSharp.PixelFormats public ulong PackedValue { [MethodImpl(InliningOptions.ShortMethod)] - readonly get => Unsafe.As(ref Unsafe.AsRef(this)); + get => Unsafe.As(ref this); [MethodImpl(InliningOptions.ShortMethod)] set => Unsafe.As(ref this) = value; @@ -195,7 +195,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Rgba64 left, Rgba64 right) => left.PackedValue != right.PackedValue; /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -203,7 +203,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -218,7 +218,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / Max; + public Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A) / Max; /// [MethodImpl(InliningOptions.ShortMethod)] @@ -343,7 +343,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Rgba32 ToRgba32() + public Rgba32 ToRgba32() { byte r = ImageMaths.DownScaleFrom16BitTo8Bit(this.R); byte g = ImageMaths.DownScaleFrom16BitTo8Bit(this.G); @@ -357,7 +357,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Bgra32 ToBgra32() + public Bgra32 ToBgra32() { byte r = ImageMaths.DownScaleFrom16BitTo8Bit(this.R); byte g = ImageMaths.DownScaleFrom16BitTo8Bit(this.G); @@ -371,7 +371,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Argb32 ToArgb32() + public Argb32 ToArgb32() { byte r = ImageMaths.DownScaleFrom16BitTo8Bit(this.R); byte g = ImageMaths.DownScaleFrom16BitTo8Bit(this.G); @@ -385,7 +385,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Rgb24 ToRgb24() + public Rgb24 ToRgb24() { byte r = ImageMaths.DownScaleFrom16BitTo8Bit(this.R); byte g = ImageMaths.DownScaleFrom16BitTo8Bit(this.G); @@ -398,7 +398,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Bgr24 ToBgr24() + public Bgr24 ToBgr24() { byte r = ImageMaths.DownScaleFrom16BitTo8Bit(this.R); byte g = ImageMaths.DownScaleFrom16BitTo8Bit(this.G); @@ -407,17 +407,17 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); + public override bool Equals(object obj) => obj is Rgba64 rgba64 && this.Equals(rgba64); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Rgba64 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Rgba64 other) => this.PackedValue.Equals(other.PackedValue); /// - public override readonly string ToString() => $"Rgba64({this.R}, {this.G}, {this.B}, {this.A})"; + public override string ToString() => $"Rgba64({this.R}, {this.G}, {this.B}, {this.A})"; /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs index 8a6bc94a7..89c5f6ddb 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/RgbaVector.cs @@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static RgbaVector FromHex(string hex) => Color.ParseHex(hex).ToPixel(); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -105,7 +105,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() => this.ToVector4(); + public Vector4 ToScaledVector4() => this.ToVector4(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -120,7 +120,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A); + public Vector4 ToVector4() => new Vector4(this.R, this.G, this.B, this.A); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -178,7 +178,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// Converts the value of this instance to a hexadecimal string. /// /// A hexadecimal string representation of the value. - public readonly string ToHex() + public string ToHex() { // Hex is RRGGBBAA Vector4 vector = this.ToVector4() * Max; @@ -188,23 +188,23 @@ namespace SixLabors.ImageSharp.PixelFormats } /// - public override readonly bool Equals(object obj) => obj is RgbaVector other && this.Equals(other); + public override bool Equals(object obj) => obj is RgbaVector other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(RgbaVector other) => + public bool Equals(RgbaVector other) => this.R.Equals(other.R) && this.G.Equals(other.G) && this.B.Equals(other.B) && this.A.Equals(other.A); /// - public override readonly string ToString() + public override string ToString() { return FormattableString.Invariant($"RgbaVector({this.R:#0.##}, {this.G:#0.##}, {this.B:#0.##}, {this.A:#0.##})"); } /// - public override readonly int GetHashCode() => HashCode.Combine(this.R, this.G, this.B, this.A); + public override int GetHashCode() => HashCode.Combine(this.R, this.G, this.B, this.A); } } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs index 526e831f8..1cc7d269c 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short2.cs @@ -66,20 +66,20 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Short2 left, Short2 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] public void FromScaledVector4(Vector4 vector) { - Vector2 scaled = new Vector2(vector.X, vector.Y) * 65534F; + var scaled = new Vector2(vector.X, vector.Y) * 65534F; scaled -= new Vector2(32767F); this.PackedValue = Pack(scaled); } /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector2(); scaled += new Vector2(32767F); @@ -97,7 +97,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() => new Vector4((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10), 0, 1); + public Vector4 ToVector4() => new Vector4((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10), 0, 1); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -157,21 +157,21 @@ namespace SixLabors.ImageSharp.PixelFormats /// /// The . [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector2 ToVector2() => new Vector2((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10)); + public Vector2 ToVector2() => new Vector2((short)(this.PackedValue & 0xFFFF), (short)(this.PackedValue >> 0x10)); /// - public override readonly bool Equals(object obj) => obj is Short2 other && this.Equals(other); + public override bool Equals(object obj) => obj is Short2 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Short2 other) => this.PackedValue.Equals(other.PackedValue); + public bool Equals(Short2 other) => this.PackedValue.Equals(other.PackedValue); /// [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector2(); return FormattableString.Invariant($"Short2({vector.X:#0.##}, {vector.Y:#0.##})"); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs index e709cd04f..433f49f15 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Short4.cs @@ -68,7 +68,7 @@ namespace SixLabors.ImageSharp.PixelFormats public static bool operator !=(Short4 left, Short4 right) => !left.Equals(right); /// - public readonly PixelOperations CreatePixelOperations() => new PixelOperations(); + public PixelOperations CreatePixelOperations() => new PixelOperations(); /// [MethodImpl(InliningOptions.ShortMethod)] @@ -81,7 +81,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToScaledVector4() + public Vector4 ToScaledVector4() { var scaled = this.ToVector4(); scaled += new Vector4(32767F); @@ -95,7 +95,7 @@ namespace SixLabors.ImageSharp.PixelFormats /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly Vector4 ToVector4() + public Vector4 ToVector4() { return new Vector4( (short)(this.PackedValue & 0xFFFF), @@ -160,21 +160,21 @@ namespace SixLabors.ImageSharp.PixelFormats public void FromRgba64(Rgba64 source) => this.FromScaledVector4(source.ToScaledVector4()); /// - public override readonly bool Equals(object obj) => obj is Short4 other && this.Equals(other); + public override bool Equals(object obj) => obj is Short4 other && this.Equals(other); /// [MethodImpl(InliningOptions.ShortMethod)] - public readonly bool Equals(Short4 other) => this.PackedValue.Equals(other); + public bool Equals(Short4 other) => this.PackedValue.Equals(other); /// /// Gets the hash code for the current instance. /// /// Hash code for the instance. [MethodImpl(InliningOptions.ShortMethod)] - public override readonly int GetHashCode() => this.PackedValue.GetHashCode(); + public override int GetHashCode() => this.PackedValue.GetHashCode(); /// - public override readonly string ToString() + public override string ToString() { var vector = this.ToVector4(); return FormattableString.Invariant($"Short4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})");