private void ExecuteFilter(filterOperation operation) { // calculate the new image by looping through all the pixels // in the (original) image & apply the passed operation to them for (int i = 0; i < image.Width; i++) { for (int j = 0; j < image.Height; j++) { output.SetPixel(i, j, operation(image.GetPixel(i, j))); } Progress((int)(i * 100) / (image.Width - 1)); } }
private void ExecuteFilter(filterOperation operation) { using (Bitmap bmp = new Bitmap(OriginalImage)) { for (int i = 0; i < bmp.Width; ++i) { for (int j = 0; j < bmp.Height; j++) { bmp.SetPixel(i, j, operation(bmp.GetPixel(i, j))); if (progressEvent != null) { int x = i * 100 / bmp.Width; progressEvent(x); } } } filteredImage = (Image)bmp.Clone(); if (progressEvent != null) { progressEvent(100); } } }