Browse Source

YCrCr should use byte

af/merge-core
James Jackson-South 9 years ago
parent
commit
bd445a6e5e
  1. 6
      src/ImageSharp/Colors/Spaces/YCbCr.cs
  2. 26
      tests/ImageSharp.Tests/Colors/ColorConversionTests.cs

6
src/ImageSharp/Colors/Spaces/YCbCr.cs

@ -51,19 +51,19 @@ namespace ImageSharp.Colors.Spaces
/// Gets the Y luminance component. /// Gets the Y luminance component.
/// <remarks>A value ranging between 0 and 255.</remarks> /// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary> /// </summary>
public float Y => this.backingVector.X; public byte Y => (byte)this.backingVector.X;
/// <summary> /// <summary>
/// Gets the Cb chroma component. /// Gets the Cb chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks> /// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary> /// </summary>
public float Cb => this.backingVector.Y; public byte Cb => (byte)this.backingVector.Y;
/// <summary> /// <summary>
/// Gets the Cr chroma component. /// Gets the Cr chroma component.
/// <remarks>A value ranging between 0 and 255.</remarks> /// <remarks>A value ranging between 0 and 255.</remarks>
/// </summary> /// </summary>
public float Cr => this.backingVector.Z; public byte Cr => (byte)this.backingVector.Z;
/// <summary> /// <summary>
/// Gets a value indicating whether this <see cref="YCbCr"/> is empty. /// Gets a value indicating whether this <see cref="YCbCr"/> is empty.

26
tests/ImageSharp.Tests/Colors/ColorConversionTests.cs

@ -48,24 +48,6 @@ namespace ImageSharp.Tests
Assert.Equal(128, yCbCr3.Y); Assert.Equal(128, yCbCr3.Y);
Assert.Equal(128, yCbCr3.Cb); Assert.Equal(128, yCbCr3.Cb);
Assert.Equal(128, yCbCr3.Cr); Assert.Equal(128, yCbCr3.Cr);
//Assert.Equal(255, yCbCr.Y, 0);
//Assert.Equal(128, yCbCr.Cb, 0);
//Assert.Equal(128, yCbCr.Cr, 0);
//// Black
//Color color2 = Color.Black;
//YCbCr yCbCr2 = color2;
//Assert.Equal(0, yCbCr2.Y, 0);
//Assert.Equal(128, yCbCr2.Cb, 0);
//Assert.Equal(128, yCbCr2.Cr, 0);
//// Gray
//Color color3 = Color.Gray;
//YCbCr yCbCr3 = color3;
//Assert.Equal(128, yCbCr3.Y, 0);
//Assert.Equal(128, yCbCr3.Cb, 0);
//Assert.Equal(128, yCbCr3.Cr, 0);
} }
/// <summary> /// <summary>
@ -106,7 +88,7 @@ namespace ImageSharp.Tests
/// <summary> /// <summary>
/// Tests the implicit conversion from <see cref="Color"/> to <see cref="CieXyz"/>. /// Tests the implicit conversion from <see cref="Color"/> to <see cref="CieXyz"/>.
/// Comparison values obtained from /// Comparison values obtained from
/// http://colormine.org/convert/rgb-to-xyz /// http://colormine.org/convert/rgb-to-xyz
/// </summary> /// </summary>
[Fact] [Fact]
@ -144,7 +126,7 @@ namespace ImageSharp.Tests
/// <summary> /// <summary>
/// Tests the implicit conversion from <see cref="CieXyz"/> to <see cref="Color"/>. /// Tests the implicit conversion from <see cref="CieXyz"/> to <see cref="Color"/>.
/// Comparison values obtained from /// Comparison values obtained from
/// http://colormine.org/convert/rgb-to-xyz /// http://colormine.org/convert/rgb-to-xyz
/// </summary> /// </summary>
[Fact] [Fact]
@ -430,7 +412,7 @@ namespace ImageSharp.Tests
/// <summary> /// <summary>
/// Tests the implicit conversion from <see cref="Color"/> to <see cref="CieLab"/>. /// Tests the implicit conversion from <see cref="Color"/> to <see cref="CieLab"/>.
/// Comparison values obtained from /// Comparison values obtained from
/// http://colormine.org/convert/rgb-to-lab /// http://colormine.org/convert/rgb-to-lab
/// </summary> /// </summary>
[Fact] [Fact]
@ -469,7 +451,7 @@ namespace ImageSharp.Tests
/// <summary> /// <summary>
/// Tests the implicit conversion from <see cref="CieLab"/> to <see cref="Color"/>. /// Tests the implicit conversion from <see cref="CieLab"/> to <see cref="Color"/>.
/// </summary> /// </summary>
/// Comparison values obtained from /// Comparison values obtained from
/// http://colormine.org/convert/rgb-to-lab /// http://colormine.org/convert/rgb-to-lab
[Fact] [Fact]
public void CieLabToColor() public void CieLabToColor()

Loading…
Cancel
Save