Iβm interested in this for a while.
In .NET 4.0, Microsoft introduced a parallel library. Basically what it is, there is the Parallel.For method, which automatically generates many threads to help with the job. For example, if you originally had For (int i = 0; i <3; i ++) {code ...}, the parallel.For loop would probably create 3 threads, and each thread would have a different value for i , internal code. Therefore, the best thing I can offer is a Parallel.For loop with
Color c lock(obraz) { c = obraz.GetPixel(..) } ...
upon receipt of the pixel.
If you need more explanation on parallelism, I cannot help you before you take some time to study it, since this is a huge area of ββstudy.
source share