Isn't it the rnd command that's quicker? Bmax writepixel seems quicker than writepixelfast as far as I can see.
<edit> Probably messed something up on the B3D side of things as it's been a while :
<edit> Probably messed something up on the B3D side of things as it's been a while :
SuperStrict Graphics 800,600,0 Local image:TImage = LoadImage("max.png") Local from_pixmap:tpixmap = LockImage(image) Local to_pixmap:tpixmap = CreatePixmap(PixmapWidth(from_pixmap) , PixmapHeight(from_pixmap) , PF_RGBA8888) ClearPixels(to_pixmap) Local t1:Int=MilliSecs() For Local x:Int = 0 To PixmapWidth(from_pixmap) - 1 For Local y:Int = 0 To PixmapHeight(from_pixmap) - 1 Local argb:Int = ReadPixel(from_pixmap , x , y) WritePixel(to_pixmap , x , y , argb) Next Next Local t2:Int=MilliSecs() DrawPixmap from_pixmap , 0 , 0 DrawPixmap to_pixmap , PixmapWidth(from_pixmap) , 0 DrawText (t2-t1),0,400 Flip WaitKey()
Graphics 800,600,0,2 Local image = LoadImage("max.png") Local image2=CreateImage(ImageWidth(image),ImageHeight(image)) Local t1=MilliSecs() SetBuffer ImageBuffer(image2) LockBuffer ImageBuffer(image) LockBuffer ImageBuffer(image2) t1=MilliSecs() For x=0 To ImageWidth(image) - 1 For y=0 To ImageHeight(image) - 1 argb = ReadPixelFast(x,y,ImageBuffer(image)) WritePixelFast(x,y, argb,ImageBuffer(image2)) Next Next t2=MilliSecs() UnlockBuffer ImageBuffer(image) UnlockBuffer ImageBuffer(image2) SetBuffer BackBuffer() DrawImage image,0,0 DrawImage image2,ImageWidth(image),0 Text 0,400,(t2-t1) Flip WaitKey()