public override Bitmap processImage(Bitmap sourceImage, BackgroundWorker worker) { width = (int)(sourceImage.Width * 0.125); height = (int)(sourceImage.Height * 0.125); Bitmap resultImage = new Bitmap(sourceImage.Width, sourceImage.Height); Filtres filter = new GrayScaleFilter(); resultImage = filter.processImage(sourceImage, worker); for (int i = 0; i < resultImage.Width; i += width) { worker.ReportProgress((int)((float)i / resultImage.Width * 100)); if (worker.CancellationPending) { return(null); } for (int j = 0; j < resultImage.Height; j += height) { getNewSetPixel(resultImage, i, j); } } return(resultImage); }
private void полутонToolStripMenuItem_Click(object sender, EventArgs e) { Filtres filter = new GrayScaleFilter(); backgroundWorker1.RunWorkerAsync(filter); }