bmax to blitz3d acces writepixel

BlitzMax Forums/BlitzMax Programming/bmax to blitz3d acces writepixel

blitz3d 20 millisecs()
bmax 60 millisecs()

bmax is slowwww




you use a yourimage


Graphics 800,600,0

Local image:timage
Local x,y
Local pixmap:TPixmap


image=LoadImage:TImage("yourimage.jpg")

te=MilliSecs()

pixmap=LockImage(image)
For y=0 Until image.height
For x=0 Until image.width

argb=-Rnd(160000)-1
WritePixel(pixmap,x,y,argb)

Next
Next


UnlockImage image

tempo=MilliSecs()-te

While Not KeyDown(key_escape)

DrawImage image,0,0


DrawText tempo,610,10


Flip

Wend
End



; example blitz3d
Graphics 800,600,0,2
SetBuffer BackBuffer()


image=LoadImage("yourimage.jpg")


te=MilliSecs()

SetBuffer ImageBuffer(image)
LockBuffer ImageBuffer(image)

For xx=0 To ImageWidth(image)-1
For yy=0 To ImageHeight(image)-1
WritePixelFast(xx,yy,Rnd(-65000)-5,ImageBuffer(image))
Next
Next

UnlockBuffer ImageBuffer(image)
SetBuffer BackBuffer()

tempo=MilliSecs()-te


While Not KeyDown(1)

DrawImage image,0,0


Text 610,10,tempo


Flip

Wend
End