Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ImageSharp/Common/Helpers/ImageMaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ public static Rectangle GetFilteredBoundingRectangle<TColor, TPacked>(ImageBase<
const float Epsilon = .00001f;
int width = bitmap.Width;
int height = bitmap.Height;
Point topLeft = new Point();
Point bottomRight = new Point();
Point topLeft = default(Point);
Point bottomRight = default(Point);

Func<PixelAccessor<TColor, TPacked>, int, int, float, bool> delegateFunc;

Expand Down
7 changes: 6 additions & 1 deletion src/ImageSharp/Filters/Processors/IImageFilter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace ImageSharp.Processors
// <copyright file="IImageFilter.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

namespace ImageSharp.Processors
{
/// <summary>
/// Encapsulates methods to alter the pixels of an image. The processor operates on the original source pixels.
Expand Down
6 changes: 3 additions & 3 deletions src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private void ReadRgb16<TColor, TPacked>(TColor[] imageData, int width, int heigh
byte g = (byte)(((temp & Rgb16GMask) >> 5) * ScaleG);
byte b = (byte)((temp & Rgb16BMask) * ScaleR);

int arrayOffset = ((row * width) + x);
int arrayOffset = (row * width) + x;

// Stored in b-> g-> r order.
TColor packed = default(TColor);
Expand Down Expand Up @@ -330,7 +330,7 @@ private void ReadRgb24<TColor, TPacked>(TColor[] imageData, int width, int heigh
for (int x = 0; x < width; x++)
{
int offset = rowOffset + (x * 3);
int arrayOffset = ((row * width) + x);
int arrayOffset = (row * width) + x;

// Stored in b-> g-> r-> a order.
TColor packed = default(TColor);
Expand Down Expand Up @@ -370,7 +370,7 @@ private void ReadRgb32<TColor, TPacked>(TColor[] imageData, int width, int heigh
for (int x = 0; x < width; x++)
{
int offset = rowOffset + (x * 4);
int arrayOffset = ((row * width) + x);
int arrayOffset = (row * width) + x;

// Stored in b-> g-> r-> a order.
TColor packed = default(TColor);
Expand Down
6 changes: 3 additions & 3 deletions src/ImageSharp/Formats/Gif/GifEncoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void WriteLogicalScreenDescriptor<TColor, TPacked>(Image<TColor, TPacked
writer.Write((ushort)descriptor.Width);
writer.Write((ushort)descriptor.Height);

PackedField field = new PackedField();
PackedField field = default(PackedField);
field.SetBit(0, descriptor.GlobalColorTableFlag); // 1 : Global color table flag = 1 || 0 (GCT used/ not used)
field.SetBits(1, 3, descriptor.GlobalColorTableSize); // 2-4 : color resolution
field.SetBit(4, false); // 5 : GCT sort flag = 0
Expand Down Expand Up @@ -254,7 +254,7 @@ private void WriteGraphicalControlExtension<TColor, TPacked>(ImageBase<TColor, T

writer.Write(intro);

PackedField field = new PackedField();
PackedField field = default(PackedField);
field.SetBits(3, 3, (int)extension.DisposalMethod); // 1-3 : Reserved, 4-6 : Disposal

// TODO: Allow this as an option.
Expand Down Expand Up @@ -285,7 +285,7 @@ private void WriteImageDescriptor<TColor, TPacked>(ImageBase<TColor, TPacked> im
writer.Write((ushort)image.Width);
writer.Write((ushort)image.Height);

PackedField field = new PackedField();
PackedField field = default(PackedField);
field.SetBit(0, true); // 1: Local color table flag = 1 (LCT used)
field.SetBit(1, false); // 2: Interlace flag 0
field.SetBit(2, false); // 3: Sort flag 0
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Formats/Gif/PackedField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public byte Byte
/// <returns>The <see cref="PackedField"/></returns>
public static PackedField FromInt(byte value)
{
PackedField packed = new PackedField();
PackedField packed = default(PackedField);
packed.SetBits(0, 8, value);
return packed;
}
Expand Down
14 changes: 7 additions & 7 deletions src/ImageSharp/Formats/Jpg/JpegEncoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Licensed under the Apache License, Version 2.0.
// </copyright>

using System.Numerics;

namespace ImageSharp.Formats
{
using System;
Expand Down Expand Up @@ -51,7 +49,8 @@ internal class JpegEncoderCore
/// The values are derived from section K.1 after converting from natural to
/// zig-zag order.
/// </summary>
private readonly byte[,] unscaledQuant = {
private readonly byte[,] unscaledQuant =
{
{
// Luminance.
16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40,
Expand All @@ -73,7 +72,8 @@ internal class JpegEncoderCore
/// The Huffman encoding specifications.
/// This encoder uses the same Huffman encoding for all images.
/// </summary>
private readonly HuffmanSpec[] theHuffmanSpec = {
private readonly HuffmanSpec[] theHuffmanSpec =
{
// Luminance DC.
new HuffmanSpec(
new byte[]
Expand Down Expand Up @@ -488,9 +488,9 @@ public void Encode<TColor, TPacked>(Image<TColor, TPacked> image, Stream stream,
int componentCount = 3;

// Write the Start Of Image marker.
WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution);
this.WriteApplicationHeader((short)image.HorizontalResolution, (short)image.VerticalResolution);

WriteProfiles(image);
this.WriteProfiles(image);

// Write the quantization tables.
this.WriteDQT();
Expand Down Expand Up @@ -574,7 +574,7 @@ private void WriteProfiles<TColor, TPacked>(Image<TColor, TPacked> image)
where TColor : struct, IPackedPixel<TPacked>
where TPacked : struct
{
WriteProfile(image.ExifProfile);
this.WriteProfile(image.ExifProfile);
}

private void WriteProfile(ExifProfile exifProfile)
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Formats/Png/PngEncoderCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ private void WriteGammaChunk(Stream stream)
/// <param name="stream">The stream.</param>
private void WriteDataChunks(Stream stream)
{
byte[] data = this.EncodePixelData();
byte[] data = this.EncodePixelData();

byte[] buffer;
int bufferLength;
Expand Down
6 changes: 3 additions & 3 deletions src/ImageSharp/Formats/Png/Zlib/ZlibDeflateStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ protected override void Dispose(bool disposing)
this.deflateStream.Dispose();
this.deflateStream = null;
}
else {

else
{
// Hack: empty input?
this.rawStream.WriteByte(3);
this.rawStream.WriteByte(0);
Expand All @@ -196,7 +196,7 @@ protected override void Dispose(bool disposing)
this.rawStream.WriteByte((byte)((crc >> 24) & 0xFF));
this.rawStream.WriteByte((byte)((crc >> 16) & 0xFF));
this.rawStream.WriteByte((byte)((crc >> 8) & 0xFF));
this.rawStream.WriteByte((byte)((crc) & 0xFF));
this.rawStream.WriteByte((byte)(crc & 0xFF));
}

base.Dispose(disposing);
Expand Down
3 changes: 1 addition & 2 deletions src/ImageSharp/IO/EndianBinaryReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,7 @@ private void ReadInternal(byte[] data, int size)
int read = this.BaseStream.Read(data, index, size - index);
if (read == 0)
{
throw new EndOfStreamException
(
throw new EndOfStreamException(
string.Format(
"End of stream reached with {0} byte{1} left to read.",
size - index,
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/IO/EndianBitConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public static string ToString(byte[] value, int startIndex, int length)
}
#endregion

#region Decimal conversions
#region Decimal conversions
/// <summary>
/// Returns a decimal value converted from sixteen bytes
/// at a specified position in a byte array.
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Image/ImageIOExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="ImageExtensions.cs" company="James Jackson-South">
// <copyright file="ImageIOExtensions.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Image/ImageProcessingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="ImageExtensions.cs" company="James Jackson-South">
// <copyright file="ImageProcessingExtensions.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Image/ImageProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public override bool Equals(object obj)
{
ImageProperty other = obj as ImageProperty;

return Equals(other);
return this.Equals(other);
}

/// <summary>
Expand Down
7 changes: 3 additions & 4 deletions src/ImageSharp/Profiles/Exif/ExifReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,7 @@ private void GetThumbnail(uint offset)
}
}

private static TDataType[] ToArray<TDataType>(ExifDataType dataType, byte[] data,
ConverterMethod<TDataType> converter)
private static TDataType[] ToArray<TDataType>(ExifDataType dataType, byte[] data, ConverterMethod<TDataType> converter)
{
int dataTypeSize = (int)ExifValue.GetSize(dataType);
int length = data.Length / dataTypeSize;
Expand Down Expand Up @@ -442,7 +441,7 @@ private Rational ToRational(byte[] data)
{
if (!this.ValidateArray(data, 8, 4))
{
return new Rational();
return default(Rational);
}

uint numerator = BitConverter.ToUInt32(data, 0);
Expand Down Expand Up @@ -470,7 +469,7 @@ private SignedRational ToSignedRational(byte[] data)
{
if (!this.ValidateArray(data, 8, 4))
{
return new SignedRational();
return default(SignedRational);
}

int numerator = BitConverter.ToInt32(data, 0);
Expand Down
7 changes: 3 additions & 4 deletions src/ImageSharp/Profiles/Exif/ExifTagDescriptionAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// <copyright file="ExifTag.cs" company="James Jackson-South">
// <copyright file="ExifTagDescriptionAttribute.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

namespace ImageSharp
{
using System;
using System.Linq;
using System.Reflection;

/// <summary>
Expand All @@ -18,9 +17,9 @@ internal sealed class ExifTagDescriptionAttribute : Attribute
private object value;
private string description;

///<summary>
/// <summary>
/// Initializes a new instance of the ExifTagDescriptionAttribute class.
///</summary>
/// </summary>
/// <param name="value">The value of the exif tag.</param>
/// <param name="description">The description for the value of the exif tag.</param>
public ExifTagDescriptionAttribute(object value, string description)
Expand Down
12 changes: 6 additions & 6 deletions src/ImageSharp/Profiles/Exif/ExifValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public object Value
return !Equals(left, right);
}

///<summary>
/// <summary>
/// Determines whether the specified object is equal to the current exif value.
///</summary>
///<param name="obj">The object to compare this exif value with.</param>
/// </summary>
/// <param name="obj">The object to compare this exif value with.</param>
public override bool Equals(object obj)
{
if (ReferenceEquals(this, obj))
Expand All @@ -117,10 +117,10 @@ public override bool Equals(object obj)
return this.Equals(obj as ExifValue);
}

///<summary>
/// <summary>
/// Determines whether the specified exif value is equal to the current exif value.
///</summary>
///<param name="other">The exif value to compare this exif value with.</param>
/// </summary>
/// <param name="other">The exif value to compare this exif value with.</param>
public bool Equals(ExifValue other)
{
if (ReferenceEquals(other, null))
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Profiles/Exif/ExifWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal sealed class ExifWriter
{
ExifTag.ImageWidth, ExifTag.ImageLength, ExifTag.BitsPerSample, ExifTag.Compression,
ExifTag.PhotometricInterpretation, ExifTag.Thresholding, ExifTag.CellWidth,
ExifTag.CellLength, ExifTag.FillOrder,ExifTag.ImageDescription, ExifTag.Make,
ExifTag.CellLength, ExifTag.FillOrder, ExifTag.ImageDescription, ExifTag.Make,
ExifTag.Model, ExifTag.StripOffsets, ExifTag.Orientation, ExifTag.SamplesPerPixel,
ExifTag.RowsPerStrip, ExifTag.StripByteCounts, ExifTag.MinSampleValue,
ExifTag.MaxSampleValue, ExifTag.XResolution, ExifTag.YResolution,
Expand Down
9 changes: 7 additions & 2 deletions src/ImageSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
using System.Resources;
// <copyright file="AssemblyInfo.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand All @@ -28,6 +32,7 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

// Ensure the internals can be tested.
[assembly: InternalsVisibleTo("ImageSharp.Benchmarks")]
Expand Down
5 changes: 2 additions & 3 deletions src/ImageSharp/Quantizers/Wu/WuQuantizer.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// <copyright file="WuQuantizer.cs" company="James Jackson-South">
// Copyright © James Jackson-South and contributors.
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

using System.Numerics;

namespace ImageSharp.Quantizers
{
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Threading.Tasks;

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Samplers/AutoOrient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="EntropyCrop.cs" company="James Jackson-South">
// <copyright file="AutoOrient.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Samplers/Options/Orientation.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="AnchorPosition.cs" company="James Jackson-South">
// <copyright file="Orientation.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private void ApplyConvolution(ImageBase<TColor, TPacked> target, ImageBase<TColo
{
for (int x = startX; x < endX; x++)
{
Vector4 destination = new Vector4();
Vector4 destination = default(Vector4);

// Apply each matrix multiplier to the color components for each pixel.
for (int fy = 0; fy < kernelHeight; fy++)
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Samplers/Processors/OilPaintingProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public override void Apply(ImageBase<TColor, TPacked> target, ImageBase<TColor,
float sourceBlue = color.Z;
float sourceGreen = color.Y;

int currentIntensity = (int)Math.Round(((sourceBlue + sourceGreen + sourceRed) / 3.0 * (levels - 1)));
int currentIntensity = (int)Math.Round((sourceBlue + sourceGreen + sourceRed) / 3.0 * (levels - 1));

intensityBin[currentIntensity] += 1;
blueBin[currentIntensity] += sourceBlue;
Expand Down
Loading