Skip to content

WritePixelFast

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

Blitz3DBlitzPlusBlitzBasic

WritePixelFast

WritePixelFast:Void x:Int32, y:Int32, argb:Int32, buffer:Int32=0
Parameter Mode Type Default Description
x In Int32 required Horizontal position of the pixel.
y In Int32 required Vertical position of the pixel.
argb In Int32 required The color. Only the lower 24 bits are used; the pixel is always opaque.
buffer In Int32 0 The locked buffer to write to. Defaults to the current buffer.

Description

Sets a pixel of a locked buffer. The buffer has to be locked with LockBuffer first and the result shows after UnlockBuffer.

Differences

  • A buffer that is not locked is ignored by a build without -d, and stops a debug build (-d) with an error message. A position outside of the buffer is ignored instead of writing into other memory.
  • A buffer that Graphics3D made with the depth 30 takes A2R10G10B10, and one with 64 takes ARGB with 8 bits for each. WritePixelFast64 takes all 64 bits. See Color depth.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local n = 0
While n < 20
	LockBuffer BackBuffer()
	For y = 0 To 239
		For x = 0 To 319
			Local v = (((x + n * 4) / 40) Mod 2) Xor ((y / 40) Mod 2)
			If v Then WritePixelFast x, y, $FF8000 Else WritePixelFast x, y, $2040A0
		Next
	Next
	UnlockBuffer BackBuffer()
	Flip
	n = n + 1
Wend

Media

WritePixelFast

Related Commands

CopyPixel, CopyPixelFast, ReadPixel, ReadPixelFast, ReadPixelFast64 〔BlitzLLVM〕, WritePixel, WritePixel64 〔BlitzLLVM〕, WritePixelFast64 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally