Browse Source

Stylecop fixes

Former-commit-id: 4ce25cbac837525bb98af107d3126f4cad6ed5e7
Former-commit-id: 5f18082024474a701dc45c921aae1878dab85a37
Former-commit-id: 1bd9cb859cc44a2bdc09a0ed66c1e389ed93ac80
pull/17/head
James Jackson-South 10 years ago
parent
commit
8a8214173e
  1. 4
      ImageProcessor.sln.DotSettings
  2. 2
      src/ImageProcessor/Common/Extensions/ByteExtensions.cs
  3. 4
      src/ImageProcessor/Common/Extensions/ComparableExtensions.cs
  4. 16
      src/ImageProcessor/Formats/Bmp/BmpCompression.cs
  5. 2
      src/ImageProcessor/Formats/Bmp/BmpDecoder.cs
  6. 6
      src/ImageProcessor/Formats/Bmp/BmpFileHeader.cs
  7. 18
      src/ImageProcessor/Formats/Bmp/BmpInfoHeader.cs
  8. 32
      src/ImageProcessor/Formats/Gif/BitEncoder.cs
  9. 12
      src/ImageProcessor/Formats/Gif/DisposalMethod.cs
  10. 2
      src/ImageProcessor/Formats/Gif/GifEncoder.cs
  11. 2
      src/ImageProcessor/Formats/Gif/LzwDecoder.cs
  12. 18
      src/ImageProcessor/Formats/Gif/Sections/GifGraphicsControlExtension.cs
  13. 27
      src/ImageProcessor/Formats/Gif/Sections/GifImageDescriptor.cs
  14. 29
      src/ImageProcessor/Formats/Png/Zlib/ZipConstants.cs
  15. 8
      src/ImageProcessor/IImage.cs
  16. 36
      src/ImageProcessor/ImageProperty.cs
  17. 2
      src/ImageProcessor/Numerics/Rectangle.cs
  18. 2
      src/ImageProcessor/Samplers/Resamplers/Lanczos8Resampler.cs
  19. 2
      src/ImageProcessor/Samplers/Resamplers/MitchellNetravaliResampler.cs

4
ImageProcessor.sln.DotSettings

@ -1,2 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JPEG/@EntryIndexedValue">JPEG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PNG/@EntryIndexedValue">PNG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RGB/@EntryIndexedValue">RGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RLE/@EntryIndexedValue">RLE</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XY/@EntryIndexedValue">XY</s:String></wpf:ResourceDictionary>

2
src/ImageProcessor/Common/Extensions/ByteExtensions.cs

@ -18,7 +18,7 @@ namespace ImageProcessor
internal static class ByteExtensions
{
/// <summary>
/// Converts a byte array to a new array where each value in the original array is represented
/// Converts a byte array to a new array where each value in the original array is represented
/// by a the specified number of bits.
/// </summary>
/// <param name="bytes">The bytes to convert from. Cannot be null.</param>

4
src/ImageProcessor/Common/Extensions/ComparableExtensions.cs

@ -127,7 +127,7 @@ namespace ImageProcessor
/// <returns>The <see cref="byte"/></returns>
public static byte ToByte(this float value)
{
return (byte)(value.Clamp(0, 255));
return (byte)value.Clamp(0, 255);
}
/// <summary>
@ -138,7 +138,7 @@ namespace ImageProcessor
/// <returns>The <see cref="byte"/></returns>
public static byte ToByte(this double value)
{
return (byte)(value.Clamp(0, 255));
return (byte)value.Clamp(0, 255);
}
}
}

16
src/ImageProcessor/Formats/Bmp/BmpCompression.cs

@ -18,17 +18,17 @@ namespace ImageProcessor.Formats
internal enum BmpCompression
{
/// <summary>
/// Each image row has a multiple of four elements. If the
/// Each image row has a multiple of four elements. If the
/// row has less elements, zeros will be added at the right side.
/// The format depends on the number of bits, stored in the info header.
/// If the number of bits are one, four or eight each pixel data is
/// a index to the palette. If the number of bits are sixteen,
/// If the number of bits are one, four or eight each pixel data is
/// a index to the palette. If the number of bits are sixteen,
/// twenty-four or thirty-two each pixel contains a color.
/// </summary>
RGB = 0,
/// <summary>
/// Two bytes are one data record. If the first byte is not zero, the
/// Two bytes are one data record. If the first byte is not zero, the
/// next two half bytes will be repeated as much as the value of the first byte.
/// If the first byte is zero, the record has different meanings, depending
/// on the second byte. If the second byte is zero, it is the end of the row,
@ -38,7 +38,7 @@ namespace ImageProcessor.Formats
RLE8 = 1,
/// <summary>
/// Two bytes are one data record. If the first byte is not zero, the
/// Two bytes are one data record. If the first byte is not zero, the
/// next byte will be repeated as much as the value of the first byte.
/// If the first byte is zero, the record has different meanings, depending
/// on the second byte. If the second byte is zero, it is the end of the row,
@ -48,20 +48,20 @@ namespace ImageProcessor.Formats
RLE4 = 2,
/// <summary>
/// Each image row has a multiple of four elements. If the
/// Each image row has a multiple of four elements. If the
/// row has less elements, zeros will be added at the right side.
/// Not supported at the moment.
/// </summary>
BitFields = 3,
/// <summary>
/// The bitmap contains a JPG image.
/// The bitmap contains a JPG image.
/// Not supported at the moment.
/// </summary>
JPEG = 4,
/// <summary>
/// The bitmap contains a PNG image.
/// The bitmap contains a PNG image.
/// Not supported at the moment.
/// </summary>
PNG = 5

2
src/ImageProcessor/Formats/Bmp/BmpDecoder.cs

@ -25,7 +25,7 @@ namespace ImageProcessor.Formats
/// <item>RLE8</item>
/// <item>BitFields</item>
/// </list>
/// Formats will be supported in a later releases. We advise always
/// Formats will be supported in a later releases. We advise always
/// to use only 24 Bit Windows bitmaps.
/// </remarks>
public class BmpDecoder : IImageDecoder

6
src/ImageProcessor/Formats/Bmp/BmpFileHeader.cs

@ -30,7 +30,7 @@ namespace ImageProcessor.Formats
/// <summary>
/// Gets or sets the Bitmap identifier.
/// The field used to identify the bitmap file: 0x42 0x4D
/// The field used to identify the bitmap file: 0x42 0x4D
/// (Hex code points for B and M)
/// </summary>
public short Type { get; set; }
@ -41,13 +41,13 @@ namespace ImageProcessor.Formats
public int FileSize { get; set; }
/// <summary>
/// Gets or sets any reserved data; actual value depends on the application
/// Gets or sets any reserved data; actual value depends on the application
/// that creates the image.
/// </summary>
public int Reserved { get; set; }
/// <summary>
/// Gets or sets the offset, i.e. starting address, of the byte where
/// Gets or sets the offset, i.e. starting address, of the byte where
/// the bitmap data can be found.
/// </summary>
public int Offset { get; set; }

18
src/ImageProcessor/Formats/Bmp/BmpInfoHeader.cs

@ -14,8 +14,8 @@
namespace ImageProcessor.Formats
{
/// <summary>
/// This block of bytes tells the application detailed information
/// about the image, which will be used to display the image on
/// This block of bytes tells the application detailed information
/// about the image, which will be used to display the image on
/// the screen.
/// <see href="https://en.wikipedia.org/wiki/BMP_file_format"/>
/// </summary>
@ -47,43 +47,43 @@ namespace ImageProcessor.Formats
public short Planes { get; set; }
/// <summary>
/// Gets or sets the number of bits per pixel, which is the color depth of the image.
/// Gets or sets the number of bits per pixel, which is the color depth of the image.
/// Typical values are 1, 4, 8, 16, 24 and 32.
/// </summary>
public short BitsPerPixel { get; set; }
/// <summary>
/// Gets or sets the compression method being used.
/// Gets or sets the compression method being used.
/// See the next table for a list of possible values.
/// </summary>
public BmpCompression Compression { get; set; }
/// <summary>
/// Gets or sets the image size. This is the size of the raw bitmap data (see below),
/// Gets or sets the image size. This is the size of the raw bitmap data (see below),
/// and should not be confused with the file size.
/// </summary>
public int ImageSize { get; set; }
/// <summary>
/// Gets or sets the horizontal resolution of the image.
/// Gets or sets the horizontal resolution of the image.
/// (pixel per meter, signed integer)
/// </summary>
public int XPelsPerMeter { get; set; }
/// <summary>
/// Gets or sets the vertical resolution of the image.
/// Gets or sets the vertical resolution of the image.
/// (pixel per meter, signed integer)
/// </summary>
public int YPelsPerMeter { get; set; }
/// <summary>
/// Gets or sets the number of colors in the color palette,
/// Gets or sets the number of colors in the color palette,
/// or 0 to default to 2^n.
/// </summary>
public int ClrUsed { get; set; }
/// <summary>
/// Gets or sets the number of important colors used,
/// Gets or sets the number of important colors used,
/// or 0 when every color is important{ get; set; } generally ignored.
/// </summary>
public int ClrImportant { get; set; }

32
src/ImageProcessor/Formats/Gif/BitEncoder.cs

@ -81,28 +81,14 @@ namespace ImageProcessor.Formats
}
/// <summary>
/// The end.
/// </summary>
internal void End()
{
while (this.currentBit > 0)
{
byte value = (byte)(this.currentValue & 0XFF);
this.currentValue = this.currentValue >> 8;
this.currentBit -= 8;
this.list.Add(value);
}
}
/// <summary>
/// Copies a range of elements from the encoder to a compatible one-dimensional array,
/// Copies a range of elements from the encoder to a compatible one-dimensional array,
/// starting at the specified index of the target array.
/// </summary>
/// <param name="index">
/// The zero-based index in the source <see cref="BitEncoder"/> at which copying begins.
/// </param>
/// <param name="array">
/// The one-dimensional Array that is the destination of the elements copied
/// The one-dimensional Array that is the destination of the elements copied
/// from <see cref="BitEncoder"/>. The Array must have zero-based indexing
/// </param>
/// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
@ -128,5 +114,19 @@ namespace ImageProcessor.Formats
{
return this.list.ToArray();
}
/// <summary>
/// The end.
/// </summary>
internal void End()
{
while (this.currentBit > 0)
{
byte value = (byte)(this.currentValue & 0XFF);
this.currentValue = this.currentValue >> 8;
this.currentBit -= 8;
this.list.Add(value);
}
}
}
}

12
src/ImageProcessor/Formats/Gif/DisposalMethod.cs

@ -6,30 +6,30 @@
namespace ImageProcessor.Formats
{
/// <summary>
/// Provides enumeration for instructing the decoder what to do with the last image
/// Provides enumeration for instructing the decoder what to do with the last image
/// in an animation sequence.
/// </summary>
public enum DisposalMethod
{
/// <summary>
/// No disposal specified. The decoder is not required to take any action.
/// No disposal specified. The decoder is not required to take any action.
/// </summary>
Unspecified = 0,
/// <summary>
/// Do not dispose. The graphic is to be left in place.
/// Do not dispose. The graphic is to be left in place.
/// </summary>
NotDispose = 1,
/// <summary>
/// Restore to background color. The area used by the graphic must be restored to
/// the background color.
/// the background color.
/// </summary>
RestoreToBackground = 2,
/// <summary>
/// Restore to previous. The decoder is required to restore the area overwritten by the
/// graphic with what was there prior to rendering the graphic.
/// Restore to previous. The decoder is required to restore the area overwritten by the
/// graphic with what was there prior to rendering the graphic.
/// </summary>
RestoreToPrevious = 3
}

2
src/ImageProcessor/Formats/Gif/GifEncoder.cs

@ -328,7 +328,7 @@ namespace ImageProcessor.Formats
/// Returns how many bits are required to store the specified number of colors.
/// Performs a Log2() on the value.
/// </summary>
/// <para>The number of colors.</para>
/// <param name="colors">The number of colors.</param>
/// <returns>
/// The <see cref="int"/>
/// </returns>

2
src/ImageProcessor/Formats/Gif/LzwDecoder.cs

@ -199,7 +199,7 @@ namespace ImageProcessor.Formats
// »ñÈ¡ÏÂÒ»¸öÊý¾Ý
pixelStatck[top++] = suffix[code];
// Fix for Gifs that have "deferred clear code" as per here :
// Fix for Gifs that have "deferred clear code" as per here :
// https://bugzilla.mozilla.org/show_bug.cgi?id=55918
if (availableCode < MaxStackSize)
{

18
src/ImageProcessor/Formats/Gif/Sections/GifGraphicsControlExtension.cs

@ -6,36 +6,36 @@
namespace ImageProcessor.Formats
{
/// <summary>
/// The Graphic Control Extension contains parameters used when
/// The Graphic Control Extension contains parameters used when
/// processing a graphic rendering block.
/// </summary>
internal sealed class GifGraphicsControlExtension
{
/// <summary>
/// Gets or sets the disposal method which indicates the way in which the
/// graphic is to be treated after being displayed.
/// Gets or sets the disposal method which indicates the way in which the
/// graphic is to be treated after being displayed.
/// </summary>
public DisposalMethod DisposalMethod { get; set; }
/// <summary>
/// Gets or sets a value indicating whether transparency flag is to be set.
/// This indicates whether a transparency index is given in the Transparent Index field.
/// (This field is the least significant bit of the byte.)
/// This indicates whether a transparency index is given in the Transparent Index field.
/// (This field is the least significant bit of the byte.)
/// </summary>
public bool TransparencyFlag { get; set; }
/// <summary>
/// Gets or sets the transparency index.
/// The Transparency Index is such that when encountered, the corresponding pixel
/// The Transparency Index is such that when encountered, the corresponding pixel
/// of the display device is not modified and processing goes on to the next pixel.
/// </summary>
public int TransparencyIndex { get; set; }
/// <summary>
/// Gets or sets the delay time.
/// If not 0, this field specifies the number of hundredths (1/100) of a second to
/// wait before continuing with the processing of the Data Stream.
/// The clock starts ticking immediately after the graphic is rendered.
/// If not 0, this field specifies the number of hundredths (1/100) of a second to
/// wait before continuing with the processing of the Data Stream.
/// The clock starts ticking immediately after the graphic is rendered.
/// </summary>
public int DelayTime { get; set; }
}

27
src/ImageProcessor/Formats/Gif/Sections/GifImageDescriptor.cs

@ -6,57 +6,52 @@
namespace ImageProcessor.Formats
{
/// <summary>
/// Each image in the Data Stream is composed of an Image Descriptor,
/// an optional Local Color Table, and the image data.
/// Each image must fit within the boundaries of the
/// Logical Screen, as defined in the Logical Screen Descriptor.
/// Each image in the Data Stream is composed of an Image Descriptor,
/// an optional Local Color Table, and the image data.
/// Each image must fit within the boundaries of the
/// Logical Screen, as defined in the Logical Screen Descriptor.
/// </summary>
internal sealed class GifImageDescriptor
{
/// <summary>
/// Gets or sets the column number, in pixels, of the left edge of the image,
/// with respect to the left edge of the Logical Screen.
/// Gets or sets the column number, in pixels, of the left edge of the image,
/// with respect to the left edge of the Logical Screen.
/// Leftmost column of the Logical Screen is 0.
/// </summary>
public short Left { get; set; }
/// <summary>
/// Gets or sets the row number, in pixels, of the top edge of the image with
/// respect to the top edge of the Logical Screen.
/// Gets or sets the row number, in pixels, of the top edge of the image with
/// respect to the top edge of the Logical Screen.
/// Top row of the Logical Screen is 0.
/// </summary>
public short Top { get; set; }
/// <summary>
/// Gets or sets the width of the image in pixels.
/// </summary>
public short Width { get; set; }
/// <summary>
/// Gets or sets the height of the image in pixels.
/// </summary>
public short Height { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the presence of a Local Color Table immediately
/// Gets or sets a value indicating whether the presence of a Local Color Table immediately
/// follows this Image Descriptor.
/// </summary>
public bool LocalColorTableFlag { get; set; }
/// <summary>
/// Gets or sets the local color table size.
/// If the Local Color Table Flag is set to 1, the value in this field
/// If the Local Color Table Flag is set to 1, the value in this field
/// is used to calculate the number of bytes contained in the Local Color Table.
/// </summary>
public int LocalColorTableSize { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the image is to be interlaced.
/// Gets or sets a value indicating whether the image is to be interlaced.
/// An image is interlaced in a four-pass interlace pattern.
/// </summary>
public bool InterlaceFlag { get; set; }

29
src/ImageProcessor/Formats/Png/Zlib/ZipConstants.cs

@ -1,4 +1,9 @@
namespace ImageProcessor.Formats
// <copyright file="ZipConstants.cs" company="James South">
// Copyright (c) James South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageProcessor.Formats
{
using System.Text;
@ -60,7 +65,6 @@
/// </summary>
public const int CryptoHeaderSize = 12;
/// <summary>
/// Signature for local entry header
/// </summary>
@ -116,27 +120,15 @@
/// End of central directory record signature
/// </summary>
public const int EndOfCentralDirectorySignature = 'P' | ('K' << 8) | (5 << 16) | (6 << 24);
static Encoding defaultEncoding = Encoding.UTF8;
/// <summary>
/// PCL don't support CodePage so we used Encoding instead of
/// </summary>
public static Encoding DefaultEncoding
{
get
{
return defaultEncoding;
}
set
{
defaultEncoding = value;
}
}
public static Encoding DefaultEncoding { get; set; } = Encoding.UTF8;
/// <summary>
/// Convert a portion of a byte array to a string.
/// </summary>
/// </summary>
/// <param name="data">
/// Data to convert to string
/// </param>
@ -171,6 +163,7 @@
{
return string.Empty;
}
return ConvertToString(data, data.Length);
}
@ -205,10 +198,8 @@
/// <summary>
/// Convert a byte array to string
/// </summary>
/// <param name="data">
/// Byte array to convert
/// </param>
/// <param name="flags">The applicable general purpose bits flags</param>
/// <param name="data">Byte array to convert</param>
/// <returns>
/// <paramref name="data">data</paramref>converted to a string
/// </returns>

8
src/ImageProcessor/IImage.cs

@ -31,16 +31,16 @@ namespace ImageProcessor
double VerticalResolution { get; set; }
/// <summary>
/// Gets the width of the image in inches. It is calculated as the width of the image
/// in pixels multiplied with the density. When the density is equals or less than zero
/// Gets the width of the image in inches. It is calculated as the width of the image
/// in pixels multiplied with the density. When the density is equals or less than zero
/// the default value is used.
/// </summary>
/// <value>The width of the image in inches.</value>
double InchWidth { get; }
/// <summary>
/// Gets the height of the image in inches. It is calculated as the height of the image
/// in pixels multiplied with the density. When the density is equals or less than zero
/// Gets the height of the image in inches. It is calculated as the height of the image
/// in pixels multiplied with the density. When the density is equals or less than zero
/// the default value is used.
/// </summary>
/// <value>The height of the image in inches.</value>

36
src/ImageProcessor/ImageProperty.cs

@ -21,21 +21,6 @@ namespace ImageProcessor
/// </summary>
public struct ImageProperty : IEquatable<ImageProperty>
{
/// <summary>
/// Gets the name of this <see cref="ImageProperty"/> indicating which kind of
/// information this property stores.
/// </summary>
/// <example>
/// Typical properties are the author, copyright
/// information or other meta information.
/// </example>
public string Name { get; }
/// <summary>
/// The value of this <see cref="ImageProperty"/>.
/// </summary>
public string Value { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ImageProperty"/> struct.
/// </summary>
@ -51,6 +36,21 @@ namespace ImageProcessor
this.Value = value;
}
/// <summary>
/// Gets the name of this <see cref="ImageProperty"/> indicating which kind of
/// information this property stores.
/// </summary>
/// <example>
/// Typical properties are the author, copyright
/// information or other meta information.
/// </example>
public string Name { get; }
/// <summary>
/// The value of this <see cref="ImageProperty"/>.
/// </summary>
public string Value { get; }
/// <summary>
/// Compares two <see cref="ImageProperty"/> objects. The result specifies whether the values
/// of the <see cref="ImageProperty.Name"/> or <see cref="ImageProperty.Value"/> properties of the two
@ -93,11 +93,11 @@ namespace ImageProcessor
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <param name="obj">
/// The object to compare with the current instance.
/// The object to compare with the current instance.
/// </param>
/// <returns>
/// true if <paramref name="obj"/> and this instance are the same type and represent the
/// same value; otherwise, false.
/// true if <paramref name="obj"/> and this instance are the same type and represent the
/// same value; otherwise, false.
/// </returns>
public override bool Equals(object obj)
{

2
src/ImageProcessor/Numerics/Rectangle.cs

@ -141,7 +141,7 @@ namespace ImageProcessor
}
/// <summary>
/// Determines if the specfied point is contained within the rectangular region defined by
/// Determines if the specfied point is contained within the rectangular region defined by
/// this <see cref="Rectangle"/>.
/// </summary>
/// <param name="x">The x-coordinate of the given point.</param>

2
src/ImageProcessor/Samplers/Resamplers/Lanczos8Resampler.cs

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

2
src/ImageProcessor/Samplers/Resamplers/MitchellNetravaliResampler.cs

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

Loading…
Cancel
Save