Images and Banks

BlitzPlus Forums/BlitzPlus Programming/Images and Banks

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.

@Nicoust, Its from the BlitzPlus manual. You posted the question in the BlitzPlus section, so I assumed its BlitzPlus you are using.

Here is an example of how to poke directly into buffers.

Graphics 640,480,32,2

temp = CreateImage( 256, 256 )
SetBuffer ImageBuffer( temp )
LockBuffer ImageBuffer( temp )
imagebank = LockedPixels()
imagepitch = LockedPitch()
UnlockBuffer ImageBuffer( temp )

SetBuffer BackBuffer()
LockBuffer BackBuffer()
backbank = LockedPixels()
backpitch = LockedPitch()
UnlockBuffer BackBuffer()

While Not KeyHit(1)

	Cls

	; poking random colors into the imagebuffer
		For y =0 To 255
			For x = 0 To 255
				PokeInt( imagebank, y*imagepitch+x*4, Rnd($FFFFFF) )
			Next
		Next

	; poking random colors into the backbuffer
		For y =0 To 255
			For x = 0 To 255
				PokeInt( backbank, y*backpitch+x*4, Rnd($FFFFFF) )
			Next
		Next

	DrawBlock temp, 260, 0

	Flip

Wend
End


@Arctic Fox, you can use copybank to move large amounts of pixel data from a bank to an imagebuffer or the backbuffer.