; dxReadPixelFast/WritePixeFast Example ; ----------------------------------- Graphics 640,480,16 dxPrint "Press a key to read dxColor values" dxWaitKey() ; Load and draw an image on to the screen - can be anything pic=LoadImage("media/blitz_pic.bmp") DrawImage pic,0,0 ; Initialise an array big enough to fit all the dxColor information of the screen Dim pix(dxGraphicsWidth(),dxGraphicsHeight()) ; Lock buffer before using dxReadPixelFast dxLockBuffer ; Use dxReadPixel to get all the dxColor information of the screen For y=0 To dxGraphicsHeight() For x=0 To dxGraphicsWidth() pix(x,y)=dxReadPixelFast(x,y) Next Next ; Lock buffer after using dxReadPixelFast dxUnLockBuffer dxCls dxLocate 0,0 dxPrint "Press a key to dxWrite pixels" dxPrint "Once this has finished, you can then press a key to end the program" dxWaitKey() ; Lock buffer before using dxWritePixelFast dxLockBuffer ; Use dxWritePixel to redraw the screen using the dxColor information we got earlier For y=0 To dxGraphicsHeight() For x=0 To dxGraphicsWidth() dxWritePixelFast x,y,pix(x,dxGraphicsHeight()-y) ; get y array value in backwards order, to dxFlip screen Next Next ; Unlock buffer after using dxWritePixelFast dxUnLockBuffer dxWaitKey()