internal SvgSvgElement(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { svgExternalResourcesRequired = new SvgExternalResourcesRequired(this); svgFitToViewBox = new SvgFitToViewBox(this); svgTests = new SvgTests(this); currentTranslate = new SvgPoint(0, 0); }
public SvgSvgElement(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { _currentScale = 1; _redrawTimers = new List <Timer>(); _svgExternalResourcesRequired = new SvgExternalResourcesRequired(this); _svgFitToViewBox = new SvgFitToViewBox(this); _svgTests = new SvgTests(this); _currentTranslate = new SvgPoint(0, 0); }
public Geometry CreateGeometry(SvgPolygonElement element) { ISvgPointList list = element.AnimatedPoints; ulong nElems = list.NumberOfItems; if (nElems < 3) { return(null); } PointCollection points = new PointCollection((int)nElems); for (uint i = 0; i < nElems; i++) { ISvgPoint point = list.GetItem(i); points.Add(new Point(Math.Round(point.X, 4), Math.Round(point.Y, 4))); } PolyLineSegment polyline = new PolyLineSegment(); polyline.Points = points; PathFigure polylineFigure = new PathFigure(); polylineFigure.StartPoint = points[0]; polylineFigure.IsClosed = true; polylineFigure.IsFilled = true; polylineFigure.Segments.Add(polyline); PathGeometry geometry = new PathGeometry(); string fillRule = element.GetPropertyValue("fill-rule"); string clipRule = element.GetAttribute("clip-rule"); if (!string.IsNullOrWhiteSpace(clipRule) && string.Equals(clipRule, "evenodd") || string.Equals(clipRule, CssConstants.ValNonzero)) { fillRule = clipRule; } if (fillRule == "evenodd") { geometry.FillRule = FillRule.EvenOdd; } else if (fillRule == CssConstants.ValNonzero) { geometry.FillRule = FillRule.Nonzero; } geometry.Figures.Add(polylineFigure); return(geometry); }
public void TestMatrixTransformIdentity() { SvgMatrix m = new SvgMatrix(1, 2, 3, 4, 5, 6); ISvgPoint p2 = p.MatrixTransform(m); Assert.AreEqual(10, p.X); Assert.AreEqual(20, p.Y); Assert.AreEqual(75, p2.X); Assert.AreEqual(106, p2.Y); }
public void Visit(ISvgPolygonElement element) { ISvgPointList list = element.AnimatedPoints; ulong nElems = list.NumberOfItems; SvgPolygonElement pe = element as SvgPolygonElement; if (nElems == 0 || pe == null) { return; } PointCollection points = new PointCollection((int)nElems); for (uint i = 0; i < nElems; i++) { ISvgPoint point = list.GetItem(i); points.Add(new Point(Math.Round(point.X, 4), Math.Round(point.Y, 4))); } PolyLineSegment polyline = new PolyLineSegment(); polyline.Points = points; PathFigure polylineFigure = new PathFigure(); polylineFigure.StartPoint = points[0]; polylineFigure.IsClosed = true; polylineFigure.IsFilled = true; polylineFigure.Segments.Add(polyline); PathGeometry geometry = new PathGeometry(); FillRule fillRule; if (TryGetFillRule(pe, out fillRule)) { geometry.FillRule = fillRule; } geometry.Figures.Add(polylineFigure); var shape = WrapGeometry(geometry, element); DisplayShape(shape, element); }
public long GetCharNumAtPosition(ISvgPoint point) { throw new NotImplementedException(); }
public ISvgPoint AppendItem(ISvgPoint newItem) { return((SvgPoint)base.AppendItem(newItem)); }
public ISvgPoint ReplaceItem(ISvgPoint newItem, uint index) { return((SvgPoint)base.ReplaceItem(newItem, index)); }
public ISvgPoint InsertItemBefore(ISvgPoint newItem, uint index) { return((SvgPoint)base.InsertItemBefore(newItem, index)); }
public ISvgPoint Initialize(ISvgPoint newItem) { return((SvgPoint)base.Initialize(newItem)); }
public ISvgPoint AppendItem(ISvgPoint newItem) { return (SvgPoint) base.AppendItem(newItem); }
public ISvgPoint ReplaceItem(ISvgPoint newItem, uint index) { return (SvgPoint) base.ReplaceItem(newItem, index); }
public ISvgPoint InsertItemBefore(ISvgPoint newItem, uint index) { return (SvgPoint) base.InsertItemBefore(newItem, index); }
public ISvgPoint Initialize(ISvgPoint newItem) { return (SvgPoint) base.Initialize(newItem); }