ReadPixelFast pb

BlitzPlus Forums/BlitzPlus Programming/ReadPixelFast pb

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.

WritePixelFast seems to work but if I use ReadPixelFast instead of ReadPixel my sprite is purple block! Why?

Graphics(800,600,0,2)
SetBuffer BackBuffer()

img=LoadImage("sprite200x180.jpg")
img_buf=ImageBuffer(img)


While Not KeyHit(1)
	x=MouseX()
	y=MouseY()
	Cls
	LockBuffer()
	For j=0 To 179
		For i=0 To 199
			c=ReadPixel(i,j,img_buf)
			WritePixelFast(x+i,y+j,c)	
		Next
	Next
	UnlockBuffer()
	Flip()
Wend

FreeImage(img)