PixelArtUpscaler.Image.SVGDocument.DrawPath C# (CSharp) Method

DrawPath() public method

public DrawPath ( Color fillColor, Color strokeColor, double strokeThickness, string data ) : void
fillColor Color
strokeColor Color
strokeThickness double
data string
return void
        public void DrawPath(Color fillColor, Color strokeColor, double strokeThickness, string data)
        {
            //string fillOpacity = ((float)fillColor.A / 255f).ToString();

            m_writer.WriteStartElement("path");
            m_writer.WriteAttributeString("d", data);
            m_writer.WriteAttributeString("fill", Color2String(fillColor));
            //m_writer.WriteAttributeString("fill", "none");
            m_writer.WriteAttributeString("stroke", Color2String(strokeColor));
            m_writer.WriteAttributeString("stroke-width", strokeThickness.ToString().Replace(",", "."));
               // m_writer.WriteAttributeString("style", "fill-opacity:" + fillOpacity + ";fill:rgb(0,0,0);stroke:rgb(0,0,0);stroke-width:" + strokeThickness.ToString());

            m_writer.WriteEndElement();
        }

Usage Example

コード例 #1
0
        internal string ToCurves(System.Collections.ArrayList curves, string fileName = "image.svg")
        {
            svg = new SVGDocument(Width * scale + 1, Height * scale + 1);
            String data = "";
            for (int i = 0; i < curves.Count; i++)
            {
                data = "M";
                System.Collections.ArrayList curve = curves[i] as System.Collections.ArrayList;
                Pixel pixel = curve[0] as Pixel;
                data += pixel.x + "," + pixel.y;
                curve.Add(curve[curve.Count - 1]);
                data += catmullRom2bezier(curve);
                svg.DrawPath(Color.White, Color.Red, 1, data);
            }

            //Retorna o nome do arquivo salvo
            svg.Save(fileName);
            return fileName;
        }
All Usage Examples Of PixelArtUpscaler.Image.SVGDocument::DrawPath