; ImageBuffer Example ; ------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A blank canvas image we will paint onto while the program runs canvas=CreateImage(640,480) While Not KeyDown(1) Cls ; Hold the left mouse button to paint INTO the canvas image If MouseDown(1) Then SetBuffer ImageBuffer(canvas) ; drawing now goes into the image Color Rand(60,255),Rand(60,255),Rand(60,255) Oval MouseX()-8,MouseY()-8,16,16,True SetBuffer BackBuffer() ; back to normal screen drawing End If ; Draw the canvas image - it keeps everything painted so far DrawImage canvas,0,0 ; A ring shows the brush position Color 255,255,255 Oval MouseX()-8,MouseY()-8,16,16,False Text 0,0,"Hold the left mouse button to paint into the image Esc: exit" Text 0,20,"SetBuffer ImageBuffer(canvas) redirects drawing into the image" Flip Wend End