CopyImage problem

Blitz3D Forums/Blitz3D Programming/CopyImage problem

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.

Firstly, I know what people like to say about using CopyImage and ResizeImage on the fly instead of preprocessing it all and sticking the results into an array, but this particular re-size might occur once in any 5 minute window of play, could re-size the image to any one of about 200 different sizes and the game runs at about 3% to 4% CPU usage on my system... so I don't want to hear anything about that. Not today. :p

However, I wondered if anyone could shed some light on this strange problem I have so I can get rid of my dubious work-around. Take a look at the following code. The important function it the one called ResizeBat, which (ignoring the first two lines) simply copies a base image over an existing one and then re-sizes it. You can see I've commented out the normal Blitz command CopyImage and added a call to my own function: myCopyImage (listed below).


Function ResizeBat(num, ammount#)
	batScale(num) = ammount#
	If batScale(num) <=0 Then batScale(num) = 0.1

;	bat(num) = CopyImage (bat(0))
	myCopyImage(bat(0), bat(num))

	ResizeImage bat(num), 128 * batScale(num), 20
End Function


Function myCopyImage(source, dest)
	ResizeImage dest, ImageWidth(source), ImageHeight(source)
	oldbuffer = GraphicsBuffer()
	SetBuffer ImageBuffer(dest)
	DrawBlock source, 0, 0
	SetBuffer oldbuffer
End Function


If I use neither of the copy functions, the re-size works as expected.
If I use the Blitz copy function, neither the copy nor the re-size takes place.
If I use my copy function both the copy and the re-size work fine.
If I use both copy functions (pointless, I know, but I was just testing stuff out by this time) no copying or resizing takes place.


Bizarre!
Any ideas?