Browse Source

Optimize and cleanup per review

pull/2739/head
James Jackson-South 2 years ago
parent
commit
b458ff2fa0
  1. 18
      src/ImageSharp/ColorProfiles/CieLab.cs
  2. 10
      src/ImageSharp/ColorProfiles/CieLch.cs
  3. 18
      src/ImageSharp/ColorProfiles/CieLchuv.cs
  4. 10
      src/ImageSharp/ColorProfiles/CieLuv.cs
  5. 7
      src/ImageSharp/ColorProfiles/CieXyChromaticityCoordinates.cs
  6. 10
      src/ImageSharp/ColorProfiles/CieXyy.cs
  7. 5
      src/ImageSharp/ColorProfiles/CieXyz.cs
  8. 13
      src/ImageSharp/ColorProfiles/Cmyk.cs
  9. 10
      src/ImageSharp/ColorProfiles/Hsl.cs
  10. 10
      src/ImageSharp/ColorProfiles/Hsv.cs
  11. 22
      src/ImageSharp/ColorProfiles/HunterLab.cs
  12. 46
      src/ImageSharp/ColorProfiles/KnownIlluminants.cs
  13. 14
      src/ImageSharp/ColorProfiles/Lms.cs
  14. 10
      src/ImageSharp/ColorProfiles/Rgb.cs
  15. 2
      src/ImageSharp/ColorProfiles/RgbPrimariesChromaticityCoordinates.cs
  16. 10
      src/ImageSharp/ColorProfiles/YCbCr.cs

18
src/ImageSharp/ColorProfiles/CieLab.cs

@ -12,12 +12,6 @@ namespace SixLabors.ImageSharp.ColorProfiles;
/// </summary>
public readonly struct CieLab : IProfileConnectingSpace<CieLab, CieXyz>
{
/// <summary>
/// D50 standard illuminant.
/// Used when reference white is not specified explicitly.
/// </summary>
public static readonly CieXyz DefaultWhitePoint = KnownIlluminants.D50;
/// <summary>
/// Initializes a new instance of the <see cref="CieLab"/> struct.
/// </summary>
@ -50,19 +44,19 @@ public readonly struct CieLab : IProfileConnectingSpace<CieLab, CieXyz>
/// Gets the lightness dimension.
/// <remarks>A value usually ranging between 0 (black), 100 (diffuse white) or higher (specular white).</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the a color component.
/// <remarks>A value usually ranging from -100 to 100. Negative is green, positive magenta.</remarks>
/// </summary>
public readonly float A { get; }
public float A { get; }
/// <summary>
/// Gets the b color component.
/// <remarks>A value usually ranging from -100 to 100. Negative is blue, positive is yellow</remarks>
/// </summary>
public readonly float B { get; }
public float B { get; }
/// <summary>
/// Compares two <see cref="CieLab"/> objects for equality.
@ -97,10 +91,8 @@ public readonly struct CieLab : IProfileConnectingSpace<CieLab, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLab other) =>
this.L.Equals(other.L)
&& this.A.Equals(other.A)
&& this.B.Equals(other.B);
public bool Equals(CieLab other)
=> new Vector3(this.L, this.A, this.B) == new Vector3(other.L, other.A, other.B);
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]

10
src/ImageSharp/ColorProfiles/CieLch.cs

@ -44,19 +44,19 @@ public readonly struct CieLch : IColorProfile<CieLch, CieLab>
/// Gets the lightness dimension.
/// <remarks>A value ranging between 0 (black), 100 (diffuse white) or higher (specular white).</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the a chroma component.
/// <remarks>A value ranging from 0 to 200.</remarks>
/// </summary>
public readonly float C { get; }
public float C { get; }
/// <summary>
/// Gets the h° hue component in degrees.
/// <remarks>A value ranging from 0 to 360.</remarks>
/// </summary>
public readonly float H { get; }
public float H { get; }
/// <summary>
/// Compares two <see cref="CieLch"/> objects for equality.
@ -94,9 +94,7 @@ public readonly struct CieLch : IColorProfile<CieLch, CieLab>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLch other)
=> this.L.Equals(other.L)
&& this.C.Equals(other.C)
&& this.H.Equals(other.H);
=> new Vector3(this.L, this.C, this.H) == new Vector3(other.L, other.C, other.H);
/// <inheritdoc/>
public static CieLch FromProfileConnectingSpace(ColorConversionOptions options, in CieLab source)

18
src/ImageSharp/ColorProfiles/CieLchuv.cs

@ -45,24 +45,19 @@ public readonly struct CieLchuv : IColorProfile<CieLchuv, CieXyz>
/// Gets the lightness dimension.
/// <remarks>A value ranging between 0 (black), 100 (diffuse white) or higher (specular white).</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the a chroma component.
/// <remarks>A value ranging from 0 to 200.</remarks>
/// </summary>
public readonly float C { get; }
public float C { get; }
/// <summary>
/// Gets the h° hue component in degrees.
/// <remarks>A value ranging from 0 to 360.</remarks>
/// </summary>
public readonly float H { get; }
/// <summary>
/// Gets the reference white point of this color
/// </summary>
public readonly CieXyz WhitePoint { get; }
public float H { get; }
/// <summary>
/// Compares two <see cref="CieLchuv"/> objects for equality.
@ -151,7 +146,7 @@ public readonly struct CieLchuv : IColorProfile<CieLchuv, CieXyz>
/// <inheritdoc/>
public override int GetHashCode()
=> HashCode.Combine(this.L, this.C, this.H, this.WhitePoint);
=> HashCode.Combine(this.L, this.C, this.H);
/// <inheritdoc/>
public override string ToString()
@ -164,10 +159,7 @@ public readonly struct CieLchuv : IColorProfile<CieLchuv, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLchuv other)
=> this.L.Equals(other.L)
&& this.C.Equals(other.C)
&& this.H.Equals(other.H)
&& this.WhitePoint.Equals(other.WhitePoint);
=> new Vector3(this.L, this.C, this.H) == new Vector3(other.L, other.C, other.H);
/// <summary>
/// Computes the saturation of the color (chroma normalized by lightness)

10
src/ImageSharp/ColorProfiles/CieLuv.cs

@ -46,19 +46,19 @@ public readonly struct CieLuv : IColorProfile<CieLuv, CieXyz>
/// Gets the lightness dimension
/// <remarks>A value usually ranging between 0 and 100.</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the blue-yellow chromaticity coordinate of the given white point.
/// <remarks>A value usually ranging between -100 and 100.</remarks>
/// </summary>
public readonly float U { get; }
public float U { get; }
/// <summary>
/// Gets the red-green chromaticity coordinate of the given white point.
/// <remarks>A value usually ranging between -100 and 100.</remarks>
/// </summary>
public readonly float V { get; }
public float V { get; }
/// <summary>
/// Compares two <see cref="CieLuv"/> objects for equality.
@ -205,9 +205,7 @@ public readonly struct CieLuv : IColorProfile<CieLuv, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieLuv other)
=> this.L.Equals(other.L)
&& this.U.Equals(other.U)
&& this.V.Equals(other.V);
=> new Vector3(this.L, this.U, this.V) == new Vector3(other.L, other.U, other.V);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static double ComputeU(in CieXyz source)

7
src/ImageSharp/ColorProfiles/CieXyChromaticityCoordinates.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.Numerics;
using System.Runtime.CompilerServices;
// ReSharper disable CompareOfFloatsByEqualityOperator
@ -29,7 +30,7 @@ public readonly struct CieXyChromaticityCoordinates : IEquatable<CieXyChromatici
/// <remarks>
/// Ranges usually from 0 to 1.
/// </remarks>
public readonly float X { get; }
public float X { get; }
/// <summary>
/// Gets the chromaticity Y-coordinate
@ -37,7 +38,7 @@ public readonly struct CieXyChromaticityCoordinates : IEquatable<CieXyChromatici
/// <remarks>
/// Ranges usually from 0 to 1.
/// </remarks>
public readonly float Y { get; }
public float Y { get; }
/// <summary>
/// Compares two <see cref="CieXyChromaticityCoordinates"/> objects for equality.
@ -79,5 +80,5 @@ public readonly struct CieXyChromaticityCoordinates : IEquatable<CieXyChromatici
/// <inheritdoc/>
[MethodImpl(InliningOptions.ShortMethod)]
public bool Equals(CieXyChromaticityCoordinates other)
=> this.X.Equals(other.X) && this.Y.Equals(other.Y);
=> new Vector2(this.X, this.Y) == new Vector2(other.X, other.Y);
}

10
src/ImageSharp/ColorProfiles/CieXyy.cs

@ -45,19 +45,19 @@ public readonly struct CieXyy : IColorProfile<CieXyy, CieXyz>
/// Gets the X chrominance component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float X { get; }
public float X { get; }
/// <summary>
/// Gets the Y chrominance component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float Y { get; }
public float Y { get; }
/// <summary>
/// Gets the Y luminance component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float Yl { get; }
public float Yl { get; }
/// <summary>
/// Compares two <see cref="CieXyy"/> objects for equality.
@ -150,7 +150,5 @@ public readonly struct CieXyy : IColorProfile<CieXyy, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieXyy other)
=> this.X.Equals(other.X)
&& this.Y.Equals(other.Y)
&& this.Yl.Equals(other.Yl);
=> new Vector3(this.X, this.Y, this.Yl) == new Vector3(other.X, other.Y, other.Yl);
}

5
src/ImageSharp/ColorProfiles/CieXyz.cs

@ -3,7 +3,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
namespace SixLabors.ImageSharp.ColorProfiles;
@ -99,9 +98,7 @@ public readonly struct CieXyz : IProfileConnectingSpace<CieXyz, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(CieXyz other)
=> this.X.Equals(other.X)
&& this.Y.Equals(other.Y)
&& this.Z.Equals(other.Z);
=> new Vector3(this.X, this.Y, this.Z) == new Vector3(other.X, other.Y, other.Z);
/// <inheritdoc/>
public static CieXyz FromProfileConnectingSpace(ColorConversionOptions options, in CieXyz source)

13
src/ImageSharp/ColorProfiles/Cmyk.cs

@ -45,25 +45,25 @@ public readonly struct Cmyk : IColorProfile<Cmyk, Rgb>
/// Gets the cyan color component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float C { get; }
public float C { get; }
/// <summary>
/// Gets the magenta color component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float M { get; }
public float M { get; }
/// <summary>
/// Gets the yellow color component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float Y { get; }
public float Y { get; }
/// <summary>
/// Gets the keyline black color component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float K { get; }
public float K { get; }
/// <summary>
/// Compares two <see cref="Cmyk"/> objects for equality.
@ -157,8 +157,5 @@ public readonly struct Cmyk : IColorProfile<Cmyk, Rgb>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Cmyk other)
=> this.C.Equals(other.C)
&& this.M.Equals(other.M)
&& this.Y.Equals(other.Y)
&& this.K.Equals(other.K);
=> new Vector4(this.C, this.M, this.Y, this.K) == new Vector4(other.C, other.M, other.Y, other.K);
}

10
src/ImageSharp/ColorProfiles/Hsl.cs

@ -43,19 +43,19 @@ public readonly struct Hsl : IColorProfile<Hsl, Rgb>
/// Gets the hue component.
/// <remarks>A value ranging between 0 and 360.</remarks>
/// </summary>
public readonly float H { get; }
public float H { get; }
/// <summary>
/// Gets the saturation component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float S { get; }
public float S { get; }
/// <summary>
/// Gets the lightness component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Compares two <see cref="Hsl"/> objects for equality.
@ -200,9 +200,7 @@ public readonly struct Hsl : IColorProfile<Hsl, Rgb>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Hsl other)
=> this.H.Equals(other.H)
&& this.S.Equals(other.S)
&& this.L.Equals(other.L);
=> new Vector3(this.H, this.S, this.L) == new Vector3(other.H, other.S, other.L);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static float GetColorComponent(float first, float second, float third)

10
src/ImageSharp/ColorProfiles/Hsv.cs

@ -43,19 +43,19 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// Gets the hue component.
/// <remarks>A value ranging between 0 and 360.</remarks>
/// </summary>
public readonly float H { get; }
public float H { get; }
/// <summary>
/// Gets the saturation component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float S { get; }
public float S { get; }
/// <summary>
/// Gets the value (brightness) component.
/// <remarks>A value ranging between 0 and 1.</remarks>
/// </summary>
public readonly float V { get; }
public float V { get; }
/// <summary>
/// Compares two <see cref="Hsv"/> objects for equality.
@ -223,7 +223,5 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Hsv other)
=> this.H.Equals(other.H)
&& this.S.Equals(other.S)
&& this.V.Equals(other.V);
=> new Vector3(this.H, this.S, this.V) == new Vector3(other.H, other.S, other.V);
}

22
src/ImageSharp/ColorProfiles/HunterLab.cs

@ -20,8 +20,10 @@ public readonly struct HunterLab : IColorProfile<HunterLab, CieXyz>
/// <param name="b">The b (blue - yellow) component.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public HunterLab(float l, float a, float b)
: this(new Vector3(l, a, b))
{
this.L = l;
this.A = a;
this.B = b;
}
/// <summary>
@ -41,24 +43,19 @@ public readonly struct HunterLab : IColorProfile<HunterLab, CieXyz>
/// Gets the lightness dimension.
/// <remarks>A value usually ranging between 0 (black), 100 (diffuse white) or higher (specular white).</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the a color component.
/// <remarks>A value usually ranging from -100 to 100. Negative is green, positive magenta.</remarks>
/// </summary>
public readonly float A { get; }
public float A { get; }
/// <summary>
/// Gets the b color component.
/// <remarks>A value usually ranging from -100 to 100. Negative is blue, positive is yellow</remarks>
/// </summary>
public readonly float B { get; }
/// <summary>
/// Gets the reference white point of this color.
/// </summary>
public readonly CieXyz WhitePoint { get; }
public float B { get; }
/// <summary>
/// Compares two <see cref="HunterLab"/> objects for equality.
@ -162,7 +159,7 @@ public readonly struct HunterLab : IColorProfile<HunterLab, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() => HashCode.Combine(this.L, this.A, this.B, this.WhitePoint);
public override int GetHashCode() => HashCode.Combine(this.L, this.A, this.B);
/// <inheritdoc/>
public override string ToString() => FormattableString.Invariant($"HunterLab({this.L:#0.##}, {this.A:#0.##}, {this.B:#0.##})");
@ -173,10 +170,7 @@ public readonly struct HunterLab : IColorProfile<HunterLab, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(HunterLab other)
=> this.L.Equals(other.L)
&& this.A.Equals(other.A)
&& this.B.Equals(other.B)
&& this.WhitePoint.Equals(other.WhitePoint);
=> new Vector3(this.L, this.A, this.B) == new Vector3(other.L, other.A, other.B);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static float ComputeKa(in CieXyz whitePoint)

46
src/ImageSharp/ColorProfiles/KnownIlluminants.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.ColorProfiles;
@ -15,57 +15,57 @@ namespace SixLabors.ImageSharp.ColorProfiles;
public static class KnownIlluminants
{
/// <summary>
/// Incandescent / Tungsten
/// Gets the Incandescent / Tungsten illuminant.
/// </summary>
public static readonly CieXyz A = new(1.09850F, 1F, 0.35585F);
public static CieXyz A { get; } = new(1.09850F, 1F, 0.35585F);
/// <summary>
/// Direct sunlight at noon (obsoleteF)
/// Gets the Direct sunlight at noon (obsoleteF) illuminant.
/// </summary>
public static readonly CieXyz B = new(0.99072F, 1F, 0.85223F);
public static CieXyz B { get; } = new(0.99072F, 1F, 0.85223F);
/// <summary>
/// Average / North sky Daylight (obsoleteF)
/// Gets the Average / North sky Daylight (obsoleteF) illuminant.
/// </summary>
public static readonly CieXyz C = new(0.98074F, 1F, 1.18232F);
public static CieXyz C { get; } = new(0.98074F, 1F, 1.18232F);
/// <summary>
/// Horizon Light. ICC profile PCS
/// Gets the Horizon Light. ICC profile PCS illuminant.
/// </summary>
public static readonly CieXyz D50 = new(0.96422F, 1F, 0.82521F);
public static CieXyz D50 { get; } = new(0.96422F, 1F, 0.82521F);
/// <summary>
/// Mid-morning / Mid-afternoon Daylight
/// Gets the Mid-morning / Mid-afternoon Daylight illuminant.
/// </summary>
public static readonly CieXyz D55 = new(0.95682F, 1F, 0.92149F);
public static CieXyz D55 { get; } = new(0.95682F, 1F, 0.92149F);
/// <summary>
/// Noon Daylight: TelevisionF, sRGB color space
/// Gets the Noon Daylight: TelevisionF, sRGB color space illuminant.
/// </summary>
public static readonly CieXyz D65 = new(0.95047F, 1F, 1.08883F);
public static CieXyz D65 { get; } = new(0.95047F, 1F, 1.08883F);
/// <summary>
/// North sky Daylight
/// Gets the North sky Daylight illuminant.
/// </summary>
public static readonly CieXyz D75 = new(0.94972F, 1F, 1.22638F);
public static CieXyz D75 { get; } = new(0.94972F, 1F, 1.22638F);
/// <summary>
/// Equal energy
/// Gets the Equal energy illuminant.
/// </summary>
public static readonly CieXyz E = new(1F, 1F, 1F);
public static CieXyz E { get; } = new(1F, 1F, 1F);
/// <summary>
/// Cool White Fluorescent
/// Gets the Cool White Fluorescent illuminant.
/// </summary>
public static readonly CieXyz F2 = new(0.99186F, 1F, 0.67393F);
public static CieXyz F2 { get; } = new(0.99186F, 1F, 0.67393F);
/// <summary>
/// D65 simulatorF, Daylight simulator
/// Gets the D65 simulatorF, Daylight simulator illuminant.
/// </summary>
public static readonly CieXyz F7 = new(0.95041F, 1F, 1.08747F);
public static CieXyz F7 { get; } = new(0.95041F, 1F, 1.08747F);
/// <summary>
/// Philips TL84F, Ultralume 40
/// Gets the Philips TL84F, Ultralume 40 illuminant.
/// </summary>
public static readonly CieXyz F11 = new(1.00962F, 1F, 0.64350F);
public static CieXyz F11 { get; } = new(1.00962F, 1F, 0.64350F);
}

14
src/ImageSharp/ColorProfiles/Lms.cs

@ -16,8 +16,10 @@ internal readonly struct Lms : IColorProfile<Lms, CieXyz>
/// <param name="s">S represents the responsivity at short wavelengths.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Lms(float l, float m, float s)
: this(new Vector3(l, m, s))
{
this.L = l;
this.M = m;
this.S = s;
}
/// <summary>
@ -37,19 +39,19 @@ internal readonly struct Lms : IColorProfile<Lms, CieXyz>
/// Gets the L long component.
/// <remarks>A value usually ranging between -1 and 1.</remarks>
/// </summary>
public readonly float L { get; }
public float L { get; }
/// <summary>
/// Gets the M medium component.
/// <remarks>A value usually ranging between -1 and 1.</remarks>
/// </summary>
public readonly float M { get; }
public float M { get; }
/// <summary>
/// Gets the S short component.
/// <remarks>A value usually ranging between -1 and 1.</remarks>
/// </summary>
public readonly float S { get; }
public float S { get; }
/// <summary>
/// Compares two <see cref="Lms"/> objects for equality.
@ -92,9 +94,7 @@ internal readonly struct Lms : IColorProfile<Lms, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Lms other)
=> this.L.Equals(other.L)
&& this.M.Equals(other.M)
&& this.S.Equals(other.S);
=> new Vector3(this.L, this.M, this.S) == new Vector3(other.L, other.M, other.S);
/// <inheritdoc/>
public static Lms FromProfileConnectingSpace(ColorConversionOptions options, in CieXyz source)

10
src/ImageSharp/ColorProfiles/Rgb.cs

@ -43,19 +43,19 @@ public readonly struct Rgb : IProfileConnectingSpace<Rgb, CieXyz>
/// Gets the red component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float R { get; }
public float R { get; }
/// <summary>
/// Gets the green component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float G { get; }
public float G { get; }
/// <summary>
/// Gets the blue component.
/// <remarks>A value usually ranging between 0 and 1.</remarks>
/// </summary>
public readonly float B { get; }
public float B { get; }
/// <summary>
/// Compares two <see cref="Rgb"/> objects for equality.
@ -91,9 +91,7 @@ public readonly struct Rgb : IProfileConnectingSpace<Rgb, CieXyz>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Rgb other)
=> this.R.Equals(other.R)
&& this.G.Equals(other.G)
&& this.B.Equals(other.B);
=> new Vector3(this.R, this.G, this.B) == new Vector3(other.R, other.G, other.B);
/// <inheritdoc/>
public static Rgb FromProfileConnectingSpace(ColorConversionOptions options, in CieXyz source)

2
src/ImageSharp/ColorProfiles/RgbPrimariesChromaticityCoordinates.cs

@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using SixLabors.ImageSharp.ColorProfiles.WorkingSpaces;

10
src/ImageSharp/ColorProfiles/YCbCr.cs

@ -45,19 +45,19 @@ public readonly struct YCbCr : IColorProfile<YCbCr, Rgb>
/// Gets the Y luminance component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public readonly float Y { get; }
public float Y { get; }
/// <summary>
/// Gets the Cb chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public readonly float Cb { get; }
public float Cb { get; }
/// <summary>
/// Gets the Cr chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public readonly float Cr { get; }
public float Cr { get; }
/// <summary>
/// Compares two <see cref="YCbCr"/> objects for equality.
@ -152,7 +152,5 @@ public readonly struct YCbCr : IColorProfile<YCbCr, Rgb>
/// <inheritdoc/>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(YCbCr other)
=> this.Y.Equals(other.Y)
&& this.Cb.Equals(other.Cb)
&& this.Cr.Equals(other.Cr);
=> new Vector3(this.Y, this.Cb, this.Cr) == new Vector3(other.Y, other.Cb, other.Cr);
}

Loading…
Cancel
Save