private void bgWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bg = sender as BackgroundWorker; Form f = ActiveMdiChild; if (f != null && f is WindowPicture) { WindowPicture pic = f as WindowPicture; SeamCarving seam = new SeamCarving(pic.Image); Bitmap tmp = (Bitmap)seam.Retarget((int)nudWidth.Value, (int)nudHeight.Value, bg); e.Result = new KeyValuePair<WindowPicture, Bitmap>(pic, tmp); } }
private void button1_Click_1(object sender, EventArgs e) { WindowPicture pic = ActiveMdiChild as WindowPicture; if (MdiChildren.Contains(pic)) { SeamCarving seam = new SeamCarving((Bitmap)pic.Image); //seam.Image = (Bitmap)pic.Image; pic.Image = seam.Retarget(pic.Image.Width - 1, pic.Image.Height); //WindowPicture wen = new WindowPicture(); //wen.Image = seam.EnergyImage; //wen.File = "Energy"; //wen.MdiParent = this; //wen.Show(); //pic.Image = seam.ResultImage; //pic.RefreshPicture(); nudWidth.Value = pic.Image.Width; nudHeight.Value = pic.Image.Height; nudColorize(pic); } }