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: 68972e8996c91cc0a2f477aa18cb2be8401e1ccb
Former-commit-id: 858f463b331210bbdea7548447c0ad7a2fa2a658
Former-commit-id: 2faf9054b4f9cdb9acfe22019db9026024f1571d
af/merge-core
Yufei Huang 11 years ago
parent
commit
5238c6d9e6
  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