I am trying to make an animation in a window with a transparent background using the Windows API. The problem is that I cannot delete the previous picture from the window.
I set the following options:
InvalidateRect(m_hWnd, &sClientRect, TRUE); // we set the bErase parameter as TRUE paintParams.dwFlags = BPPF_ERASE; // erase window content while copying backbuffer paintParams.pBlendFunction = &m_sBlendfunc; // copy source image to backbuffer
But that still doesn't work. The result can be seen in the attached image. I need animation by moving circles around the screen. What I get instead (as shown in the attached image) is an artifact of their movement, because the window does not clear before every draw.
See my full code below:
#include "DrawTest.h" DrawTest* m_sDrawTest; DrawTest::DrawTest() { m_pAnimation = NULL; m_sDrawTest = NULL; m_nFrameindex = 0; } DrawTest::~DrawTest(void) { if(m_pAnimation) delete m_pAnimation; m_pAnimation = NULL; if(m_sDrawTest) delete m_sDrawTest; m_sDrawTest = NULL; } int DrawTest::Init(AnimationManager* pAnimationManager,HINSTANCE hInstance,int nCmdShow) {
This is the result after 5 frames: 
c ++ windows transparency gdi + wm-paint
tal
source share