Exemplo n.º 1
0
        public List <List <Vector2> > GetClipPath()
        {
            List <List <Vector2> > path = GetPath();

            if (path == null || path.Count == 0)
            {
                return(null);
            }

            List <List <Vector2> > clipPath = new List <List <Vector2> >();

            if (paintable.IsFill())
            {
                clipPath.AddRange(path);
            }

            if (paintable.IsStroke())
            {
                List <StrokeSegment[]> segments = new List <StrokeSegment[]>();
                for (int i = 0; i < path.Count; i++)
                {
                    if (path[i] == null || path[i].Count < 2)
                    {
                        continue;
                    }
                    segments.Add(SVGSimplePath.GetSegments(path[i]));
                }

                List <List <Vector2> > strokePath = SVGLineUtils.StrokeShape(segments, paintable.strokeWidth, Color.black, SVGSimplePath.GetStrokeLineJoin(paintable.strokeLineJoin), SVGSimplePath.GetStrokeLineCap(paintable.strokeLineCap), paintable.miterLimit, paintable.dashArray, paintable.dashOffset, ClosePathRule.AUTO, SVGGraphics.roundQuality);
                if (strokePath != null && strokePath.Count > 0)
                {
                    clipPath.AddRange(strokePath);
                }
            }

            return(clipPath);
        }
Exemplo n.º 2
0
        public static List <List <Vector2> > GetClipPath(SVGMatrix matrix, SVGPolygonElement svgElement)
        {
            List <Vector2> path = GetPath(matrix, svgElement);

            if (path == null || path.Count == 0)
            {
                return(null);
            }

            List <List <Vector2> > clipPath = new List <List <Vector2> >();

            if (svgElement.paintable.IsFill())
            {
                clipPath.Add(path);
            }

            if (svgElement.paintable.IsStroke())
            {
                List <StrokeSegment[]> segments = new List <StrokeSegment[]>()
                {
                    SVGSimplePath.GetSegments(path)
                };
                List <List <Vector2> > strokePath = SVGLineUtils.StrokeShape(segments, svgElement.paintable.strokeWidth, Color.black, SVGSimplePath.GetStrokeLineJoin(svgElement.paintable.strokeLineJoin), SVGSimplePath.GetStrokeLineCap(svgElement.paintable.strokeLineCap), svgElement.paintable.miterLimit, svgElement.paintable.dashArray, svgElement.paintable.dashOffset, ClosePathRule.ALWAYS, SVGGraphics.roundQuality);
                if (strokePath != null && strokePath.Count > 0)
                {
                    clipPath.AddRange(strokePath);
                }
            }

            return(clipPath);
        }
Exemplo n.º 3
0
        public List <List <Vector2> > GetClipPath()
        {
            List <List <Vector2> > path = GetPath();

            if (path == null || path.Count == 0 || path[0] == null || path[0].Count == 0)
            {
                return(null);
            }

            List <List <Vector2> > clipPath = new List <List <Vector2> >();

            List <StrokeSegment[]> segments = new List <StrokeSegment[]>()
            {
                SVGSimplePath.GetSegments(path[0])
            };
            List <List <Vector2> > strokePath = SVGLineUtils.StrokeShape(segments, paintable.strokeWidth, Color.black, SVGSimplePath.GetStrokeLineJoin(paintable.strokeLineJoin), SVGSimplePath.GetStrokeLineCap(paintable.strokeLineCap), paintable.miterLimit, paintable.dashArray, paintable.dashOffset, ClosePathRule.NEVER, SVGGraphics.roundQuality);

            if (strokePath != null && strokePath.Count > 0)
            {
                clipPath.AddRange(strokePath);
            }

            return(clipPath);
        }