I present my off screen image capture for flicker free animation... (its actually an old post that I reposted here in case a moderator decides to check here..
This example should work.. But some older windows/computers don't allow offscreen draws.
Code:'CURRENTLY THERE ARE 2 SPRITE READY COMMANDS.. circle and gline LOOK AT BASE OF PROGRAM
global gcolor$
call screen 1200,800 ' THIS COMMAND WILL SET UP SCREEN AND OFFSET WINDOW
' OK now that the images are captured lets place them on a refreshed cycle ********
' YOUR GRAPHICS UPDATES IN MASK AREA START HERE
[loop]
for l=1 to 200
call refresh
gcolor$="green"' a global variable for a line command
'call gline 100,100,200,200 ' optional line command
scan
call circle 200,200,l ' THIS IS A CUSTOM SPRITE READY CIRCLE
' YOUR GRAPHICS DRAWS MUST END HERE *******************************
call display ' THIS COMMAND OUTPUTS YOUR SLIDE SHOW IMAGE TO SCREEN
next l ' IN THIS CASE I MADE A CIRCLE THAT CYCLES TO SIZE 200
goto [loop]
wait
[quit]
UNLOADBMP "bl"
UNLOADBMP "wh"
'UNLOADBMP "sh"
close #h
end
'********************** SUB TOOLS BELLOW HERE ***************************
sub display
#h.1 "getbmp dis 0 0 399 799"
#h.2 "addsprite dis1 dis"
#h.2 "drawsprites"
end sub
sub refresh' makes new slate for draws in the prep area
#h.1 "cls"
#h.1 "drawbmp wh 0 0"
#h.1 "drawbmp bl 0 400"
end sub
sub screen x,y' prepares the graphic boxes and host window
nomainwin
WindowWidth=x
WindowHeight=y
UpperLeftX=0
UpperLeftY=0
global getsizeh' globals have been moved to make it a cleaner interface
global getsizev
global hpos ' the horizontal locators for ENTER sub
global vpos ' the vertical locator for ENTER sub
global gcolor$ ' YOU MUST DEFINE gcolor$ BEFORE you use GRPRINT or ENTER but it only needs to be done once
graphicbox #h.1, 1,1,401,801 'create the capture area
graphicbox #h.2, 401,1,801,801' create the display screen
open "Generic Window Host" for window_nf as #h
print #h, "trapclose [quit]"
hWindow = hwnd(#h)
calldll #user32, "MoveWindow",_
hWindow as ulong,_
-403 as long,_
10 as long,_
x as long,_
y as long,_
1 as long,_
result as long
#h.1 "down;fill black"
#h.1 "getbmp bl 0 0 399 399"
#h.1 "down;fill white"
#h.1 "getbmp wh 0 0 399 399"
#h.2 "down;fill black"
end sub
'**************GLINE **************************
sub gline x,y,h,v
#h.1 "down;color black;line ";x;" ";y;" ";h;" ";v
#h.1 "color ";gcolor$;";line ";x;" ";y+400;" ";h;" ";v+400
end sub
'**************CIRCLE*************************
sub circle x,y,size
#h.1 "down;color black;place ";x;" ";y;";circle ";size
#h.1 "color ";gcolor$;";place ";x;" ";y+400;";circle ";size
end sub