Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/ClippingMaskingCompositing/SvgMaskElement.cs @ 13777

Last change on this file since 13777 was 12762, checked in by aballeit, 9 years ago

#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)

File size: 4.2 KB
Line 
1using System;
2
3namespace SharpVectors.Dom.Svg
4{
5    public sealed class SvgMaskElement : SvgStyleableElement, ISvgMaskElement
6    {
7        #region Private Fields
8
9        private ISvgAnimatedLength x;
10        private ISvgAnimatedLength y;
11        private ISvgAnimatedLength width;
12        private ISvgAnimatedLength height;
13
14        private ISvgAnimatedEnumeration maskUnits;
15        private ISvgAnimatedEnumeration maskContentUnits;
16
17        private SvgTests svgTests;
18        private SvgExternalResourcesRequired svgExternalResourcesRequired;
19
20        #endregion
21
22        #region Constructors and Destructor
23
24        public SvgMaskElement(string prefix, string localname, string ns, SvgDocument doc)
25      : base(prefix, localname, ns, doc)
26    {
27      svgExternalResourcesRequired = new SvgExternalResourcesRequired(this);
28      svgTests = new SvgTests(this);
29    }
30
31    #endregion
32
33        #region ISvgElement Members
34
35        /// <summary>
36        /// Gets a value indicating whether this SVG element is renderable.
37        /// </summary>
38        /// <value>
39        /// This is <see langword="'true"/> if the element is renderable; otherwise,
40        /// it is <see langword="false"/>.
41        /// </value>
42        public override bool IsRenderable
43        {
44            get
45            {
46                return false;
47            }
48        }
49
50        /// <summary>
51        /// Gets a value providing a hint on the rendering defined by this element.
52        /// </summary>
53        /// <value>
54        /// An enumeration of the <see cref="SvgRenderingHint"/> specifying the rendering hint.
55        /// This will always return <see cref="SvgRenderingHint.Masking"/>
56        /// </value>
57        public override SvgRenderingHint RenderingHint
58        {
59            get
60            {
61                return SvgRenderingHint.Masking;
62            }
63        }
64
65        #endregion
66
67    #region ISvgMaskElement Members
68
69    public ISvgAnimatedEnumeration MaskUnits
70    {
71      get
72      {
73        if(maskUnits == null)
74        {
75          SvgUnitType mask = SvgUnitType.ObjectBoundingBox;
76          if(GetAttribute("maskUnits") == "userSpaceOnUse")
77            mask = SvgUnitType.UserSpaceOnUse;
78          maskUnits = new SvgAnimatedEnumeration((ushort)mask);
79        }
80        return maskUnits;
81      }
82    }
83
84    public ISvgAnimatedEnumeration MaskContentUnits
85    {
86      get
87      {
88        if(maskContentUnits == null)
89        {
90          SvgUnitType maskContent = SvgUnitType.UserSpaceOnUse;
91          if(GetAttribute("maskContentUnits") == "objectBoundingBox")
92            maskContent = SvgUnitType.ObjectBoundingBox;
93          maskContentUnits = new SvgAnimatedEnumeration((ushort)maskContent);
94        }
95        return maskContentUnits;
96      }
97    }
98
99    public ISvgAnimatedLength X
100    {
101      get
102      {
103        if(x == null)
104        {
105          x = new SvgAnimatedLength(this, "x", SvgLengthDirection.Horizontal, "-10%");
106        }
107        return x;
108      }
109    }
110
111    public ISvgAnimatedLength Y
112    {
113      get
114      {
115        if(y == null)
116        {
117          y = new SvgAnimatedLength(this, "y", SvgLengthDirection.Vertical, "-10%");
118        }
119        return y;
120      }
121    }
122
123    public ISvgAnimatedLength Width
124    {
125      get
126      {
127        if(width == null)
128        {
129          width = new SvgAnimatedLength(this, "width", SvgLengthDirection.Viewport, "120%");
130        }
131        return width;
132      }
133    }
134
135    public ISvgAnimatedLength Height
136    {
137      get
138      {
139        if(height == null)
140        {
141          height = new SvgAnimatedLength(this, "height", SvgLengthDirection.Viewport, "120%");
142        }
143        return height;
144      }
145    }
146
147    #endregion
148
149    #region ISvgExternalResourcesRequired Members
150
151    public ISvgAnimatedBoolean ExternalResourcesRequired
152    {
153      get
154      {
155        return svgExternalResourcesRequired.ExternalResourcesRequired;
156      }
157    }
158
159    #endregion
160
161    #region ISvgTests Members
162
163    public ISvgStringList RequiredFeatures
164    {
165      get { return svgTests.RequiredFeatures; }
166    }
167
168    public ISvgStringList RequiredExtensions
169    {
170      get { return svgTests.RequiredExtensions; }
171    }
172
173    public ISvgStringList SystemLanguage
174    {
175      get { return svgTests.SystemLanguage; }
176    }
177
178    public bool HasExtension(string extension)
179    {
180      return svgTests.HasExtension(extension);
181    }
182
183        #endregion
184  }
185}
Note: See TracBrowser for help on using the repository browser.