/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="path"></param> /// <param name="mapper"></param> public static void SaveAsImage(GridField2d <T> field, string path, Func <T, Color> mapper) { using (Bitmap bmp = new Bitmap(field.CountX, field.CountY, PixelFormat.Format32bppArgb)) { FieldIO.WriteToImage(field, bmp, mapper); bmp.Save(path); } }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="path"></param> /// <param name="mapper"></param> public static void SaveAsImageStack(GridField3d <T> field, string path, Func <T, Color> mapper) { string dir = Path.GetDirectoryName(path); string name = Path.GetFileNameWithoutExtension(path); string ext = Path.GetExtension(path); Parallel.For(0, field.CountZ, z => { using (Bitmap bmp = new Bitmap(field.CountX, field.CountY, PixelFormat.Format32bppArgb)) { FieldIO.WriteToImage(field, z, bmp, mapper); bmp.Save(String.Format(@"{0}\{1}_{2}{3}", dir, name, z, ext)); } }); }