Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Windows API: Double Buffering image draws 2002-09-16 -- Andy Ireland Newsgroups: TopSpeed.Topic.Third_Party
Hi Ville,
> Yes, this message is sent to a window when it's background needs to
> be erased . This happens because windows are usually painted using
> a 2-stage process:
>
> - WM_ERASEBKGND: clear the background
> - WM_PAINT: draw the contents on top
It is quicker to draw everything on WM_ERASEBKGND. As for memory overhead
and speed for double buffering, it's not really noticeable. Most
applications use double buffering and it's not a problem. Likewise so does
the OS. IMO double buffering is absolutely a requirement for skinning. You
do not necessarily have to do the whole image everytime either, you could
just do the invalidated portion using the extents sent to you.
> This makes it easy to draw a windows contents, every time you receive
> a WM_PAINT message, you know that you have a nice fresh canvas to
> draw on.
> However, drawing a window twice (once with WM_ERASEBKGND and
> once again with WM_PAINT) will cause the window to flicker.
> Open up notepad, type something and then resize the window and see
> how Microsoft is demonstrating the flickering ;-)
Do the same on a professional product. Double buffering is worth it.
> Dunno what is the fundamental purpose for this property... Andy?
Double buffering probably
Today is November 21, 2024, 7:25 am This article has been viewed 35208 times. Google search has resulted in 154 hits on this article since January 25, 2004.
|
|