Exemplo n.º 1
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     Profiler.BeginSample("SVGGArcAbs.Render");
     pathDraw.ArcTo(r1, r2, path.transformAngle + angle, largeArcFlag, sweepFlag, path.matrixTransform.Transform(point));
     Profiler.EndSample();
     return(false);
 }
Exemplo n.º 2
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     Profiler.BeginSample("SVGGArcAbs.Render");
     pathDraw.ArcTo(r1, r2, path.transformAngle + angle, largeArcFlag, sweepFlag, path.matrixTransform.Transform(point));
     Profiler.EndSample();
     return false;
 }
Exemplo n.º 3
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     Profiler.BeginSample("SVGGMoveTo.Render");
     pathDraw.MoveTo(path.matrixTransform.Transform(point));
     Profiler.EndSample();
     return(false);
 }
Exemplo n.º 4
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     Profiler.BeginSample("SVGGMoveTo.Render");
     pathDraw.MoveTo(path.matrixTransform.Transform(point));
     Profiler.EndSample();
     return false;
 }
Exemplo n.º 5
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        int length = points.Count;
        pathDraw.MoveTo(path.matrixTransform.Transform(points[0]));
        for(int i = 1; i < length; i++) {
          Vector2 p = path.matrixTransform.Transform(points[i]);
          pathDraw.LineTo(p);
        }

        return false;
    }
Exemplo n.º 6
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        int length = points.Count;
        Vector2[] tPoints = new Vector2[length];

        for(int i = 0; i < length; i++)
          tPoints[i] = path.matrixTransform.Transform(points[i]);
        pathDraw.Polygon(tPoints);

        return true;
    }
Exemplo n.º 7
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        int length = points.Count;

        pathDraw.MoveTo(path.matrixTransform.Transform(points[0]));
        for (int i = 1; i < length; i++)
        {
            Vector2 p = path.matrixTransform.Transform(points[i]);
            pathDraw.LineTo(p);
        }

        return(false);
    }
Exemplo n.º 8
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        int length = points.Count;

        Vector2[] tPoints = new Vector2[length];

        for (int i = 0; i < length; i++)
        {
            tPoints[i] = path.matrixTransform.Transform(points[i]);
        }
        pathDraw.Polygon(tPoints);

        return(true);
    }
Exemplo n.º 9
0
    public void RenderPath(ISVGPathDraw pathDraw, bool isClose)
    {
//Profiler.BeginSample("SVGGraphicsPath.RenderPath(ISVGPathDraw, bool)");
        isClose = !isClose;
        for (int i = 0; i < listObject.Count; i++)
        {
            ISVGPathSegment seg = (ISVGPathSegment)listObject[i];
//Profiler.BeginSample("SVGGraphicsPath.RenderPath(ISVGPathDraw, bool) => " + seg.GetType().ToString());
            isClose = seg.Render(this, pathDraw) || isClose;
//Profiler.EndSample();
        }

        if (!isClose)
        {
            pathDraw.LineTo(matrixTransform.Transform(beginPoint));
        }
//Profiler.EndSample();
    }
Exemplo n.º 10
0
    public void RenderPath(ISVGPathDraw pathDraw, bool isClose)
    {
        Profiler.BeginSample("SVGGraphicsPath.RenderPath");
        isClose = !isClose;
        Profiler.BeginSample("SVGGraphicsPath.RenderPath[for]");
        for (int i = 0; i < listObject.Count; i++)
        {
            ISVGPathSegment seg = listObject[i];
            isClose = seg.Render(this, pathDraw) || isClose;
        }
        Profiler.EndSample();

        Profiler.BeginSample("SVGPathSegment.Render[LineTo]");
        if (!isClose)
        {
            pathDraw.LineTo(matrixTransform.Transform(beginPoint));
        }
        Profiler.EndSample();
        Profiler.EndSample();
    }
Exemplo n.º 11
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        Vector2 p1 = new Vector2(x, y),
                p2 = new Vector2(x + width, y),
                p3 = new Vector2(x + width, y + height),
                p4 = new Vector2(x, y + height);

        if (rx == 0.0f && ry == 0.0f)
        {
            p1 = path.matrixTransform.Transform(p1);
            p2 = path.matrixTransform.Transform(p2);
            p3 = path.matrixTransform.Transform(p3);
            p4 = path.matrixTransform.Transform(p4);

            pathDraw.Rect(p1, p2, p3, p4);
        }
        else
        {
            float t_rx = (rx == 0.0f) ? ry : rx;
            float t_ry = (ry == 0.0f) ? rx : ry;

            t_rx = (t_rx > (width * 0.5f - 2f)) ? (width * 0.5f - 2f) : t_rx;
            t_ry = (t_ry > (height * 0.5f - 2f)) ? (height * 0.5f - 2f) : t_ry;

            float angle = path.transformAngle;

            Vector2 t_p1 = path.matrixTransform.Transform(new Vector2(p1.x + t_rx, p1.y));
            Vector2 t_p2 = path.matrixTransform.Transform(new Vector2(p2.x - t_rx, p2.y));
            Vector2 t_p3 = path.matrixTransform.Transform(new Vector2(p2.x, p2.y + t_ry));
            Vector2 t_p4 = path.matrixTransform.Transform(new Vector2(p3.x, p3.y - t_ry));

            Vector2 t_p5 = path.matrixTransform.Transform(new Vector2(p3.x - t_rx, p3.y));
            Vector2 t_p6 = path.matrixTransform.Transform(new Vector2(p4.x + t_rx, p4.y));
            Vector2 t_p7 = path.matrixTransform.Transform(new Vector2(p4.x, p4.y - t_ry));
            Vector2 t_p8 = path.matrixTransform.Transform(new Vector2(p1.x, p1.y + t_ry));

            pathDraw.RoundedRect(t_p1, t_p2, t_p3, t_p4, t_p5, t_p6, t_p7, t_p8, t_rx, t_ry, angle);
        }
        return(true);
    }
Exemplo n.º 12
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        Vector2 p1 = new Vector2(x, y),
            p2 = new Vector2(x + width, y),
            p3 = new Vector2(x + width, y + height),
            p4 = new Vector2(x, y + height);

        if(rx == 0.0f && ry == 0.0f) {
          p1 = path.matrixTransform.Transform(p1);
          p2 = path.matrixTransform.Transform(p2);
          p3 = path.matrixTransform.Transform(p3);
          p4 = path.matrixTransform.Transform(p4);

          pathDraw.Rect(p1, p2, p3, p4);
        } else {
          float t_rx = (rx == 0.0f) ? ry : rx;
          float t_ry = (ry == 0.0f) ? rx : ry;

          t_rx = (t_rx > (width * 0.5f - 2f)) ? (width * 0.5f - 2f) : t_rx;
          t_ry = (t_ry > (height * 0.5f - 2f)) ? (height * 0.5f - 2f) : t_ry;

          float angle = path.transformAngle;

          Vector2 t_p1 = path.matrixTransform.Transform(new Vector2(p1.x + t_rx, p1.y));
          Vector2 t_p2 = path.matrixTransform.Transform(new Vector2(p2.x - t_rx, p2.y));
          Vector2 t_p3 = path.matrixTransform.Transform(new Vector2(p2.x, p2.y + t_ry));
          Vector2 t_p4 = path.matrixTransform.Transform(new Vector2(p3.x, p3.y - t_ry));

          Vector2 t_p5 = path.matrixTransform.Transform(new Vector2(p3.x - t_rx, p3.y));
          Vector2 t_p6 = path.matrixTransform.Transform(new Vector2(p4.x + t_rx, p4.y));
          Vector2 t_p7 = path.matrixTransform.Transform(new Vector2(p4.x, p4.y - t_ry));
          Vector2 t_p8 = path.matrixTransform.Transform(new Vector2(p1.x, p1.y + t_ry));

          pathDraw.RoundedRect(t_p1, t_p2, t_p3, t_p4, t_p5, t_p6, t_p7, t_p8, t_rx, t_ry, angle);
        }
        return true;
    }
Exemplo n.º 13
0
 private void RenderEllipseElement(SVGEllipseElement elem, ISVGPathDraw pathDraw)
 {
     SVGPoint p = new SVGPoint(elem.cx.value, elem.cy.value).MatrixTransform(matrixTransform);
     pathDraw.Ellipse(p, elem.rx.value, elem.ry.value, transformAngle);
 }
Exemplo n.º 14
0
 private void RenderCubicCurveTo(SVGGCubicAbs curve, ISVGPathDraw pathDraw)
 {
     pathDraw.CubicCurveTo(curve.p1.MatrixTransform(matrixTransform), curve.p2.MatrixTransform(matrixTransform), curve.p.MatrixTransform(matrixTransform));
 }
Exemplo n.º 15
0
 private void RenderCircleTo(SVGGCircle circle, ISVGPathDraw pathDraw)
 {
     pathDraw.CircleTo(circle.point.MatrixTransform(matrixTransform), circle.r);
 }
Exemplo n.º 16
0
 private void RenderCircleElement(SVGCircleElement elem, ISVGPathDraw pathDraw)
 {
     SVGPoint p = new SVGPoint(elem.cx.value, elem.cy.value).MatrixTransform(matrixTransform);
     pathDraw.Circle(p, elem.r.value);
 }
Exemplo n.º 17
0
    private void RenderRectElement(SVGRectElement rectElement, ISVGPathDraw pathDraw)
    {
        SVGPoint p1, p2, p3, p4;
        float tx = rectElement.x.value;
        float ty = rectElement.y.value;
        float tw = rectElement.width.value;
        float th = rectElement.height.value;
        p1 = new SVGPoint(tx, ty);
        p2 = new SVGPoint(tx + tw, ty);
        p3 = new SVGPoint(tx + tw, ty + th);
        p4 = new SVGPoint(tx, ty + th);

        if(rectElement.rx.value == 0.0f && rectElement.ry.value == 0.0f) {
          p1 = p1.MatrixTransform(matrixTransform);
          p2 = p2.MatrixTransform(matrixTransform);
          p3 = p3.MatrixTransform(matrixTransform);
          p4 = p4.MatrixTransform(matrixTransform);

          pathDraw.Rect(p1, p2, p3, p4);
        } else {
          float t_rx = rectElement.rx.value;
          float t_ry = rectElement.ry.value;
          t_rx = (t_rx == 0.0f) ? t_ry : t_rx;
          t_ry = (t_ry == 0.0f) ? t_rx : t_ry;

          t_rx = (t_rx > (tw * 0.5f - 2f)) ? (tw * 0.5f - 2f) : t_rx;
          t_ry = (t_ry > (th * 0.5f - 2f)) ? (th * 0.5f - 2f) : t_ry;

          float angle = transformAngle;

          SVGPoint t_p1 = new SVGPoint(p1.x + t_rx, p1.y).MatrixTransform(matrixTransform);
          SVGPoint t_p2 = new SVGPoint(p2.x - t_rx, p2.y).MatrixTransform(matrixTransform);
          SVGPoint t_p3 = new SVGPoint(p2.x, p2.y + t_ry).MatrixTransform(matrixTransform);
          SVGPoint t_p4 = new SVGPoint(p3.x, p3.y - t_ry).MatrixTransform(matrixTransform);

          SVGPoint t_p5 = new SVGPoint(p3.x - t_rx, p3.y).MatrixTransform(matrixTransform);
          SVGPoint t_p6 = new SVGPoint(p4.x + t_rx, p4.y).MatrixTransform(matrixTransform);
          SVGPoint t_p7 = new SVGPoint(p4.x, p4.y - t_ry).MatrixTransform(matrixTransform);
          SVGPoint t_p8 = new SVGPoint(p1.x, p1.y + t_ry).MatrixTransform(matrixTransform);

          pathDraw.RoundedRect(t_p1, t_p2, t_p3, t_p4, t_p5, t_p6, t_p7, t_p8, t_rx, t_ry,
          angle);
        }
    }
Exemplo n.º 18
0
    private void RenderPolylineElement(SVGPolylineElement polylineElement, ISVGPathDraw pathDraw)
    {
        int length = polylineElement.listPoints.Count;
        SVGPoint[] points = new SVGPoint[length];

        for(int i = 0; i < length; i++)
          points[i] = polylineElement.listPoints[i].MatrixTransform(matrixTransform);
        pathDraw.Polyline(points);
    }
Exemplo n.º 19
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        pathDraw.CircleTo(path.matrixTransform.Transform(point), r);

        return true;
    }
Exemplo n.º 20
0
    public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
    {
        pathDraw.CircleTo(path.matrixTransform.Transform(point), r);

        return(true);
    }
Exemplo n.º 21
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.QuadraticCurveTo(path.matrixTransform.Transform(p1), path.matrixTransform.Transform(p));
     return(false);
 }
Exemplo n.º 22
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.EllipseTo(path.matrixTransform.Transform(p), r1, r2, path.transformAngle + angle);
     return true;
 }
Exemplo n.º 23
0
 private void RenderEllipseTo(SVGGEllipse ellipse, ISVGPathDraw pathDraw)
 {
     pathDraw.EllipseTo(ellipse.point.MatrixTransform(matrixTransform), ellipse.r1, ellipse.r2, transformAngle + ellipse.angle);
 }
Exemplo n.º 24
0
 private void RenderMoveTo(SVGPoint p, ISVGPathDraw pathDraw)
 {
     pathDraw.MoveTo(p.MatrixTransform(matrixTransform));
 }
Exemplo n.º 25
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.LineTo(path.matrixTransform.Transform(point));
     return(false);
 }
Exemplo n.º 26
0
 private void RenderQuadraticCurveTo(SVGGQuadraticAbs curve, ISVGPathDraw pathDraw)
 {
     pathDraw.QuadraticCurveTo(curve.p1.MatrixTransform(matrixTransform), curve.p.MatrixTransform(matrixTransform));
 }
Exemplo n.º 27
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.ArcTo(r1, r2, path.transformAngle + angle, largeArcFlag, sweepFlag, path.matrixTransform.Transform(point));
     return false;
 }
Exemplo n.º 28
0
 private void RenderArcTo(SVGGArcAbs arc, ISVGPathDraw pathDraw)
 {
     pathDraw.ArcTo(arc.r1, arc.r2, transformAngle + arc.angle, arc.largeArcFlag, arc.sweepFlag, arc.point.MatrixTransform(matrixTransform));
 }
Exemplo n.º 29
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.LineTo(path.matrixTransform.Transform(point));
     return false;
 }
Exemplo n.º 30
0
    public void RenderPath(ISVGPathDraw pathDraw, bool isClose)
    {
        Profiler.BeginSample("SVGGraphicsPath.RenderPath");
        isClose = !isClose;
        Profiler.BeginSample("SVGGraphicsPath.RenderPath[for]");
        for(int i = 0; i < listObject.Count; i++) {
          ISVGPathSegment seg = listObject[i];
          isClose = seg.Render(this, pathDraw) || isClose;
        }
        Profiler.EndSample();

        Profiler.BeginSample("SVGPathSegment.Render[LineTo]");
        if(!isClose)
          pathDraw.LineTo(matrixTransform.Transform(beginPoint));
        Profiler.EndSample();
        Profiler.EndSample();
    }
Exemplo n.º 31
0
    public void RenderPath(ISVGPathDraw pathDraw, bool isClose)
    {
        //Profiler.BeginSample("SVGGraphicsPath.RenderPath(ISVGPathDraw, bool)");
        isClose = !isClose;
        for(int i = 0; i < listObject.Count; i++) {
          ISVGPathSegment seg = (ISVGPathSegment)listObject[i];
        //Profiler.BeginSample("SVGGraphicsPath.RenderPath(ISVGPathDraw, bool) => " + seg.GetType().ToString());
          isClose = seg.Render(this, pathDraw) || isClose;
        //Profiler.EndSample();
        }

        if(!isClose)
          pathDraw.LineTo(matrixTransform.Transform(beginPoint));
        //Profiler.EndSample();
    }
Exemplo n.º 32
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.QuadraticCurveTo(path.matrixTransform.Transform(p1), path.matrixTransform.Transform(p));
     return false;
 }
Exemplo n.º 33
0
    public void RenderPath(ISVGPathDraw pathDraw, bool isClose)
    {
        for(int i = 0; i < listObject.Count; i++)
          switch((SVGPathElementType)listType[i]) {
          case SVGPathElementType.Polygon:
        RenderPolygonElement((SVGPolygonElement)listObject[i], pathDraw);
        isClose = false;
        break;
          case SVGPathElementType.Polyline:
        RenderPolylineElement((SVGPolylineElement)listObject[i], pathDraw);
        break;
          case SVGPathElementType.Rect:
        RenderRectElement((SVGRectElement)listObject[i], pathDraw);
        isClose = false;
        break;
          case SVGPathElementType.Circle:
        RenderCircleElement((SVGCircleElement)listObject[i], pathDraw);
        isClose = false;
        break;
          case SVGPathElementType.Ellipse:
        RenderEllipseElement((SVGEllipseElement)listObject[i], pathDraw);
        isClose = false;
        break;
          //-----
          case SVGPathElementType.CircleTo:
        RenderCircleTo((SVGGCircle)listObject[i], pathDraw);
        isClose = false;
        break;
          //-----
          case SVGPathElementType.EllipseTo:
        RenderEllipseTo((SVGGEllipse)listObject[i], pathDraw);
        isClose = false;
        break;
          //-----
          case SVGPathElementType.MoveTo:
        RenderMoveTo((SVGPoint)listObject[i], pathDraw);
        break;
          case SVGPathElementType.ArcTo:
        RenderArcTo((SVGGArcAbs)listObject[i], pathDraw);
        break;
          case SVGPathElementType.CubicCurveTo:
        RenderCubicCurveTo((SVGGCubicAbs)listObject[i], pathDraw);
        break;
          case SVGPathElementType.QuadraticCurveTo:
        RenderQuadraticCurveTo((SVGGQuadraticAbs)listObject[i], pathDraw);
        break;
          case SVGPathElementType.LineTo:
        RenderLineTo((SVGPoint)listObject[i], pathDraw);
        break;
          }

        if(isClose)
          pathDraw.LineTo(beginPoint.MatrixTransform(matrixTransform));
    }
Exemplo n.º 34
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.EllipseTo(path.matrixTransform.Transform(p), r1, r2, path.transformAngle + angle);
     return(true);
 }
Exemplo n.º 35
0
 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     pathDraw.ArcTo(r1, r2, path.transformAngle + angle, largeArcFlag, sweepFlag, path.matrixTransform.Transform(point));
     return(false);
 }