Skip to content

CopyPixel

Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions

Blitz3DBlitzPlusBlitzBasic

CopyPixel

CopyPixel:Void src_x:Int32, src_y:Int32, src_buffer:Int32, dest_x:Int32, dest_y:Int32, dest_buffer:Int32=0
Parameter Mode Type Default Description
src_x In Int32 required Horizontal position of the pixel to copy.
src_y In Int32 required Vertical position of the pixel to copy.
src_buffer In Int32 required The buffer to copy from.
dest_x In Int32 required Horizontal position to copy to.
dest_y In Int32 required Vertical position to copy to.
dest_buffer In Int32 0 The buffer to copy to. Defaults to the current buffer.

Description

Copies one pixel from a buffer to another, or inside the same buffer. Each call has to work out where both pixels are, so for many pixels lock the buffers and use CopyPixelFast.

Differences

  • A source pixel outside of its buffer is read as 0 (black), and a destination outside its buffer is skipped.
  • Pixels are copied with all the bits that the buffers have: a buffer made by Graphics3D with the depth 64 does not lose anything on the way. See Color depth.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Cls
Color 255, 0, 0
Rect 0, 0, 20, 20, 1
For i = 0 To 19
	CopyPixel i, i, BackBuffer(), 100 + i, 50, BackBuffer()
Next
Flip
WaitKey

Related Commands

CopyPixelFast, CopyRect, ReadPixel, ReadPixelFast, ReadPixelFast64 〔BlitzLLVM〕, WritePixel, WritePixelFast, WritePixelFast64 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally