Browse Source

Fix Stylecop SA1028

af/merge-core
James Jackson-South 9 years ago
parent
commit
fc707b3c2c
  1. 2
      src/ImageSharp/Colors/ColorConstants.cs
  2. 14
      src/ImageSharp/Colors/ColorTransforms.cs
  3. 3
      src/ImageSharp/Colors/Colorspaces/CieLab.cs
  4. 2
      src/ImageSharp/Colors/PackedPixel/Alpha8.cs
  5. 4
      src/ImageSharp/Colors/PackedPixel/Bgr565.cs
  6. 4
      src/ImageSharp/Colors/PackedPixel/Bgra4444.cs
  7. 2
      src/ImageSharp/Colors/PackedPixel/Bgra5551.cs
  8. 4
      src/ImageSharp/Colors/PackedPixel/Byte4.cs
  9. 1
      src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs
  10. 12
      src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs
  11. 4
      src/ImageSharp/Colors/PackedPixel/Rgba64.cs
  12. 4
      src/ImageSharp/Colors/PackedPixel/Short4.cs
  13. 4
      src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs
  14. 2
      src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs
  15. 20
      src/ImageSharp/Image/PixelAccessor.cs
  16. 16
      src/ImageSharp/Image/PixelRow.cs
  17. 2
      src/ImageSharp/ImageFrame.cs
  18. 4
      src/ImageSharp/PixelAccessor.cs

2
src/ImageSharp/Colors/ColorConstants.cs

@ -26,7 +26,7 @@ namespace ImageSharp
/// <summary>
/// Returns an array of web safe colors.
/// </summary>
/// <returns></returns>
/// <returns>The <see cref="T:Color[]"/></returns>
private static Color[] GetWebSafeColors()
{
return new List<Color>

14
src/ImageSharp/Colors/ColorTransforms.cs

@ -82,8 +82,8 @@ namespace ImageSharp
/// <summary>
/// Multiplies the complements of the backdrop and source color values, then complements the result.
/// <remarks>
/// The result color is always at least as light as either of the two constituent colors. Screening any
/// color with white produces white; screening with black leaves the original color unchanged.
/// The result color is always at least as light as either of the two constituent colors. Screening any
/// color with white produces white; screening with black leaves the original color unchanged.
/// The effect is similar to projecting multiple photographic slides simultaneously onto a single screen.
/// </remarks>
/// </summary>
@ -99,7 +99,7 @@ namespace ImageSharp
}
/// <summary>
/// Multiplies or screens the colors, depending on the source color value. The effect is similar to
/// Multiplies or screens the colors, depending on the source color value. The effect is similar to
/// shining a harsh spotlight on the backdrop.
/// </summary>
/// <param name="backdrop">The backdrop color.</param>
@ -116,7 +116,7 @@ namespace ImageSharp
/// <summary>
/// Multiplies or screens the colors, depending on the backdrop color value.
/// <remarks>
/// Source colors overlay the backdrop while preserving its highlights and shadows.
/// Source colors overlay the backdrop while preserving its highlights and shadows.
/// The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness
/// of the backdrop.
/// </remarks>
@ -133,7 +133,7 @@ namespace ImageSharp
}
/// <summary>
/// Selects the darker of the backdrop and source colors.
/// Selects the darker of the backdrop and source colors.
/// The backdrop is replaced with the source where the source is darker; otherwise, it is left unchanged.
/// </summary>
/// <param name="backdrop">The backdrop color.</param>
@ -148,7 +148,7 @@ namespace ImageSharp
}
/// <summary>
/// Selects the lighter of the backdrop and source colors.
/// Selects the lighter of the backdrop and source colors.
/// The backdrop is replaced with the source where the source is lighter; otherwise, it is left unchanged.
/// </summary>
/// <param name="backdrop">The backdrop color.</param>
@ -221,7 +221,7 @@ namespace ImageSharp
}
/// <summary>
/// Produces an effect similar to that of the <see cref="Difference"/> mode but lower in contrast. Painting with white
/// Produces an effect similar to that of the <see cref="Difference"/> mode but lower in contrast. Painting with white
/// inverts the backdrop color; painting with black produces no change
/// </summary>
/// <param name="backdrop">The backdrop color.</param>

3
src/ImageSharp/Colors/Colorspaces/CieLab.cs

@ -86,7 +86,8 @@ namespace ImageSharp
// Now to LAB
x /= 0.95047F;
//y /= 1F;
// y /= 1F;
z /= 1.08883F;
x = x > 0.008856F ? (float)Math.Pow(x, 0.3333333F) : ((903.3F * x) + 16F) / 116F;

2
src/ImageSharp/Colors/PackedPixel/Alpha8.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Alpha8 : IPackedPixel<byte>, IEquatable<Alpha8>
{
/// <summary>
/// Initializes a new instance of the <see cref="Alpha8"/> struct.
/// Initializes a new instance of the <see cref="Alpha8"/> struct.
/// </summary>
/// <param name="alpha">The alpha component</param>
public Alpha8(float alpha)

4
src/ImageSharp/Colors/PackedPixel/Bgr565.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Bgr565 : IPackedPixel<ushort>, IEquatable<Bgr565>
{
/// <summary>
/// Initializes a new instance of the <see cref="Bgr565"/> struct.
/// Initializes a new instance of the <see cref="Bgr565"/> struct.
/// </summary>
/// <param name="x">The x-component</param>
/// <param name="y">The y-component</param>
@ -25,7 +25,7 @@ namespace ImageSharp
}
/// <summary>
/// Initializes a new instance of the <see cref="Bgr565"/> struct.
/// Initializes a new instance of the <see cref="Bgr565"/> struct.
/// </summary>
/// <param name="vector">
/// The vector containing the components for the packed value.

4
src/ImageSharp/Colors/PackedPixel/Bgra4444.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Bgra4444 : IPackedPixel<ushort>, IEquatable<Bgra4444>
{
/// <summary>
/// Initializes a new instance of the <see cref="Bgra4444"/> struct.
/// Initializes a new instance of the <see cref="Bgra4444"/> struct.
/// </summary>
/// <param name="x">The x-component</param>
/// <param name="y">The y-component</param>
@ -26,7 +26,7 @@ namespace ImageSharp
}
/// <summary>
/// Initializes a new instance of the <see cref="Bgra4444"/> struct.
/// Initializes a new instance of the <see cref="Bgra4444"/> struct.
/// </summary>
/// <param name="vector">The vector containing the components for the packed vector.</param>
public Bgra4444(Vector4 vector)

2
src/ImageSharp/Colors/PackedPixel/Bgra5551.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Bgra5551 : IPackedPixel<ushort>, IEquatable<Bgra5551>
{
/// <summary>
/// Initializes a new instance of the <see cref="Bgra5551"/> struct.
/// Initializes a new instance of the <see cref="Bgra5551"/> struct.
/// </summary>
/// <param name="x">The x-component</param>
/// <param name="y">The y-component</param>

4
src/ImageSharp/Colors/PackedPixel/Byte4.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Byte4 : IPackedPixel<uint>, IEquatable<Byte4>
{
/// <summary>
/// Initializes a new instance of the <see cref="Byte4"/> struct.
/// Initializes a new instance of the <see cref="Byte4"/> struct.
/// </summary>
/// <param name="vector">
/// A vector containing the initial values for the components of the Byte4 structure.
@ -25,7 +25,7 @@ namespace ImageSharp
}
/// <summary>
/// Initializes a new instance of the <see cref="Byte4"/> struct.
/// Initializes a new instance of the <see cref="Byte4"/> struct.
/// </summary>
/// <param name="x">The x-component</param>
/// <param name="y">The y-component</param>

1
src/ImageSharp/Colors/PackedPixel/HalfTypeHelper.cs

@ -99,6 +99,7 @@ namespace ImageSharp
exponent--;
mantissa = mantissa << 1;
}
mantissa &= 0xfffffbff;
result = ((uint)((((uint)value & 0x8000) << 16) | ((exponent + 127) << 23))) | (mantissa << 13);
}

12
src/ImageSharp/Colors/PackedPixel/PackedPixelConverterHelper.cs

@ -48,25 +48,25 @@ namespace ImageSharp
return FromStandardType(target);
}
// Normalized offsets. All four components.
// Normalized offsets. All four components.
if (IsOffsetNormalizedType(source))
{
return FromOffsetNormalizedType(target);
}
// Offset. All four components.
// Offset. All four components.
if (IsOffsetType(source))
{
return FromOffsetType(target);
}
// Normalized offsets. First component pair only.
// Normalized offsets. First component pair only.
if (IsOffsetTwoComponentNormalizedType(source))
{
return FromOffsetTwoComponentNormalizedType(target);
}
// Offsets. First component pair only.
// Offsets. First component pair only.
if (IsOffsetTwoComponentType(source))
{
return FromOffsetTwoComponentType(target);
@ -200,7 +200,7 @@ namespace ImageSharp
{
return vector4 =>
{
// Compress the range then offset the center up for first pair.
// Compress the range then offset the center up for first pair.
Vector4 v = (vector4 / 2F) + new Vector4(.5F);
return new Vector4(v.X, v.Y, 0F, 1F);
};
@ -210,7 +210,7 @@ namespace ImageSharp
{
return vector4 =>
{
// Compress the range, multiply, then offset the center up for first pair.
// Compress the range, multiply, then offset the center up for first pair.
Vector4 v = ((vector4 / 2F) * 255F) + new Vector4(127.5F);
return new Vector4(v.X, v.Y, 0F, 255F);
};

4
src/ImageSharp/Colors/PackedPixel/Rgba64.cs

@ -14,7 +14,7 @@ namespace ImageSharp
public struct Rgba64 : IPackedPixel<ulong>, IEquatable<Rgba64>, IPackedVector
{
/// <summary>
/// Initializes a new instance of the <see cref="Rgba64"/> struct.
/// Initializes a new instance of the <see cref="Rgba64"/> struct.
/// </summary>
/// <param name="x">The x-component</param>
/// <param name="y">The y-component</param>
@ -26,7 +26,7 @@ namespace ImageSharp
}
/// <summary>
/// Initializes a new instance of the <see cref="Rgba64"/> struct.
/// Initializes a new instance of the <see cref="Rgba64"/> struct.
/// </summary>
/// <param name="vector">The vector containing the components values.</param>
public Rgba64(Vector4 vector)

4
src/ImageSharp/Colors/PackedPixel/Short4.cs

@ -29,7 +29,7 @@ namespace ImageSharp
private static readonly Vector4 Round = new Vector4(.5F);
/// <summary>
/// Initializes a new instance of the <see cref="Short4"/> struct.
/// Initializes a new instance of the <see cref="Short4"/> struct.
/// </summary>
/// <param name="vector">A vector containing the initial values for the components.</param>
public Short4(Vector4 vector)
@ -38,7 +38,7 @@ namespace ImageSharp
}
/// <summary>
/// Initializes a new instance of the <see cref="Short4"/> struct.
/// Initializes a new instance of the <see cref="Short4"/> struct.
/// </summary>
/// <param name="x">The x-component.</param>
/// <param name="y">The y-component.</param>

4
src/ImageSharp/Common/Helpers/Vector4BlendTransforms.cs

@ -89,7 +89,7 @@ namespace ImageSharp
}
/// <summary>
/// Selects the minimum of the backdrop and source vectors.
/// Selects the minimum of the backdrop and source vectors.
/// </summary>
/// <param name="backdrop">The backdrop vector.</param>
/// <param name="source">The source vector.</param>
@ -104,7 +104,7 @@ namespace ImageSharp
}
/// <summary>
/// Selects the max of the backdrop and source vector.
/// Selects the max of the backdrop and source vector.
/// </summary>
/// <param name="backdrop">The backdrop vector.</param>
/// <param name="source">The source vector.</param>

2
src/ImageSharp/Filters/Processors/ColorMatrix/GrayscaleBt709Processor.cs

@ -11,6 +11,8 @@ namespace ImageSharp.Processors
/// Converts the colors of the image to Grayscale applying the formula as specified by
/// ITU-R Recommendation BT.709 <see href="https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients"/>.
/// </summary>
/// <typeparam name="TColor">The pixel format.</typeparam>
/// <typeparam name="TPacked">The packed format. <example>uint, long, float.</example></typeparam>
public class GrayscaleBt709Processor<TColor, TPacked> : ColorMatrixFilter<TColor, TPacked>
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct

20
src/ImageSharp/Image/PixelAccessor.cs

@ -106,7 +106,7 @@ namespace ImageSharp
{
get
{
#if DEBUG
#if DEBUG
if (x < 0 || x >= this.Width)
{
throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
@ -122,7 +122,7 @@ namespace ImageSharp
set
{
#if DEBUG
#if DEBUG
if (x < 0 || x >= this.Width)
{
throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
@ -254,6 +254,14 @@ namespace ImageSharp
GC.SuppressFinalize(this);
}
/// <summary>
/// Resets all the pixels to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height));
}
/// <summary>
/// Copies from a row in <see cref="ComponentOrder.ZYX"/> format.
/// </summary>
@ -429,13 +437,5 @@ namespace ImageSharp
{
return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf<TColor>());
}
/// <summary>
/// Resets all the pixels to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.pixelsBase, 0, (uint)(this.RowStride * this.Height));
}
}
}

16
src/ImageSharp/Image/PixelRow.cs

@ -178,6 +178,14 @@ namespace ImageSharp
GC.SuppressFinalize(this);
}
/// <summary>
/// Resets the bytes of the array to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length);
}
/// <summary>
/// Gets component count for the given order.
/// </summary>
@ -202,13 +210,5 @@ namespace ImageSharp
throw new NotSupportedException();
}
/// <summary>
/// Resets the bytes of the array to it's initial value.
/// </summary>
internal void Reset()
{
Unsafe.InitBlock(this.PixelBase, 0, (uint)this.Bytes.Length);
}
}
}

2
src/ImageSharp/ImageFrame.cs

@ -1,4 +1,4 @@
// <copyright file="Image.cs" company="James Jackson-South">
// <copyright file="ImageFrame.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

4
src/ImageSharp/PixelAccessor.cs

@ -27,7 +27,7 @@ namespace ImageSharp
byte* source = row.PixelBase;
byte* destination = this.GetRowPointer(targetY) + targetX;
Unsafe.CopyBlock(destination, source, (uint) width * 4);
Unsafe.CopyBlock(destination, source, (uint)width * 4);
}
/// <inheritdoc />
@ -38,7 +38,7 @@ namespace ImageSharp
for (int x = 0; x < width; x++)
{
Unsafe.Write(destination, (uint)(*(source) << 0 | *(source + 1) << 8 | *(source + 2) << 16 | 255 << 24));
Unsafe.Write(destination, (uint)(*source << 0 | *(source + 1) << 8 | *(source + 2) << 16 | 255 << 24));
source += 3;
destination += 4;

Loading…
Cancel
Save