SvgGroup.cs 1.97 KB
Newer Older
davescriven's avatar
davescriven committed
1
2
3
4
using System;
using System.Collections.Generic;
using System.Xml;
using System.Text;
5
using System.Drawing;
Tebjan Halm's avatar
Tebjan Halm committed
6
using System.Drawing.Drawing2D;
davescriven's avatar
davescriven committed
7
8
9

namespace Svg
{
10
11
12
    /// <summary>
    /// An element used to group SVG shapes.
    /// </summary>
13
    [SvgElement("g")]
14
    public class SvgGroup : SvgVisualElement
davescriven's avatar
davescriven committed
15
16
17
18
19
    {
        public SvgGroup()
        {
        }

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
        /// <summary>
        /// Gets or sets the fill.
        /// </summary>
        /// <value>The fill.</value>
        [SvgAttribute("fill")]
        public override SvgPaintServer Fill
        {
            get { return (this.Attributes["Fill"] == null) ? new SvgColourServer(Color.Transparent) : (SvgPaintServer)this.Attributes["Fill"]; }
            set { this.Attributes["Fill"] = value; }
        }

        /// <summary>
        /// Gets the <see cref="GraphicsPath"/> for this element.
        /// </summary>
        /// <value></value>
davescriven's avatar
davescriven committed
35
36
        public override System.Drawing.Drawing2D.GraphicsPath Path
        {
Tebjan Halm's avatar
Tebjan Halm committed
37
38
39
40
41
42
43
44
            get 
            { 
            	var path = new GraphicsPath();

            	AddPaths(this, path);
  
            	return path; 
            }
davescriven's avatar
davescriven committed
45
46
        }

47
48
49
50
        /// <summary>
        /// Gets the bounds of the element.
        /// </summary>
        /// <value>The bounds.</value>
davescriven's avatar
davescriven committed
51
52
53
54
55
        public override System.Drawing.RectangleF Bounds
        {
            get { return new System.Drawing.RectangleF(); }
        }

56
57
58
59
        /// <summary>
        /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
        /// </summary>
        /// <param name="graphics">The <see cref="Graphics"/> object to render to.</param>
60
        protected override void Render(SvgRenderer renderer)
davescriven's avatar
davescriven committed
61
        {
62
            this.PushTransforms(renderer);
63
            this.SetClip(renderer);
64
            base.RenderChildren(renderer);
65
            this.ResetClip(renderer);
66
            this.PopTransforms(renderer);
davescriven's avatar
davescriven committed
67
68
69
        }
    }
}