|
-
April 17th, 2004, 05:05 PM
#1
Multithreading an Pixel-Drawing
Hello,
I come from another OS than Win32, and when it comes to graphics, I am a little bit confused by the event-driven design of the win-os.
what I want to do:
I want to compute an image, pixel by pixel in a another thread than the main-thread.
the image should be drawn in a window also pixel by pixel. this means, when a pixel of my image is computed it should be drawn to the window.
problem:
as I understood, drawing it is only possible in the WM_PAINT-handling of the window-procedure. therefore I am not allowed to use SetPixel in another thread. Or, to say it correctly, I am allowed to do this, but it doesnt result in the pixel to be displayed. am I right ?
a possible solution:
I compute the pixels for the image in a separate compatible bitmap/DC-combination. each time a pixel is computed I call SetPixel on the separate DC. then I invalidate the window-rect of the window. In the WM_PAINT-handling of the window I BitBlt the separate bitmap to the window-dc.
what I don't like about this:
I assume to be that solution to be awful slow, because for each little pixel a lot of system-overhead must be performed. especially BitBlt-ing the whole bitmap for each pixel.
my question to you:
is there a "smarter" way to perform the task ? what is the fastest way that you windows-profis know about doing such a work ? for short: what is your advise ? or do you mean I just can forget this ?
thank you for your help
highhead
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|