diff --git a/Settings.StyleCop b/Settings.StyleCop
index ee82216a4..3fa9874cf 100644
--- a/Settings.StyleCop
+++ b/Settings.StyleCop
@@ -24,6 +24,8 @@
codeword
unscaled
zig-zag
+ crc
+ zlib
diff --git a/src/ImageSharp/Colors/ColorPixelAccessor.cs b/src/ImageSharp/Colors/ColorPixelAccessor.cs
index e7ed0819c..7b8ae2ee2 100644
--- a/src/ImageSharp/Colors/ColorPixelAccessor.cs
+++ b/src/ImageSharp/Colors/ColorPixelAccessor.cs
@@ -8,13 +8,21 @@ namespace ImageSharp
using System;
using System.Runtime.CompilerServices;
- public unsafe sealed class ColorPixelAccessor : PixelAccessor
+ ///
+ /// An optimized pixel accessor for the class.
+ ///
+ public sealed unsafe class ColorPixelAccessor : PixelAccessor
{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The image to provide pixel access for.
public ColorPixelAccessor(ImageBase image)
: base(image)
{
}
+ ///
protected override void CopyFromBGR(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -29,6 +37,7 @@ namespace ImageSharp
}
}
+ ///
protected override void CopyFromBGRA(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -43,6 +52,7 @@ namespace ImageSharp
}
}
+ ///
protected override void CopyToBGR(PixelRow row, int sourceY, int width)
{
byte* source = this.GetRowPointer(sourceY);
@@ -68,6 +78,7 @@ namespace ImageSharp
}
}
+ ///
protected override void CopyToBGRA(PixelRow row, int sourceY, int width)
{
byte* source = this.GetRowPointer(sourceY);
diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
index e06e3aef6..cf4cbb812 100644
--- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
@@ -2,7 +2,6 @@
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
//
-
namespace ImageSharp.Formats
{
using System;
@@ -134,19 +133,19 @@ namespace ImageSharp.Formats
if (this.infoHeader.BitsPerPixel == 32)
{
- this.ReadRgb32(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
+ this.ReadRgb32(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
}
else if (this.infoHeader.BitsPerPixel == 24)
{
- this.ReadRgb24(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
+ this.ReadRgb24(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
}
else if (this.infoHeader.BitsPerPixel == 16)
{
- this.ReadRgb16(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
+ this.ReadRgb16(pixels, this.infoHeader.Width, this.infoHeader.Height, inverted);
}
else if (this.infoHeader.BitsPerPixel <= 8)
{
- this.ReadRgbPalette(pixels, palette, this.infoHeader.Width, this.infoHeader.Height, this.infoHeader.BitsPerPixel, inverted);
+ this.ReadRgbPalette(pixels, palette, this.infoHeader.Width, this.infoHeader.Height, this.infoHeader.BitsPerPixel, inverted);
}
break;
@@ -184,7 +183,15 @@ namespace ImageSharp.Formats
return row;
}
- private static int CalculatPadding(int width, int componentCount)
+ ///
+ /// Calculates the amount of bytes to pad a row.
+ ///
+ /// The image width.
+ /// The pixel component count.
+ ///
+ /// The .
+ ///
+ private static int CalculatePadding(int width, int componentCount)
{
int padding = (width * componentCount) % 4;
@@ -312,7 +319,7 @@ namespace ImageSharp.Formats
where TColor : struct, IPackedPixel
where TPacked : struct
{
- int padding = CalculatPadding(width, 3);
+ int padding = CalculatePadding(width, 3);
using (PixelRow row = new PixelRow(width, ComponentOrder.BGR, padding))
{
for (int y = 0; y < height; y++)
@@ -338,7 +345,7 @@ namespace ImageSharp.Formats
where TColor : struct, IPackedPixel
where TPacked : struct
{
- int padding = CalculatPadding(width, 4);
+ int padding = CalculatePadding(width, 4);
using (PixelRow row = new PixelRow(width, ComponentOrder.BGRA, padding))
{
for (int y = 0; y < height; y++)
diff --git a/src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs b/src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs
index 227a22d3b..977a4a167 100644
--- a/src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs
+++ b/src/ImageSharp/Formats/Png/Zlib/ZlibInflateStream.cs
@@ -14,6 +14,11 @@ namespace ImageSharp.Formats
///
internal sealed class ZlibInflateStream : Stream
{
+ ///
+ /// The raw stream containing the uncompressed image data.
+ ///
+ private readonly Stream rawStream;
+
///
/// A value indicating whether this instance of the given entity has been disposed.
///
@@ -27,19 +32,23 @@ namespace ImageSharp.Formats
///
private bool isDisposed;
- ///
- /// The raw stream containing the uncompressed image data.
- ///
- private readonly Stream rawStream;
-
///
/// The read crc data.
///
private byte[] crcread;
- // The stream responsible for decompressing the input stream.
+ ///
+ /// The stream responsible for decompressing the input stream.
+ ///
private DeflateStream deflateStream;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The stream.
+ ///
+ /// Thrown if the compression method is incorrect.
+ ///
public ZlibInflateStream(Stream stream)
{
// The DICT dictionary identifier identifying the used dictionary.
diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs
index 58568db72..dbdb82800 100644
--- a/src/ImageSharp/Image/PixelAccessor.cs
+++ b/src/ImageSharp/Image/PixelAccessor.cs
@@ -101,7 +101,7 @@ namespace ImageSharp
///
/// The x-coordinate of the pixel. Must be greater than zero and smaller than the width of the pixel.
/// The y-coordinate of the pixel. Must be greater than zero and smaller than the width of the pixel.
- /// The at the specified position.
+ /// The at the specified position.
public TColor this[int x, int y]
{
get { return Unsafe.Read(this.pixelsBase + (((y * this.Width) + x) * Unsafe.SizeOf())); }
@@ -136,6 +136,14 @@ namespace ImageSharp
this.CopyBlock(0, 0, target, 0, 0, target.Width * target.Height);
}
+ ///
+ /// Copied a row of pixels from the image.
+ ///
+ /// The row.
+ /// The target row index.
+ ///
+ /// Thrown when an unsupported component order value is passed.
+ ///
public void CopyFrom(PixelRow row, int targetY)
{
switch (row.ComponentOrder)
@@ -153,10 +161,18 @@ namespace ImageSharp
this.CopyFromRGBA(row, targetY, Math.Min(row.Width, this.Width));
break;
default:
- throw new NotSupportedException();
+ throw new NotSupportedException();
}
}
+ ///
+ /// Copied a row of pixels to the image.
+ ///
+ /// The row.
+ /// The source row index.
+ ///
+ /// Thrown when an unsupported component order value is passed.
+ ///
public void CopyTo(PixelRow row, int sourceY)
{
switch (row.ComponentOrder)
@@ -174,7 +190,7 @@ namespace ImageSharp
this.CopyToRGBA(row, sourceY, Math.Min(row.Width, this.Width));
break;
default:
- throw new NotSupportedException();
+ throw new NotSupportedException();
}
}
@@ -207,6 +223,12 @@ namespace ImageSharp
GC.SuppressFinalize(this);
}
+ ///
+ /// Copies from a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyFromBGR(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -225,6 +247,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies from a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyFromBGRA(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -243,6 +271,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies from a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyFromRGB(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -261,6 +295,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies from a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyFromRGBA(PixelRow row, int targetY, int width)
{
byte* source = row.DataPointer;
@@ -279,6 +319,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies to a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyToBGR(PixelRow row, int sourceY, int width)
{
int offset = 0;
@@ -289,6 +335,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies to a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyToBGRA(PixelRow row, int sourceY, int width)
{
int offset = 0;
@@ -299,6 +351,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies to a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyToRGB(PixelRow row, int sourceY, int width)
{
int offset = 0;
@@ -309,6 +367,12 @@ namespace ImageSharp
}
}
+ ///
+ /// Copies to a row in format.
+ ///
+ /// The row.
+ /// The target row index.
+ /// The width.
protected virtual void CopyToRGBA(PixelRow row, int sourceY, int width)
{
int offset = 0;
@@ -319,6 +383,13 @@ namespace ImageSharp
}
}
+ ///
+ /// Gets the pointer at the specified row.
+ ///
+ /// The target row index.
+ ///
+ /// The .
+ ///
protected byte* GetRowPointer(int targetY)
{
return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf());