SvgGradientStop.cs 1.4 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;

namespace Svg
{
    public class SvgGradientStop : SvgElement
    {
        private SvgUnit _offset;
        private Color _colour;
        private float _opacity;

        [SvgAttribute("offset")]
        public SvgUnit Offset
        {
            get { return this._offset; }
davescriven's avatar
davescriven committed
19
20
21
22
            set
            {
                this._offset = value.ToPercentage();
            }
davescriven's avatar
davescriven committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
        }

        [SvgAttribute("stop-color")]
        [TypeConverter(typeof(SvgColourConverter))]
        public Color Colour
        {
            get { return this._colour; }
            set { this._colour = value; }
        }

        [SvgAttribute("stop-opacity")]
        public float Opacity
        {
            get { return this._opacity; }
            set { this._opacity = value; }
        }

        protected override string ElementName
        {
            get { return "stop"; }
        }

        public SvgGradientStop()
        {
            this._offset = new SvgUnit(0.0f);
            this._colour = Color.Transparent;
            this._opacity = 1.0f;
        }

        public SvgGradientStop(SvgUnit offset, Color colour)
        {
            this._offset = offset;
            this._colour = colour;
            this._opacity = 1.0f;
        }
    }
}