Re: Fading images with AlphaBlend

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jason Doucette (www.jasondoucette.com)
Date: 10/13/04


Date: Wed, 13 Oct 2004 09:29:28 -0300

Pelle,

> 1) I can erase the background each time I redraw (WM_PAINT) my screen
> increasing my global alpha with every redraw until my MAX-Alpha is
> reached. But this causes the application to flicker - not very nice
> indeed.

Try the WS_EX_COMPOSITED style to enable double buffering for the window.
This should allow all drawing to take place on a behind-the-scenes second
buffer. When all drawing is complete, it will only THEN be blitted to the
window for you to see.

>From MSDN: "Windows XP: With WS_EX_COMPOSITED set, all descendants of a
window get bottom-to-top painting order using double-buffering.
Bottom-to-top painting order allows a descendent window to have translucency
(alpha) and transparency (color-key) effects, but only if the descendent
window also has the WS_EX_TRANSPARENT bit set. Double-buffering allows the
window and its descendents to be painted without flicker."

---------
Jason Doucette
http://www.jasondoucette.com/



Relevant Pages

  • Re: resize SDI Application Flickers
    ... and 'freeze" all updates to the window until everything is in place. ... CRect r; ... What it *represents* is a null pointer or null handle. ... Do eliminate the flicker, you can handle the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages ...
    (microsoft.public.vc.mfc)
  • Re: resize SDI Application Flickers
    ... and 'freeze" all updates to the window until everything is in place. ... CRect r; ... What it *represents* is a null pointer or null handle. ... Do eliminate the flicker, you can handle the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages ...
    (microsoft.public.vc.mfc)
  • Re: XP Taskbar problem
    ... At the time I posted I had two samples - Chad's tutorial and the April SDK ... and now my project runs at full screen without any flicker. ... support starting in full screen correctly mouse support in multimonitor ... Check startup code and see if window client has dimensions of your screen ...
    (microsoft.public.win32.programmer.directx.managed)
  • RE: Combating flicker
    ... smoother by reducing flicker. ... To fully enable double buffering, you must also set AllPaintingInWmPaint to ... use a Windows API to convert your form to what is known as a layered window. ...
    (microsoft.public.dotnet.languages.csharp)
  • DirectShow Flicker problem
    ... I cannot get my program to show an AVI file in windowed mode ... If I run in fullscreen mode, it works fine, no flicker ... If I set my DShow to run in my parent window, ... HRESULT AVIClass::OpenFile ...
    (microsoft.public.win32.programmer.directx.video)