Browse Source

Adding example Point class.

Former-commit-id: bef6431b2ad89bc9e7668a84359d0e1aa4cd6662
Former-commit-id: d0d13cb4f20623fcb7681030272271f6157f9445
Former-commit-id: 012b040185e93ec3032cf895e089d0b9ff09295a
af/merge-core
James South 11 years ago
parent
commit
f8a9b439aa
  1. 3
      src/ImageProcessor/ImageProcessor.csproj
  2. 129
      src/ImageProcessor/Point.cs
  3. 2
      src/ImageProcessor/Properties/AssemblyInfo.cs
  4. 11
      src/ImageProcessor/Settings.StyleCop

3
src/ImageProcessor/ImageProcessor.csproj

@ -38,8 +38,11 @@
<Folder Include="Common\Exceptions\" /> <Folder Include="Common\Exceptions\" />
<Folder Include="Common\Extensions\" /> <Folder Include="Common\Extensions\" />
<Folder Include="Common\Helpers\" /> <Folder Include="Common\Helpers\" />
<Folder Include="Encoders\" />
<Folder Include="Filters\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Point.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

129
src/ImageProcessor/Point.cs

@ -0,0 +1,129 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Point.cs" company="James South">
// Copyright © James South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// <summary>
// Represents an ordered pair of integer x- and y-coordinates that defines a point in
// a two-dimensional plane.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor
{
using System;
using System.ComponentModel;
/// <summary>
/// Represents an ordered pair of integer x- and y-coordinates that defines a point in
/// a two-dimensional plane.
/// </summary>
public struct Point : IEquatable<Point>
{
/// <summary>
/// Represents a Point that has X and Y values set to zero.
/// </summary>
public static readonly Point Empty = new Point();
/// <summary>
/// The x-coordinate of this Point.
/// </summary>
public int X;
/// <summary>
/// The y-coordinate of this Point.
/// </summary>
public int Y;
/// <summary>
/// Initializes a new instance of the <see cref="Point"/> struct.
/// </summary>
/// <param name="x">
/// The horizontal position of the point.
/// </param>
/// <param name="y">
/// The vertical position of the point.
/// </param>
public Point(int x, int y)
{
this.X = x;
this.Y = y;
}
/// <summary>
/// Gets a value indicating whether this Point is empty.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public bool IsEmpty
{
get
{
return this.X == 0 && this.Y == 0;
}
}
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <param name="obj">
/// 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.
/// </returns>
public override bool Equals(object obj)
{
if (!(obj is Point))
{
return false;
}
Point other = (Point)obj;
return other.X == this.X && other.Y == this.Y;
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>
/// A 32-bit signed integer that is the hash code for this instance.
/// </returns>
public override int GetHashCode()
{
return this.GetHashCode(this);
}
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <returns>
/// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
/// </returns>
/// <param name="other">An object to compare with this object.</param>
public bool Equals(Point other)
{
return this.X.Equals(other.X) && this.Y.Equals(other.Y);
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <param name="obj">
/// The instance of <see cref="Point"/> to return the hash code for.
/// </param>
/// <returns>
/// A 32-bit signed integer that is the hash code for this instance.
/// </returns>
private int GetHashCode(Point obj)
{
unchecked
{
int hashCode = obj.X.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Y.GetHashCode();
return hashCode;
}
}
}
}

2
src/ImageProcessor/Properties/AssemblyInfo.cs

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ImageProcessor")] [assembly: AssemblyProduct("ImageProcessor")]
[assembly: AssemblyCopyright("Copyright © James South 2012")] [assembly: AssemblyCopyright("Copyright © James South and contributors 2012")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")] [assembly: NeutralResourcesLanguage("en")]

11
src/ImageProcessor/Settings.StyleCop

@ -0,0 +1,11 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<AnalyzerSettings>
<StringProperty Name="CompanyName">James South</StringProperty>
<StringProperty Name="Copyright">Copyright © James South and contributors.
Licensed under the Apache License, Version 2.0.</StringProperty>
</AnalyzerSettings>
</Analyzer>
</Analyzers>
</StyleCopSettings>
Loading…
Cancel
Save