Skip to content

LockedFormat

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

LockedFormat

LockedFormat:Int32 buffer:Int32=0
Parameter Mode Type Default Description
buffer In Int32 0 Locked buffer. Defaults to the current one.

Returns: A number that tells how the pixels are laid out: 1 is 16 bit with 5-6-5, 2 is 16 bit with 5-5-5, 3 is 24 bit and 4 is 32 bit with an unused byte.

Description

Says how the pixels of a locked buffer are stored. Lock the buffer first with LockBuffer.

Differences

  • Always 4, because every buffer here has four bytes for each pixel (blue first, then green, red and an unused byte). Code that handles the other formats still works, it just never runs.
  • 5 is A2R10G10B10 in 32 bits, which a buffer made by Graphics3D with the depth 30 has, and 6 is A16R16G16B16 in 64 bits, for the depth 64. They are BlitzLLVM additions. See Color depth.

Examples

Graphics 320, 240, 32, 2
win = CreateWindow("Format", 20, 20, 240, 150, Desktop(), 3)
cv  = CreateCanvas(10, 10, 200, 100, win)
buf = CanvasBuffer(cv)
LockBuffer buf
SetGadgetText win, "Format " + LockedFormat(buf) + ", pitch " + LockedPitch(buf)
UnlockBuffer buf
Repeat
Until WaitEvent() = $803

Related Commands

DesktopBuffer, FlipCanvas, LockedPitch, LockedPixels

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally