So, I am making a simple GUI image processing program, C #. For example, I want to change the colors of images in the HSV color model by converting each pixel from RGB and vice versa.
My program loads an image of the user's choice and displays it on one of the form panels using the Graphics context. Then the user can do something with this image by moving the scroll bars, clicking buttons, selecting an image area, etc. When he does, I need to change all the pixel pixels in real time. So, I am writing something like:
for (int x = 0; x < imageWidth; x++) for (int y = 0; y < imageHeight; y++) Color c = g.GetPixel(x, y); c = some_process_color_function_depending_on_user_controls(c); g.SetPixel(x, y)
And even if I work with graphics in memory (not on the screen), the GetPixel and SetPixel functions work VERY SLOW (since my program runs so slowly, I profiled it and explained that these two functions slow down my programs no more) . Thus, I cannot process large snapshots in a few seconds when the user moves the slider or checking the checkbox.
Please, help! What can I do to make my program fast? I agree to use other third-party libraries for graphics or change the programming language!
Abzac source share