当前位置: 首页>>代码示例>>C#>>正文


C# SVGGraphicsPath类代码示例

本文整理汇总了C#中SVGGraphicsPath的典型用法代码示例。如果您正苦于以下问题:C# SVGGraphicsPath类的具体用法?C# SVGGraphicsPath怎么用?C# SVGGraphicsPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SVGGraphicsPath类属于命名空间,在下文中一共展示了SVGGraphicsPath类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

 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;
 }
开发者ID:grrava,项目名称:UnitySVG,代码行数:7,代码来源:SVGGArcAbs.cs

示例2: CreateGraphicsPath

    protected override void CreateGraphicsPath()
    {
        _graphicsPath = new SVGGraphicsPath();

        _graphicsPath.Add(this);
        _graphicsPath.transformList = summaryTransformList;
    }
开发者ID:grrava,项目名称:UnitySVG,代码行数:7,代码来源:SVGRectElement.cs

示例3: Render

 //--------------------------------------------------------------------------------
 //Method: Render
 //--------------------------------------------------------------------------------
 public void Render(SVGGraphicsPath _graphicsPath)
 {
     SVGPoint p, p1;
     p = currentPoint;
     p1 = controlPoint1;
     _graphicsPath.AddQuadraticCurveTo(p1, p);
 }
开发者ID:pjezek,项目名称:UnitySVG,代码行数:10,代码来源:SVGPathSegCurvetoQuadraticAbs.cs

示例4: ExpandBounds

 public void ExpandBounds(SVGGraphicsPath path)
 {
     path.ExpandBounds(x, y);
     path.ExpandBounds(x + width, y);
     path.ExpandBounds(x + width, y + height);
     path.ExpandBounds(x, y + height);
 }
开发者ID:nanuinteractive,项目名称:UnitySVG,代码行数:7,代码来源:SVGGRect.cs

示例5: Render

 public bool Render(SVGGraphicsPath path, ISVGPathDraw pathDraw)
 {
     Profiler.BeginSample("SVGGMoveTo.Render");
     pathDraw.MoveTo(path.matrixTransform.Transform(point));
     Profiler.EndSample();
     return false;
 }
开发者ID:grrava,项目名称:UnitySVG,代码行数:7,代码来源:SVGGMoveTo.cs

示例6: Render

 //--------------------------------------------------------------------------------
 //Method: Render
 //--------------------------------------------------------------------------------
 public void Render(SVGGraphicsPath _graphicsPath)
 {
     Vector2 p;
     p = currentPoint;
     _graphicsPath.AddArcTo(this._r1, this._r2, this._angle,
         this._largeArcFlag, this._sweepFlag, p);
 }
开发者ID:nanuinteractive,项目名称:UnitySVG,代码行数:10,代码来源:SVGPathSegArcAbs.cs

示例7: SVGRadialGradientBrush

    public SVGRadialGradientBrush(SVGRadialGradientElement radialGradElement, SVGGraphicsPath graphicsPath)
    {
        _radialGradElement = radialGradElement;
        Initialize();

        SetGradientVector(graphicsPath);
    }
开发者ID:nanuinteractive,项目名称:UnitySVG,代码行数:7,代码来源:SVGRadialGradientBrush.cs

示例8: SVGLinearGradientBrush

    public SVGLinearGradientBrush(SVGLinearGradientElement linearGradElement, SVGGraphicsPath graphicsPath)
    {
        _linearGradElement = linearGradElement;
        Initialize();

        SetGradientVector(graphicsPath);
        PreLocationProcess();
    }
开发者ID:MrJoy,项目名称:UnitySVG,代码行数:8,代码来源:SVGLinearGradientBrush.cs

示例9: CreateGraphicsPath

 private void CreateGraphicsPath()
 {
     _graphicsPath = new SVGGraphicsPath();
     for(int i = 0; i < _segList.Count; i++) {
       ISVGDrawableSeg temp = _segList.GetItem(i) as ISVGDrawableSeg;
       if(temp != null)
     temp.Render(_graphicsPath);
     }
     _graphicsPath.transformList = summaryTransformList;
 }
开发者ID:pjezek,项目名称:UnitySVG,代码行数:10,代码来源:SVGPathElement.cs

示例10: Render

    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;
    }
开发者ID:nanuinteractive,项目名称:UnitySVG,代码行数:11,代码来源:SVGGPolygon.cs

示例11: Render

    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;
    }
开发者ID:MrJoy,项目名称:UnitySVG,代码行数:11,代码来源:SVGGPolyLine.cs

示例12: Render

    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;
    }
开发者ID:nanuinteractive,项目名称:UnitySVG,代码行数:37,代码来源:SVGGRect.cs

示例13: RoundedRect

    //-----
    public void RoundedRect(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 p5, Vector2 p6, Vector2 p7, Vector2 p8,
		float r1, float r2,
		float angle, float width)
    {
        if ((int) width == 1)
        {
            RoundedRect(p1, p2, p3, p4, p5, p6, p7, p8, r1, r2,
                angle);
            return;
        }

        Line(p1, p2, width);
        Line(p3, p4, width);
        Line(p5, p6, width);
        Line(p7, p8, width);
        Vector2 _p1 = Vector2.zero;
        Vector2 _p2 = Vector2.zero;
        Vector2 _p3 = Vector2.zero;
        Vector2 _p4 = Vector2.zero;

        _graphics.GetThickLine(p1, p2, width, ref _p1, ref _p2, ref _p3, ref _p4);

        Vector2 _p5 = Vector2.zero;
        Vector2 _p6 = Vector2.zero;
        Vector2 _p7 = Vector2.zero;
        Vector2 _p8 = Vector2.zero;

        //-------
        _graphics.GetThickLine(p3, p4, width, ref _p5, ref _p6, ref _p7, ref _p8);

        SVGGraphicsPath _graphicsPath = new SVGGraphicsPath();

        _graphicsPath.AddMoveTo(_p4);
        _graphicsPath.AddArcTo(r1 + (width/2f), r2 + (width/2f), angle, false, true, _p6);
        _graphicsPath.AddLineTo(_p5);
        _graphicsPath.AddArcTo(r1 - (width/2f), r2 - (width/2f), angle, false, false, _p3);
        _graphicsPath.AddLineTo(_p4);

        _graphics.FillPath(_graphicsPath);

        //-------
        _graphics.GetThickLine(p5, p6, width, ref _p1, ref _p2, ref _p3, ref _p4);

        _graphicsPath.Reset();
        _graphicsPath.AddMoveTo(_p8);
        _graphicsPath.AddArcTo(r1 + (width/2f), r2 + (width/2f), angle, false, true, _p2);
        _graphicsPath.AddLineTo(_p1);
        _graphicsPath.AddArcTo(r1 - (width/2f), r2 - (width/2f), angle, false, false, _p7);
        _graphicsPath.AddLineTo(_p8);

        _graphics.FillPath(_graphicsPath);

        //----------
        _graphics.GetThickLine(p7, p8, width, ref _p5, ref _p6, ref _p7, ref _p8);

        _graphicsPath.Reset();
        _graphicsPath.AddMoveTo(_p4);
        _graphicsPath.AddArcTo(r1 + (width/2f), r2 + (width/2f), angle, false, true, _p6);
        _graphicsPath.AddLineTo(_p5);
        _graphicsPath.AddArcTo(r1 - (width/2f), r2 - (width/2f), angle, false, false, _p3);
        _graphicsPath.AddLineTo(_p4);

        _graphics.FillPath(_graphicsPath);

        //-------
        _graphics.GetThickLine(p1, p2, width, ref _p1, ref _p2, ref _p3, ref _p4);

        _graphicsPath.Reset();
        _graphicsPath.AddMoveTo(_p8);
        _graphicsPath.AddArcTo(r1 + (width/2f), r2 + (width/2f), angle, false, true, _p2);
        _graphicsPath.AddLineTo(_p1);
        _graphicsPath.AddArcTo(r1 - (width/2f), r2 - (width/2f), angle, false, false, _p7);
        _graphicsPath.AddLineTo(_p8);

        _graphics.FillPath(_graphicsPath);
    }
开发者ID:grrava,项目名称:UnitySVG,代码行数:77,代码来源:SVGGraphicsStroke.cs

示例14: ArcTo


//.........这里部分代码省略.........
        float _angle = (uy < 0) ? -(float) Math.Acos(tp/n) : (float) Math.Acos(tp/n);
        _angle = _angle*180.0f/Mathf.PI;
        _angle %= 360f;

        n = (float) Math.Sqrt((ux*ux + uy*uy)*(vx*vx + vy*vy));
        tp = ux*vx + uy*vy;
        float _delta = (ux*vy - uy*vx < 0) ? -(float) Math.Acos(tp/n) : (float) Math.Acos(tp/n);
        _delta = _delta*180.0f/Mathf.PI;

        if (!sweepFlag && _delta > 0)
        {
            _delta -= 360f;
        }
        else if (sweepFlag && _delta < 0)
            _delta += 360f;

        _delta %= 360f;

        int number = 50;
        float deltaT = _delta/number;
        //---Get Control Point
        Vector2 _controlPoint1 = Vector2.zero;
        Vector2 _controlPoint2 = Vector2.zero;

        for (int i = 0; i <= number; i++)
        {
            float t_angle = (deltaT*i + _angle)*Mathf.PI/180.0f;
            _controlPoint1.x = _CosRadian*rx*(float) Math.Cos(t_angle) - _SinRadian*ry*(float) Math.Sin(t_angle) + cx;
            _controlPoint1.y = _SinRadian*rx*(float) Math.Cos(t_angle) + _CosRadian*ry*(float) Math.Sin(t_angle) + cy;
            if ((_controlPoint1.x != p1.x) && (_controlPoint1.y != p1.y))
            {
                i = number + 1;
            }
        }

        for (int i = number; i >= 0; i--)
        {
            float t_angle = (deltaT*i + _angle)*Mathf.PI/180.0f;
            _controlPoint2.x = _CosRadian*rx*(float) Math.Cos(t_angle) - _SinRadian*ry*(float) Math.Sin(t_angle) + cx;
            _controlPoint2.y = _SinRadian*rx*(float) Math.Cos(t_angle) + _CosRadian*ry*(float) Math.Sin(t_angle) + cy;
            if ((_controlPoint2.x != p2.x) && (_controlPoint2.y != p2.y))
            {
                i = -1;
            }
        }
        //-----
        Vector2 _p1 = Vector2.zero;
        Vector2 _p2 = Vector2.zero;
        Vector2 _p3 = Vector2.zero;
        Vector2 _p4 = Vector2.zero;

        _graphics.GetThickLine(p1, _controlPoint1, width, ref _p1, ref _p2, ref _p3, ref _p4);

        Vector2 _p5 = Vector2.zero;
        Vector2 _p6 = Vector2.zero;
        Vector2 _p7 = Vector2.zero;
        Vector2 _p8 = Vector2.zero;

        _graphics.GetThickLine(_controlPoint2, p2, width, ref _p5, ref _p6, ref _p7, ref _p8);

        float _half = width/2f;
        float _ihalf1 = _half;
        float _ihalf2 = width - _ihalf1 + 0.5f;
        //-----

        float t_len1 = (_p1.x - cx)*(_p1.x - cx) + (_p1.y - cy)*(_p1.y - cy);
        float t_len2 = (_p2.x - cx)*(_p2.x - cx) + (_p2.y - cy)*(_p2.y - cy);

        Vector2 tempPoint;
        if (t_len1 > t_len2)
        {
            tempPoint = _p1;
            _p1 = _p2;
            _p2 = tempPoint;
        }

        t_len1 = (_p7.x - cx)*(_p7.x - cx) + (_p7.y - cy)*(_p7.y - cy);
        t_len2 = (_p8.x - cx)*(_p8.x - cx) + (_p8.y - cy)*(_p8.y - cy);

        if (t_len1 > t_len2)
        {
            tempPoint = _p7;
            _p7 = _p8;
            _p8 = tempPoint;
        }

        Profiler.BeginSample("SVGGraphicsStroke.ArcTo[CreateGraphicsPath]");
        SVGGraphicsPath _graphicsPath = new SVGGraphicsPath();
        _graphicsPath.AddMoveTo(_p2);
        _graphicsPath.AddArcTo(r1 + _ihalf1, r2 + _ihalf1, angle, largeArcFlag, sweepFlag, _p8);
        _graphicsPath.AddLineTo(_p7);
        _graphicsPath.AddArcTo(r1 - _ihalf2, r2 - _ihalf2, angle, largeArcFlag, !sweepFlag, _p1);
        _graphicsPath.AddLineTo(_p2);
        Profiler.EndSample();
        Profiler.BeginSample("SVGGraphicsStroke.ArcTo[FillPath]");
        _graphics.FillPath(_graphicsPath);
        Profiler.EndSample();
        MoveTo(p);
        Profiler.EndSample();
    }
开发者ID:grrava,项目名称:UnitySVG,代码行数:101,代码来源:SVGGraphicsStroke.cs

示例15: QuadraticCurveTo

    //-----
    public void QuadraticCurveTo(Vector2 p1, Vector2 p, float width)
    {
        Vector2 _point = Vector2.zero;
        _point = _basicDraw.currentPoint;

        Vector2 _p1 = Vector2.zero;
        Vector2 _p2 = Vector2.zero;
        Vector2 _p3 = Vector2.zero;
        Vector2 _p4 = Vector2.zero;

        _graphics.GetThickLine(_point, p1, width, ref _p1, ref _p2, ref _p3, ref _p4);

        Vector2 _p5 = Vector2.zero;
        Vector2 _p6 = Vector2.zero;
        Vector2 _p7 = Vector2.zero;
        Vector2 _p8 = Vector2.zero;

        _graphics.GetThickLine(p1, p, width, ref _p5, ref _p6, ref _p7, ref _p8);

        Vector2 _cp1, _cp2;
        _cp1 = _graphics.GetCrossPoint(_p1, _p3, _p5, _p7);
        _cp2 = _graphics.GetCrossPoint(_p2, _p4, _p6, _p8);

        SVGGraphicsPath _graphicsPath = new SVGGraphicsPath();
        _graphicsPath.AddMoveTo(_p2);
        _graphicsPath.AddQuadraticCurveTo(_cp2, _p8);
        _graphicsPath.AddLineTo(_p7);
        _graphicsPath.AddQuadraticCurveTo(_cp1, _p1);
        _graphicsPath.AddLineTo(_p2);
        _graphics.FillPath(_graphicsPath);

        MoveTo(p);
    }
开发者ID:grrava,项目名称:UnitySVG,代码行数:34,代码来源:SVGGraphicsStroke.cs


注:本文中的SVGGraphicsPath类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。