ReadPixelFast pb

BlitzPlus Forums/BlitzPlus Programming/ReadPixelFast pb

Walter(Posted 2004) [#1]
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)



Walter(Posted 2004) [#2]
Oooppss, I know why. I forgot to lock also the image buffer :)Now it works fast


Panno(Posted 2004) [#3]
i dunno if u a german . but for all german`s here

ALL SINGING : Mein Gott Walter .....


ShadowTurtle(Posted 2004) [#4]
Mein Gott Walter. Da hat der Panno dich Panne gemacht. :)