dxWritePixel(x%,y%,argb%,buffer%)

Parameters

x - y-coordinate of pixel
y - y-coordinate of pixel
argb - argb colour value of pixel (alpha, red, green, blue)
buffer (optional) - name of buffer to dxWrite colour value to, e.g. dxBackBuffer()

Description

Writes a dxColor value to either the current buffer or the specified buffer.

You can use this command on a locked buffer for a slight speed-up.

See also: dxPlot, dxWritePixelFast, dxLockBuffer.

Example

; dxReadPixel/dxWritePixel Example
; ----------------------------

Graphics 640,480,16

dxPrint "Press a key to read dxColor values (this may take a few seconds)"
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())

; Use dxReadPixel to get all the dxColor information of the screen
For y=0 To dxGraphicsHeight()
For x=0 To dxGraphicsWidth()
pix(x,y)=dxReadPixel(x,y)
Next
Next

dxCls
dxLocate 0,0
dxPrint "Press a key to dxWrite pixels (this may takes a few seconds)"
dxPrint "Once this has finished, you can then press a key to end the program"

dxWaitKey()

; Use dxWritePixel to redraw the screen using the dxColor information we got earlier
For y=0 To dxGraphicsHeight()
For x=0 To dxGraphicsWidth()
dxWritePixel x,y,pix(x,dxGraphicsHeight()-y) ; get y array value in backwards order, to dxFlip screen
Next
Next

dxWaitKey()

Index