public override IList <IElement> Start(IWorkerContext ctx, Tag tag)
{
float height = 0; //TODO check viewbox
float width = 0; //TODO check viewbox
Rectangle r = null;
String viewbox = "";
IDictionary <String, String> attributes = tag.Attributes;
if (attributes != null)
{
try {
if (attributes.ContainsKey("height"))
{
height = float.Parse(attributes["height"]);
}
}catch {
//TODO
}
try{
if (attributes.ContainsKey("width"))
{
width = float.Parse(attributes["width"]);
}
}catch {
//TODO
}
try{
if (attributes.TryGetValue("viewBox", out viewbox))
{
r = new Rectangle(0, 0);
StringTokenizer st = new StringTokenizer(viewbox);
if (st.HasMoreTokens())
{
r.Right = float.Parse(st.NextToken());
}
if (st.HasMoreTokens())
{
r.Bottom = -float.Parse(st.NextToken());
}
if (st.HasMoreTokens())
{
r.Left = r.Right + float.Parse(st.NextToken());
}
if (st.HasMoreTokens())
{
r.Top = r.Bottom + float.Parse(st.NextToken());
}
r.Normalize();
}
} catch {
//TODO
}
}
if (r == null)
{
r = new Rectangle(width, height);
}
else if (width == 0 && height == 0)
{
width = r.Width;
height = r.Height;
}
IList <IElement> elems = new List <IElement>();
elems.Add(new Svg(height, width, r, tag.CSS));
return(elems);
}