public DrawPath ( Color fillColor, Color strokeColor, double strokeThickness, string data ) : void | ||
fillColor | Color | |
strokeColor | Color | |
strokeThickness | double | |
data | string | |
return | void |
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; }
internal string NewImage(UndirectedGraph<Pixel, TaggedUndirectedEdge<Pixel, EdgeTag>> g,Shapes shapes, string fileName = "image.svg") { svg = new SVGDocument(Width * scale + 1, Height * scale + 1); String data = ""; Color color = new Color(); foreach( Shape shape in shapes) { data = "M "; Pixel lastPixel = null; for (int i = 0; i < shape.Count; i++) { ArrayList curve = ((Curve)shape[i]).curveToPoints(); if ( i != 0 && !curve[0].Equals(lastPixel)) // Corrige curvas que possa estar no sentido errado curve.Reverse(); Pixel pixel = curve[0] as Pixel; lastPixel = curve[curve.Count - 1] as Pixel; if (i == 0) data += pixel.x + "," + pixel.y; curve.Add(curve[curve.Count - 1]); data += catmullRom2bezier(curve) + " "; color = ((Curve)((ArrayList)shape)[0]).color; } svg.DrawPath(color, color, 0.01, data); } /* foreach (var v in g.Vertices) { svg.DrawCircle(Color.Blue, Color.Transparent, 0, v.x * 7 + 7 / 2, v.y * 7 + 7 / 2, 1); }*/ //Retorna o nome do arquivo salvo svg.Save(fileName); return fileName; }