-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathSvgUse.cs
More file actions
52 lines (45 loc) · 1.44 KB
/
SvgUse.cs
File metadata and controls
52 lines (45 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Drawing2D;
namespace ST.Library.Drawing.SvgRender
{
[SvgElement("use")]
public class SvgUse : SvgElement
{
public override string TargetName {
get { return "use"; }
}
public override bool AllowElementDraw {
get { return true; }
}
public string LinkID { get; private set; }
protected internal override void OnInitAttribute(string strName, string strValue) {
switch (strName) {
case "href":
case "xlink:href":
if(string.IsNullOrEmpty(strValue) || strValue.Length < 2){
return;
}
if (strValue[0] != '#') {
return;
}
this.LinkID = strValue.Substring(1);
break;
}
}
protected internal override void DrawElement(System.Drawing.Graphics g) {
if (string.IsNullOrEmpty(this.LinkID)) {
return;
}
var ele = this.Document.GetElementByID(this.LinkID);
if (ele == null) {
return;
}
this.DrawElement(g, ele, this);
}
public override GraphicsPath GetPath() { return null; }
protected internal override void Dispose() { }
}
}