public static void RenderPng(SimulationCoordinateSpace coordinateSpace, INetworkDatabase ndb, IUnitDatabase units, IDictionary <int, TrainControlStateSummary>?controllerMap, string filename, int w, int h, double scale, int fontSize) { var center = new PointD(w / 2, h / 2); var surf = new ImageSurface(Format.Argb32, w, h); Context cr = new Context(surf); RenderToContext(coordinateSpace, ndb, units, controllerMap, cr, center, scale, fontSize); cr.Dispose(); surf.WriteToPng(filename); surf.Finish(); surf.Dispose(); }