PMPaintThread: Difference between revisions
Appearance
Created page with "==Description== Paint thread class: Allows to dump lenghty paint operations on a secondary thread. ===What to do to use the class:=== # Create the class (you'll want to deriv..." |
No edit summary |
||
Line 4: | Line 4: | ||
===What to do to use the class:=== | ===What to do to use the class:=== | ||
# Create the class (you'll want to derive another class and redefine the paint function). | # Create the class (you'll want to derive another class and redefine the paint function). | ||
# when creating the window that uses the class (in the create() func.) open a DC of the window, get a PS, create the paint thread, and if you want, you may produce a segment on the PS. (openSegment with drawing mode set to DM_RETAIN). | |||
# when creating the window that uses the class (in the create() func.) open a DC of the window, get a PS, create the paint thread, and if | |||
you want, you may produce a segment on the PS. (openSegment with drawing mode set to DM_RETAIN). | |||
# When WM_PAINT is sent to the window, do default processing (ie erasing the window, then stop drawing in the paint thread, wait for ready flag (readySem posted), and post the triggerSem to trigger drawing. | # When WM_PAINT is sent to the window, do default processing (ie erasing the window, then stop drawing in the paint thread, wait for ready flag (readySem posted), and post the triggerSem to trigger drawing. | ||
# When exiting the window, kill the thread, (optionally calling stop and waiting for ready flag). | # When exiting the window, kill the thread, (optionally calling stop and waiting for ready flag). | ||
'''Note:''' it is not necessary to wait for the ready flag. | '''Note:''' it is not necessary to wait for the ready flag. |
Revision as of 22:55, 2 December 2015
Description
Paint thread class: Allows to dump lenghty paint operations on a secondary thread.
What to do to use the class:
- Create the class (you'll want to derive another class and redefine the paint function).
- when creating the window that uses the class (in the create() func.) open a DC of the window, get a PS, create the paint thread, and if you want, you may produce a segment on the PS. (openSegment with drawing mode set to DM_RETAIN).
- When WM_PAINT is sent to the window, do default processing (ie erasing the window, then stop drawing in the paint thread, wait for ready flag (readySem posted), and post the triggerSem to trigger drawing.
- When exiting the window, kill the thread, (optionally calling stop and waiting for ready flag).
Note: it is not necessary to wait for the ready flag.