private static long TimeGeneratePage() { sw.Start(); int x = 120, y = 150, width = 705, height = 360; Bitmap source = new Bitmap(prefixFilePath); List <Bitmap> pics = new List <Bitmap>(); for (int i = 0; i < 7; i++) { for (int j = 0; j < 3; j++) { Bitmap CroppedImage = source.Clone(new System.Drawing.Rectangle(x, y, width, height), source.PixelFormat); if (Cutter.IsEmpty(CroppedImage)) { break; } pics.Add(CroppedImage); x += 717; } x = 120; y += 366; } for (int i = 0; i < pics.Count - 1; i++) { pics[i] = Cutter.ResizeQR(pics[i], "1", i); } Cutter.GeneratePage(pics, 1); sw.Stop(); GC.Collect(); GC.WaitForPendingFinalizers(); timeForPages = sw.ElapsedMilliseconds; sw.Reset(); return(timeForPages * pages); }
public static void Cut(string path, int name, ProgressBar progressBar) { x = 120; y = 150; Bitmap source = new Bitmap(path); List <Bitmap> pics = new List <Bitmap>(); for (int i = 0; i < 7; i++) { for (int j = 0; j < 3; j++) { Bitmap CroppedImage = source.Clone(new System.Drawing.Rectangle(x, y, width, height), source.PixelFormat); if (Cutter.IsEmpty(CroppedImage)) { break; } pics.Add(CroppedImage); x += 717; } x = 120; y += 366; } for (int i = 0; i < pics.Count - 1; i++) { pics[i] = Cutter.ResizeQR(pics[i], name.ToString(), i); } Cutter.GeneratePage(pics, name); Cutter.progress(progressBar); GC.Collect(); GC.WaitForPendingFinalizers(); }