# Command: CopyPixel

CopyPixel src_x,src_y,src_buffer,dest_x,dest_y,[dest_buffer] Definition:

Copys pixels from one image buffer to another.

Parameter Description:

src_x = x location of the source pixel to copy src_y = y location of the source pixel to copy src_buffer = buffer to copy from dest_x = x location to write pixel to dest_y = y location to write pixel to dest_buffer = optional

Command Description:

Use this to directly copy pixels from one buffer to another. You do not need to LockBuffer to use this command, but it will make the operations faster. Although fast, this command will not be fast enough to perform real-time screen effects.

Example:

; CopyPixel/CopyPixelFast commands
Graphics 640,480,16
; Draw a bunch of crap on the screen
For t= 1 To 1000
Color Rnd(255),Rnd(255),Rnd(255)
Rect Rnd(640),Rnd(480),Rnd(150),Rnd(150),Rnd(1)
Next
Delay 3000
; Copy the top half of the screen over the bottom half
; using fast pixels and locked buffers
For x = 1 To 640
For y = 1 To 240
LockBuffer FrontBuffer()
CopyPixelFast x,y,FrontBuffer(),x,y+241
UnlockBuffer FrontBuffer()
Next
Next
Delay 3000
; Draw the left half of the screen over the right half
; using the slower direct pixel access
For x = 1 To 320
For y = 1 To 480
CopyPixel x,y,FrontBuffer(),x+320,y
Next
Next

Index