|
-
March 4th, 2013, 02:20 AM
#20
Re: Draw Image Using 2D Byte Array ?
 Originally Posted by saraswathisrinath
I used the command like below,
Now, Flickering occurred the particular area (0, 0 ,1000, 256).
Code:
CRect rect;
rect.left = 0;
rect.top = 0;
rect.right = ClientWidth; //1000
rect.bottom = ClientHeight;//256
InvalidateRect(&rect);
You missed to add a note that you do this InvalidateRect inside WM_PAINT handler. That is definitely a bad idea, as you make the system never stop with refreshing. Please explain what you tried to achieve with that.
How can i draw an image without flickering?
You prepare your bitmap bits first, and only then you invalidate the paint area. The paint must be done in minimum of calculations, a single blit is preferable. The process of refreshing must be driven by some mechanism separate from WM_PAINT handler, thread maybe, or timer routine for example.
Best regards,
Igor
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
|