Esempio n. 1
0
        public static void AddLayer(string name, List <List <Vector2> > inputShapes, SVGPaintable paintable, SVGMatrix matrix, bool isStroke = false)
        {
            SVGLayer layer;

            if (SVGSimplePath.CreatePolygon(inputShapes, paintable, matrix, out layer, isStroke))
            {
                layer.name = name;
                layers.Add(layer);
            }
        }
Esempio n. 2
0
        static void CreateFill(SVGRectElement svgElement)
        {
            string name = svgElement.attrList.GetValue("id");

            if (string.IsNullOrEmpty(name))
            {
                name = "Rectangle Fill";
            }

            List <List <Vector2> > path;

            if (svgElement.paintable.clipPathList != null && svgElement.paintable.clipPathList.Count > 0)
            {
                path = SVGGeom.ClipPolygon(new List <List <Vector2> >()
                {
                    SVGGraphics.position_buffer
                }, svgElement.paintable.clipPathList);
            }
            else
            {
                path = new List <List <Vector2> >()
                {
                    SVGGraphics.position_buffer
                };
            }

            Mesh antialiasingMesh;
            Mesh mesh = SVGSimplePath.CreatePolygon(path, svgElement.paintable, svgElement.transformMatrix, out antialiasingMesh);

            if (mesh == null)
            {
                return;
            }
            mesh.name = name;
            SVGGraphics.AddMesh(new SVGMesh(mesh, svgElement.paintable.svgFill, svgElement.paintable.opacity));
            if (antialiasingMesh != null)
            {
                SVGFill svgFill = svgElement.paintable.svgFill.Clone();
                svgFill.blend = FILL_BLEND.ALPHA_BLENDED;
                SVGGraphics.AddMesh(new SVGMesh(antialiasingMesh, svgFill, svgElement.paintable.opacity));
            }
        }
Esempio n. 3
0
        public static SVGShape[] GetShapes(List <List <Vector2> > inputShapes, SVGPaintable paintable, SVGMatrix matrix, bool isStroke = false)
        {
            SVGShape[] shapes = null;;
            SVGShape   shape;
            SVGShape   antialiasingShape;

            if (SVGSimplePath.CreatePolygon(inputShapes, paintable, matrix, out shape, out antialiasingShape, isStroke, _antialiasing))
            {
                if (_antialiasing)
                {
                    shapes = new SVGShape[] { shape, antialiasingShape };
                }
                else
                {
                    shapes = new SVGShape[] { shape };
                }
            }

            return(shapes);
        }