Browse Source

Couple o' style: 👮 fixes [skip ci]

Former-commit-id: ffea772aa1fc98e01aeb873806e446780624777d
Former-commit-id: b40ce1cbd460c91589c9e7f30df765c15b284a11
Former-commit-id: 4995ad28fb866a16bed880f80e399a1687d649f7
pull/1/head
James Jackson-South 9 years ago
parent
commit
d0fcf65a0f
  1. 2
      Settings.StyleCop
  2. 33
      src/ImageProcessorCore/Colors/Color.cs
  3. 4
      src/ImageProcessorCore/Colors/PackedPixel/IPackedBytes.cs

2
Settings.StyleCop

@ -14,6 +14,8 @@
<Value>Laplacian</Value>
<Value>Sobel</Value>
<Value>Scharr</Value>
<Value>rgb</Value>
<Value>rgba</Value>
<Value>rrggbb</Value>
<Value>rrggbbaa</Value>
<Value>scanline</Value>

33
src/ImageProcessorCore/Colors/Color.cs

@ -214,15 +214,27 @@ namespace ImageProcessorCore
/// The hexadecimal representation of the combined color components arranged
/// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax.
/// </param>
/// <returns>
/// The <see cref="Color"/>.
/// </returns>
public static Color FromHex(string hex)
{
return new Color(hex);
}
/// <inheritdoc/>
public void PackFromBytes(byte r, byte g, byte b, byte a)
public void PackFromBytes(byte x, byte y, byte z, byte w)
{
this.packedValue = Pack(r, g, b, a);
this.packedValue = Pack(x, y, z, w);
}
/// <summary>
/// Converts the value of this instance to a hexadecimal string.
/// </summary>
/// <returns>A hexadecimal string representation of the value.</returns>
public string ToHex()
{
return this.PackedValue.ToString("X8");
}
/// <inheritdoc/>
@ -253,19 +265,10 @@ namespace ImageProcessorCore
bytes[startIndex + 3] = this.A;
break;
default:
throw new NotSupportedException();
throw new NotSupportedException();
}
}
/// <summary>
/// Converts the value of this instance to a hexadecimal string.
/// </summary>
/// <returns>A hexadecimal string representation of the value.</returns>
public string ToHex()
{
return this.PackedValue.ToString("X8");
}
/// <inheritdoc/>
public void PackFromVector4(Vector4 vector)
{
@ -309,7 +312,7 @@ namespace ImageProcessorCore
/// Packs a <see cref="Vector4"/> into a uint.
/// </summary>
/// <param name="vector">The vector containing the values to pack.</param>
/// <returns>The ulong containing the packed values.</returns>
/// <returns>The <see cref="uint"/> containing the packed values.</returns>
private static uint Pack(ref Vector4 vector)
{
vector = Vector4.Clamp(vector, Vector4.Zero, Vector4.One);
@ -318,14 +321,14 @@ namespace ImageProcessorCore
return (uint)(((byte)vector.X << 24)
| ((byte)vector.Y << 16)
| ((byte)vector.Z << 8)
| (byte)vector.W);
| (byte)vector.W);
}
/// <summary>
/// Packs a <see cref="Vector3"/> into a uint.
/// </summary>
/// <param name="vector">The vector containing the values to pack.</param>
/// <returns>The ulong containing the packed values.</returns>
/// <returns>The <see cref="uint"/> containing the packed values.</returns>
private static uint Pack(ref Vector3 vector)
{
Vector4 value = new Vector4(vector, 1);

4
src/ImageProcessorCore/Colors/PackedPixel/IPackedBytes.cs

@ -6,7 +6,7 @@
namespace ImageProcessorCore
{
/// <summary>
/// An interface that converts packed vector types to and from <see cref="byte[]"/> values,
/// An interface that converts packed vector types to and from <see cref="T:byte[]"/> values,
/// allowing multiple encodings to be manipulated in a generic manner.
/// </summary>
public interface IPackedBytes
@ -16,7 +16,7 @@ namespace ImageProcessorCore
/// </summary>
/// <param name="x">The x-component.</param>
/// <param name="y">The y-component.</param>
/// <param name="z">The z-omponent.</param>
/// <param name="z">The z-component.</param>
/// <param name="w">The w-component.</param>
void PackFromBytes(byte x, byte y, byte z, byte w);

Loading…
Cancel
Save