Browse Source

Make YCbCr.(Y/Cb/Cr) and Hsv.(H/S/V) a plan field to make color manipulations a bit faster

Former-commit-id: cc64a3b7498c57f3ac5e2b0ab5e59626b6e95e9c
Former-commit-id: d199172432d36258d518faf531aa214c28543bc8
Former-commit-id: b8e0ea3874620340a0c7c7a3e85630dc45e7e23d
af/merge-core
Yufei Huang 11 years ago
parent
commit
ce125669c3
  1. 13
      src/ImageProcessor/Colors/Hsv.cs
  2. 10
      src/ImageProcessor/Colors/YCbCr.cs

13
src/ImageProcessor/Colors/Hsv.cs

@ -45,28 +45,27 @@ namespace ImageProcessor
/// Gets the H hue component.
/// <remarks>A value ranging between 0 and 360.</remarks>
/// </summary>
public float H { get; }
public readonly float H;
/// <summary>
/// Gets the S saturation component.
/// <remarks>A value ranging between 0 and 100.</remarks>
/// </summary>
public float S { get; }
public readonly float S;
/// <summary>
/// Gets the V value (brightness) component.
/// <remarks>A value ranging between 0 and 100.</remarks>
/// </summary>
public float V { get; }
public readonly float V;
/// <summary>
/// Gets a value indicating whether this <see cref="Hsv"/> is empty.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool IsEmpty => Math.Abs(this.H) < Epsilon
&& Math.Abs(this.S) < Epsilon
&& Math.Abs(this.V) < Epsilon;
&& Math.Abs(this.S) < Epsilon
&& Math.Abs(this.V) < Epsilon;
/// <summary>
/// Compares two <see cref="Hsv"/> objects. The result specifies whether the values

10
src/ImageProcessor/Colors/YCbCr.cs

@ -49,27 +49,27 @@ namespace ImageProcessor
/// Gets the Y luminance component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public float Y { get; }
public readonly float Y;
/// <summary>
/// Gets the Cb chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public float Cb { get; }
public readonly float Cb;
/// <summary>
/// Gets the Cr chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary>
public float Cr { get; }
public readonly float Cr;
/// <summary>
/// Gets a value indicating whether this <see cref="YCbCr"/> is empty.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool IsEmpty => Math.Abs(this.Y) < Epsilon
&& Math.Abs(this.Cb) < Epsilon
&& Math.Abs(this.Cr) < Epsilon;
&& Math.Abs(this.Cb) < Epsilon
&& Math.Abs(this.Cr) < Epsilon;
/// <summary>
/// Compares two <see cref="YCbCr"/> objects. The result specifies whether the values

Loading…
Cancel
Save