SvgScale.cs 1.32 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
3
4
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
5
using System.Globalization;
davescriven's avatar
davescriven committed
6
7
8

namespace Svg.Transforms
{
9
    public sealed class SvgScale : SvgTransform
davescriven's avatar
davescriven committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    {
        private float scaleFactorX;
        private float scaleFactorY;

        public float X
        {
            get { return this.scaleFactorX; }
            set { this.scaleFactorX = value; }
        }

        public float Y
        {
            get { return this.scaleFactorY; }
            set { this.scaleFactorY = value; }
        }

        public override System.Drawing.Drawing2D.Matrix Matrix
        {
            get
            {
                System.Drawing.Drawing2D.Matrix matrix = new System.Drawing.Drawing2D.Matrix();
                matrix.Scale(this.X, this.Y);
                return matrix;
            }
        }

36
37
38
39
40
        public override string WriteToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "scale({0}, {1})", this.X, this.Y);
        }

davescriven's avatar
davescriven committed
41
42
43
44
45
46
47
        public SvgScale(float x) : this(x, x) { }

        public SvgScale(float x, float y)
        {
            this.scaleFactorX = x;
            this.scaleFactorY = y;
        }
48
49
50
51
52
53


		public override object Clone()
		{
			return new SvgScale(this.X, this.Y);
		}
davescriven's avatar
davescriven committed
54
55
    }
}