Commit f20108c8 authored by tebjan's avatar tebjan
Browse files

svg transforms can now be compared and return correct results

parent 38015799
......@@ -12,5 +12,37 @@ namespace Svg.Transforms
public abstract string WriteToString();
public abstract object Clone();
#region Equals implementation
public override bool Equals(object obj)
{
SvgTransform other = obj as SvgTransform;
if (other == null)
return false;
return this.Matrix == other.Matrix;
}
public override int GetHashCode()
{
int hashCode = this.Matrix.GetHashCode();
return hashCode;
}
public static bool operator ==(SvgTransform lhs, SvgTransform rhs)
{
if (ReferenceEquals(lhs, rhs))
return true;
if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null))
return false;
return lhs.Equals(rhs);
}
public static bool operator !=(SvgTransform lhs, SvgTransform rhs)
{
return !(lhs == rhs);
}
#endregion
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.Text;
namespace Svg.Transforms
{
......@@ -26,7 +27,7 @@ namespace Svg.Transforms
{
get
{
System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
Matrix matrix = new Matrix();
matrix.Translate(this.X, this.Y);
return matrix;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment