Browse Source

Cleanup

pull/2739/head
James Jackson-South 2 years ago
parent
commit
e7a2445dba
  1. 6
      src/ImageSharp/ColorProfiles/CieLab.cs
  2. 12
      src/ImageSharp/ColorProfiles/Hsv.cs

6
src/ImageSharp/ColorProfiles/CieLab.cs

@ -104,7 +104,8 @@ public readonly struct CieLab : IProfileConnectingSpace<CieLab, CieXyz>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static CieLab FromProfileConnectingSpace(ColorConversionOptions options, in CieXyz source)
{
// Conversion algorithm described here: http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html
// Conversion algorithm described here:
// http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html
CieXyz whitePoint = options.TargetWhitePoint;
float wx = whitePoint.X, wy = whitePoint.Y, wz = whitePoint.Z;
@ -174,5 +175,6 @@ public readonly struct CieLab : IProfileConnectingSpace<CieLab, CieXyz>
}
/// <inheritdoc/>
public static ChromaticAdaptionWhitePointSource GetChromaticAdaptionWhitePointSource() => ChromaticAdaptionWhitePointSource.WhitePoint;
public static ChromaticAdaptionWhitePointSource GetChromaticAdaptionWhitePointSource()
=> ChromaticAdaptionWhitePointSource.WhitePoint;
}

12
src/ImageSharp/ColorProfiles/Hsv.cs

@ -20,7 +20,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// <param name="h">The h hue component.</param>
/// <param name="s">The s saturation component.</param>
/// <param name="v">The v value (brightness) component.</param>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsv(float h, float s, float v)
: this(new Vector3(h, s, v))
{
@ -30,7 +30,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// Initializes a new instance of the <see cref="Hsv"/> struct.
/// </summary>
/// <param name="vector">The vector representing the h, s, v components.</param>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Hsv(Vector3 vector)
{
vector = Vector3.Clamp(vector, Min, Max);
@ -65,7 +65,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// <returns>
/// True if the current left is equal to the <paramref name="right"/> parameter; otherwise, false.
/// </returns>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Hsv left, Hsv right) => left.Equals(right);
/// <summary>
@ -76,7 +76,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
/// <returns>
/// True if the current left is unequal to the <paramref name="right"/> parameter; otherwise, false.
/// </returns>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Hsv left, Hsv right) => !left.Equals(right);
/// <inheritdoc/>
@ -211,7 +211,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
=> ChromaticAdaptionWhitePointSource.RgbWorkingSpace;
/// <inheritdoc/>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override int GetHashCode() => HashCode.Combine(this.H, this.S, this.V);
/// <inheritdoc/>
@ -221,7 +221,7 @@ public readonly struct Hsv : IColorProfile<Hsv, Rgb>
public override bool Equals(object? obj) => obj is Hsv other && this.Equals(other);
/// <inheritdoc/>
[MethodImpl(InliningOptions.ShortMethod)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(Hsv other)
=> this.H.Equals(other.H)
&& this.S.Equals(other.S)

Loading…
Cancel
Save