What is more faster ...

Blitz3D Forums/Blitz3D Programming/What is more faster ...

Little correction with lockbuffer and read/write operation

Graphics3D 800,600,32,2
SetBuffer BackBuffer()
Global nicolas

nicolas = CreateImage(512,512)

bk = CreateBank(512*512*4)

colorrgb = 210 Or (100 Shl 8) Or (10 Shl 16)

start = MilliSecs()
LockBuffer ImageBuffer(nicolas)
For x=1 To 512
For y=1 To 512
test=ReadPixelFast ( x,y,ImageBuffer(nicolas))
WritePixelFast x,y,colorrgb,ImageBuffer(nicolas)
Next
Next
UnlockBuffer ImageBuffer(nicolas)
Print MilliSecs()-start


start = MilliSecs()
For y=0 To 511
For x=0 To 511
test=PeekInt (bk,(y*512+x )*4)
PokeInt bk,(y*512+x )*4,colorrgb
Next
Next
Print MilliSecs()-start



WaitKey()