|
|
|
@ -15,11 +15,6 @@ namespace SixLabors.ImageSharp.ColorSpaces |
|
|
|
/// </summary>
|
|
|
|
internal readonly struct YCbCr : IColorVector, IEquatable<YCbCr>, IAlmostEquatable<YCbCr, float> |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Represents a <see cref="YCbCr"/> that has Y, Cb, and Cr values set to zero.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly YCbCr Empty = default; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Vector which is used in clamping to the max value
|
|
|
|
/// </summary>
|
|
|
|
@ -82,12 +77,6 @@ namespace SixLabors.ImageSharp.ColorSpaces |
|
|
|
get => this.backingVector.Z; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a value indicating whether this <see cref="YCbCr"/> is empty.
|
|
|
|
/// </summary>
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)] |
|
|
|
public bool IsEmpty => this.Equals(Empty); |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public Vector3 Vector => this.backingVector; |
|
|
|
|
|
|
|
@ -103,7 +92,6 @@ namespace SixLabors.ImageSharp.ColorSpaces |
|
|
|
/// <returns>
|
|
|
|
/// True if the current left is equal to the <paramref name="right"/> parameter; otherwise, false.
|
|
|
|
/// </returns>
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static bool operator ==(YCbCr left, YCbCr right) |
|
|
|
{ |
|
|
|
return left.Equals(right); |
|
|
|
@ -121,7 +109,6 @@ namespace SixLabors.ImageSharp.ColorSpaces |
|
|
|
/// <returns>
|
|
|
|
/// True if the current left is unequal to the <paramref name="right"/> parameter; otherwise, false.
|
|
|
|
/// </returns>
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static bool operator !=(YCbCr left, YCbCr right) |
|
|
|
{ |
|
|
|
return !left.Equals(right); |
|
|
|
@ -136,23 +123,18 @@ namespace SixLabors.ImageSharp.ColorSpaces |
|
|
|
/// <inheritdoc/>
|
|
|
|
public override string ToString() |
|
|
|
{ |
|
|
|
if (this.IsEmpty) |
|
|
|
{ |
|
|
|
return "YCbCr [ Empty ]"; |
|
|
|
} |
|
|
|
|
|
|
|
return $"YCbCr [ Y={this.Y}, Cb={this.Cb}, Cr={this.Cr} ]"; |
|
|
|
return this.Equals(default) |
|
|
|
? "YCbCr [ Empty ]" |
|
|
|
: $"YCbCr [ Y={this.Y}, Cb={this.Cb}, Cr={this.Cr} ]"; |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public override bool Equals(object obj) |
|
|
|
{ |
|
|
|
return obj is YCbCr other && this.Equals(other); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public bool Equals(YCbCr other) |
|
|
|
{ |
|
|
|
return this.backingVector.Equals(other.backingVector); |
|
|
|
|