Ejemplo n.º 1
0
        internal static void DrawNode(Node node, [CallerMemberName] string memberName = "")
        {
            using (ImageSurface surface = new ImageSurface(Format.Argb32, (int)node.Rect.Width, (int)node.Rect.Height))
                using (Context context = new Context(surface))
                {
                    Draw(context, node);

                    if (!Directory.Exists(OutputPath))
                    {
                        Directory.CreateDirectory(OutputPath);
                    }

                    string filePath = OutputPath + "\\" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss-fff_") + surface.GetHashCode() + memberName + ".png";
                    surface.WriteToPng(filePath);
                    Util.OpenImage(filePath);
                }
        }
Ejemplo n.º 2
0
        internal static void DrawPathPrimitive(PathPrimitive primitive, [CallerMemberName]
                                               string memberName = "")
        {
            var size = GetPrimitiveSize(primitive, out Point minPoint);

            using (ImageSurface surface = new ImageSurface(Format.Argb32, (int)size.Width, (int)size.Height))
                using (Context context = new Context(surface))
                {
                    context.Translate(-minPoint.x, -minPoint.y);
                    Draw(context, primitive);

                    if (!Directory.Exists(OutputPath))
                    {
                        Directory.CreateDirectory(OutputPath);
                    }

                    string filePath = OutputPath + "\\" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss-fff_") + surface.GetHashCode() + memberName + ".png";
                    surface.WriteToPng(filePath);
                    Util.OpenImage(filePath);
                }
        }