public override void AssignAttribute(string attrName, string attrValue) { switch (attrName) { default: if (!AssignCommonAttribute(attrName, attrValue)) { throw new NotSupportedException(); } break; case "x1": _spec.X1 = ParseGenericLength(attrValue); break; case "y1": _spec.Y1 = ParseGenericLength(attrValue); break; case "x2": _spec.X2 = ParseGenericLength(attrValue); break; case "y2": _spec.Y2 = ParseGenericLength(attrValue); break; case "gradientTransform": SvgParser.ParseTransform(attrValue, _spec); break; } }
public static VgVisualDoc CreateVgVisualDocFromFile(string filename) { VgDocBuilder docBuilder = new VgDocBuilder(); SvgParser svgParser = new SvgParser(docBuilder); //TODO: don't access file system here, //we should ask from 'host' for a file content or stream of filecontent string svgFileContent = System.IO.File.ReadAllText(filename); svgParser.ParseSvg(svgFileContent); //2. create visual tree from svg document and its spec VgVisualDocBuilder vgDocBuilder = new VgVisualDocBuilder(); return(vgDocBuilder.CreateVgVisualDoc(docBuilder.ResultDocument, null)); }
public override void AssignAttribute(string attrName, string attrValue) { switch (attrName) { default: if (!AssignCommonAttribute(attrName, attrValue)) { throw new NotSupportedException(); } break; case "cx": _spec.CX = ParseGenericLength(attrValue); break; case "cy": _spec.CY = ParseGenericLength(attrValue); break; case "fx": _spec.FX = ParseGenericLength(attrValue); break; case "fy": _spec.FY = ParseGenericLength(attrValue); break; case "fr": _spec.FR = ParseGenericLength(attrValue); break; case "r": _spec.R = ParseGenericLength(attrValue); break; case "gradientTransform": SvgParser.ParseTransform(attrValue, _spec); break; case "gradientUnits": _spec.GradientUnits = ParseContentUnit(attrValue); break; } }