GDI+ Offensive Flickering
-
Hi! I'm working on a program that opens JPEG images and i'm using GDI+ to do this. Everything was working fine until i tried to create a zoom feature. ScaleTransform() somehow causes horrible flickering. I'm using CMemDC for doulbe buffering which works fine if you view the image at 100% size. Even the scrollbars get sluggish the flickering is so bad. What could be causing this and is there a non-flickering way to do zoom? -- Steve
-
Hi! I'm working on a program that opens JPEG images and i'm using GDI+ to do this. Everything was working fine until i tried to create a zoom feature. ScaleTransform() somehow causes horrible flickering. I'm using CMemDC for doulbe buffering which works fine if you view the image at 100% size. Even the scrollbars get sluggish the flickering is so bad. What could be causing this and is there a non-flickering way to do zoom? -- Steve
I am not sure this is a GDI+ problem. Possible causes: 1) failure to over ride CWnd::OnEraseBkgnd() (a.k.a. WM_ERASEBKGND). 2) not drawing the entire client content a memory DC before blitting it to the screen (kind of slow). When displaying rectangular images that require updating/zooming etc..., I use the following method. 1) Override OnEraseBkgnd() to return TRUE. 2) In OnDraw(): (1) draw the image, (2) then call pDC->ExcludeClipRect() to exclude the drawn image rectangle from furthur drawing, then (3) draw the background (pDC->FillSolidRect(&rectClient, ::GetSysColor(COLOR_WINDOW));). There are aticles on GDI+ and flicker free drawing at codeproject. INTP