Porting BlitzBasic code to BlitzMax

BlitzMax Forums/BlitzMax Programming/Porting BlitzBasic code to BlitzMax

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Anyone suggest a replacement for the copyrect code in the code below ?
Import "bbtype.bmx"
Import "bbvkey.bmx"

Graphics 640,480,32,2
temp = LoadImage( "picture.jpg" )

'SetBuffer BackBuffer()

melt( temp, 640, 480, 2 )

WaitKey
End

'---------------------------------------------------------------------
' NAME : melt()
' PURPOSE : draws an image onto the screen in a melting like effect
' INPUTS : image handle, width, height, update frequency
' RETURNS : nothing
'---------------------------------------------------------------------
Function melt( PICTURE, WIDTH, HEIGHT, UPDATEFREQ )
HEIGHT = HEIGHT-1
Local lastupdate = MilliSecs()
For y1 = 0 To HEIGHT
While MilliSecs() < ( lastupdate + UPDATEFREQ )
Wend
lastupdate = MilliSecs()
For y2 = 0 To HEIGHT-y
CopyRect 0, HEIGHT-y1, WIDTH, 1, 0, y2, ImageBuffer( PICTURE ), BackBuffer()
Next
CopyRect 0, HEIGHT-y1, WIDTH, y1+1, 0, HEIGHT-y1, ImageBuffer( PICTURE ), BackBuffer()
Flip
Next
End Function