SvgTransformCollection.cs 1.07 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
using System;
using System.Collections.Generic;
3
4
using System.ComponentModel;
using System.Drawing.Drawing2D;
davescriven's avatar
davescriven committed
5
6
7
8
9
10
11
12
using System.Linq;
using System.Text;

namespace Svg.Transforms
{
    [TypeConverter(typeof(SvgTransformConverter))]
    public class SvgTransformCollection : List<SvgTransform>
    {
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    	/// <summary>
    	/// Multiplies all matrices
    	/// </summary>
    	/// <returns>The result of all transforms</returns>
    	public Matrix GetMatrix()
    	{
    		var transformMatrix =  new Matrix();
    		
    		// Return if there are no transforms
            if (this.Count == 0)
            {
            	return transformMatrix;
            }

            foreach (SvgTransform transformation in this)
            {
                transformMatrix.Multiply(transformation.Matrix);
            }

            return transformMatrix;
    	}
34
35
36
37
38
39
40
41


		public override bool Equals(object obj)
		{
			if (this.Count == 0 && this.Count == this.Count) //default will be an empty list 
				return true;
			return base.Equals(obj);
		}
42
    		
davescriven's avatar
davescriven committed
43
44
    }
}