COPYRECT in blitzmax ??

BlitzMax Forums/BlitzMax Programming/COPYRECT in 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.

I'm trying to convert this code to BlitzMax but failing at the copyrect. Any help appreciated
Melt Effect



This tutorial will show you how you can make a melting like effect, where an image is drawn onto the screen in a way that it looks like it is melting down the screen until the image is complete.

The way that I have done it, is that I have two loops, one looping through the image from top to bottom, the other one inside looping through the image from the top to the bottom minus where the first loop is at drawing the same line each time, and then copy the rest of the image at after. Not sure that it makes sense, but its a bit difficult to explain, so look the code over and see if you can catch what I mean.

You have to provide your own image for this one.

Here follows a code example:

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