Browse Source

Fix Color

Former-commit-id: ccebbd4c9cf2d42c17a76d82af8081cc4ac3080f
Former-commit-id: 04ba5ac8e84a81a2b8f11b5d73eefe2278aa8899
Former-commit-id: 7e6ad2c1f3967b97a86c681d0678b6a5a8942722
af/merge-core
James Jackson-South 10 years ago
parent
commit
35d7279f2c
  1. 34
      src/ImageProcessorCore/Colors/PackedVector/Color.cs
  2. 2
      src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id

34
src/ImageProcessorCore/Colors/PackedVector/Color.cs

@ -54,33 +54,33 @@ namespace ImageProcessorCore
/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="b">The blue component.</param>
/// <param name="g">The green component.</param>
/// <param name="r">The red component.</param>
/// <param name="g">The green component.</param>
/// <param name="b">The blue component.</param>
/// <param name="a">The alpha component.</param>
public Color(float b, float g, float r, float a)
public Color(float r, float g, float b, float a)
: this()
{
Vector4 clamped = Vector4.Clamp(new Vector4(b, g, r, a), Vector4.Zero, Vector4.One) * 255F;
this.B = (byte)Math.Round(clamped.X);
Vector4 clamped = Vector4.Clamp(new Vector4(r, g, b, a), Vector4.Zero, Vector4.One) * 255F;
this.R = (byte)Math.Round(clamped.X);
this.G = (byte)Math.Round(clamped.Y);
this.R = (byte)Math.Round(clamped.Z);
this.B = (byte)Math.Round(clamped.Z);
this.A = (byte)Math.Round(clamped.W);
}
/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="b">The blue component.</param>
/// <param name="g">The green component.</param>
/// <param name="r">The red component.</param>
/// <param name="g">The green component.</param>
/// <param name="b">The blue component.</param>
/// <param name="a">The alpha component.</param>
public Color(byte b, byte g, byte r, byte a)
public Color(byte r, byte g, byte b, byte a)
: this()
{
this.B = b;
this.G = g;
this.R = r;
this.G = g;
this.B = b;
this.A = a;
}
@ -140,31 +140,31 @@ namespace ImageProcessorCore
public void PackVector(Vector4 vector)
{
Vector4 clamped = Vector4.Clamp(vector, Vector4.Zero, Vector4.One) * 255F;
this.B = (byte)Math.Round(clamped.X);
this.R = (byte)Math.Round(clamped.X);
this.G = (byte)Math.Round(clamped.Y);
this.R = (byte)Math.Round(clamped.Z);
this.B = (byte)Math.Round(clamped.Z);
this.A = (byte)Math.Round(clamped.W);
}
/// <inheritdoc/>
public void PackBytes(byte x, byte y, byte z, byte w)
{
this.B = x;
this.R = x;
this.G = y;
this.R = z;
this.B = z;
this.A = w;
}
/// <inheritdoc/>
public Vector4 ToVector4()
{
return new Vector4(this.B, this.G, this.R, this.A) / 255F;
return new Vector4(this.R, this.G, this.B, this.A) / 255F;
}
/// <inheritdoc/>
public byte[] ToBytes()
{
return new[] { this.B, this.G, this.R, this.A };
return new[] { this.R, this.G, this.B, this.A };
}
/// <inheritdoc/>

2
src/ImageProcessorCore/Formats/Jpg/JpegDecoderCore.cs.REMOVED.git-id

@ -1 +1 @@
45c6fbb81e384c9f75e75efc01c269f6e2b20006
09cbf92c0d7d3e4659626b60663612836e1e90e7
Loading…
Cancel
Save