private void UpdateCanvas() { Bitmap dstImage = new Bitmap(srcImage.Width, srcImage.Height); GrayProcessing gp = new GrayProcessing(); Adjustment a = new Adjustment(); Effect e = new Effect(); Segmentation s = new Segmentation(); EdgeDetect ed = new EdgeDetect(); switch (support) { case SupportMethod.Brightness: dstImage = a.Brightness((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Contrast: dstImage = a.Contrast((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Thresholding: dstImage = gp.Thresholding((Bitmap)srcImage.Clone(), (byte)(255 - this.Degree)); break; case SupportMethod.Sharpen: dstImage = e.Sharpen((Bitmap)srcImage.Clone(), (byte)this.Degree); break; case SupportMethod.UnsharpMask: dstImage = e.UnsharpMask((Bitmap)srcImage.Clone(), (byte)this.Degree); break; case SupportMethod.AddNoise: dstImage = e.AddNoise((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Sprinkle: dstImage = e.Sprinkle((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Pinch: dstImage = e.Pinch((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Swirl: dstImage = e.Swirl((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Wave: dstImage = e.Wave((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.MoireFringe: dstImage = e.MoireFringe((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Diffuse: dstImage = e.Diffuse((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Lighting: dstImage = e.Lighting((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.Mosaic: dstImage = e.Mosaic((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.ClearSmallArea: dstImage = s.ClearSmallArea((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.EdgeEnhance: dstImage = ed.EdgeEnhance((Bitmap)srcImage.Clone(), this.Degree); break; case SupportMethod.EdgeHomogenize: dstImage = ed.EdgeHomogenize((Bitmap)srcImage.Clone(), this.Degree); break; default: break; } this.panel1.BackgroundImage = dstImage; this.FinalImage = (Bitmap)dstImage.Clone(); }