Beispiel #1
0
 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);
 }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        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);
        }
Beispiel #6
0
 public long GetCharNumAtPosition(ISvgPoint point)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public ISvgPoint AppendItem(ISvgPoint newItem)
 {
     return((SvgPoint)base.AppendItem(newItem));
 }
Beispiel #8
0
 public ISvgPoint ReplaceItem(ISvgPoint newItem, uint index)
 {
     return((SvgPoint)base.ReplaceItem(newItem, index));
 }
Beispiel #9
0
 public ISvgPoint InsertItemBefore(ISvgPoint newItem, uint index)
 {
     return((SvgPoint)base.InsertItemBefore(newItem, index));
 }
Beispiel #10
0
 public ISvgPoint Initialize(ISvgPoint newItem)
 {
     return((SvgPoint)base.Initialize(newItem));
 }
Beispiel #11
0
 public ISvgPoint AppendItem(ISvgPoint newItem)
 {
     return (SvgPoint) base.AppendItem(newItem);
 }
Beispiel #12
0
 public ISvgPoint ReplaceItem(ISvgPoint newItem, uint index)
 {
     return (SvgPoint) base.ReplaceItem(newItem, index);
 }
Beispiel #13
0
 public ISvgPoint InsertItemBefore(ISvgPoint newItem, uint index)
 {
     return (SvgPoint) base.InsertItemBefore(newItem, index);
 }
Beispiel #14
0
 public ISvgPoint Initialize(ISvgPoint newItem)
 {
     return (SvgPoint) base.Initialize(newItem);
 }
 public long GetCharNumAtPosition(ISvgPoint point)
 {
     throw new NotImplementedException();
 }