Re: Win32 page flipping
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jan 14, 2003
- 471 views
On Tue, 14 Jan 2003 14:00:43 +1100, Patrick.Barnes at transgrid.com.au wrote: > >I have several pages of graphics and text (wPuts'ed) that I wish to = switch between without flickering. How do I draw graphics and text into a= bitmap, so that I can blit it on to the screen in one go? =46lickering? Do you use repaintWindow() alot? I found I reduced alot of flicker with surrounding toolbars, buttons, border etc which did not need updating by invoking my oppaint routine directly. Otherwise: I assume you already have code which writes direct to the window, so use something like this: size =3D getClientRect(win) -- returns {x1,y1,x2,y2} size[3]-=3Dsize[1] size[4]-=3Dsize[2] If Bitmap=3D0 then --[**1**] Bitmap=3Dcreate(Pixmap,"",0,0,0,size[3],size[4],0) end if setCtlSize(Bitmap,size[3],size[4]) then setFont/setPenColor/drawRectangle/drawLine/bitBlt/stretchBlt/ setTextColor/wPuts as usual, only to your Bitmap, then just: copyBlt(win, 0, 0, Bitmap) Pete [**1**] I create my bitmap precisely once, maximum size since I open the window maximised, and resized it before each repaint.