Skip to content

WritePixel

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

Blitz3DBlitzPlusBlitzBasic

WritePixel

WritePixel: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 buffer to write to. Defaults to the current buffer.

Description

Sets a pixel of a buffer to a color given as an ARGB number, for example (red Shl 16) Or (green Shl 8) Or blue. This works without a lock, but each call is slow. Lock the buffer and use WritePixelFast for many pixels.

Differences

  • A position outside of the buffer is ignored.
  • A buffer that Graphics3D made with the depth 30 takes A2R10G10B10 (2 bits of alpha on top, then 10 for each of red, green and blue), and one with 64 takes ARGB with 8 bits for each, which is widened. WritePixel64 takes Float16 channels. See Color depth.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Cls
For i = 0 To 255
	WritePixel 32 + i, 120, (i Shl 16) Or ((255 - i) Shl 8) Or 128
Next
Flip
WaitKey

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally