I wrote a small application to use as a sandbox for testing ideas that will end up in a production product. The idea is simple; use a TrackBar to change the overall brightness of an image. Because this process takes a fair amount of time, I need to do it in another thread (unless you have a better way). I cannot use the ColorMatrix class because it allows color component values to overflow and I cannot figure out how to clamp them at 255. Anyway, here is the problem:
When I move the TrackBar slowly, everything works great. When I move the TrackBar quickly, the image becomes distorted. Horizontal bands appear across it, as if the image was processed using different scale factors. I don't know how this could be as I am drawing into a display bitmap using a base bitmap to get the color values, but I have *very* little experience with threading. I'm stuck at this point, so any help you guys could give would be much appreciated. The project is below (had to use filefront as it is too large for a forum attachment).