public void ShowResult() { var surface = CairoEx.BuildSurface((int)rect.Width, (int)rect.Height, CairoEx.ColorMetal, Cairo.Format.Rgb24); var context = new Cairo.Context(surface); Draw(context, isClipped); string outputPath = "D:\\LayoutTest"; if (!System.IO.Directory.Exists(outputPath)) { System.IO.Directory.CreateDirectory(outputPath); } string filePath = outputPath + "\\" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss-fff_") + surface.GetHashCode() + ".png"; surface.WriteToPng(filePath); surface.Dispose(); context.Dispose(); Process.Start("rundll32.exe", @"""C:\Program Files\Windows Photo Viewer\PhotoViewer.dll"",ImageView_Fullscreen " + filePath); }
internal void DrawContent(Rect rect, string text, GUIStyle style) { var surface = CairoEx.BuildSurface((int)rect.Width, (int)rect.Height, CairoEx.ColorMetal, Format.Rgb24); var context = new Context(surface); context.DrawBoxModel(rect, text, style); string outputPath = "D:\\ContentTest"; if (!System.IO.Directory.Exists(outputPath)) { System.IO.Directory.CreateDirectory(outputPath); } string filePath = outputPath + "\\" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss-fff_") + surface.GetHashCode() + ".png"; surface.WriteToPng(filePath); surface.Dispose(); context.Dispose(); Process.Start("rundll32.exe", @"""C:\Program Files\Windows Photo Viewer\PhotoViewer.dll"",ImageView_Fullscreen " + filePath); }
public static void ShowResult(this LayoutGroup group, [System.Runtime.CompilerServices.CallerMemberName] string memberName = null) { var rect = group.Rect; var surface = CairoEx.BuildSurface((int)rect.Width, (int)rect.Height, CairoEx.ColorMetal, Format.Rgb24); var context = new Cairo.Context(surface); Draw(group, context, needClip: true); string outputPath = "D:\\LayoutTest"; if (!System.IO.Directory.Exists(outputPath)) { System.IO.Directory.CreateDirectory(outputPath); } string filePath = outputPath + "\\" + DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss-fff_") + surface.GetHashCode() + memberName + ".png"; surface.WriteToPng(filePath); surface.Dispose(); context.Dispose(); Process.Start("rundll32.exe", @"""C:\Program Files\Windows Photo Viewer\PhotoViewer.dll"",ImageView_Fullscreen " + filePath); }