UIng::ImageBuffer
Inherits UIng::BlockConstructor < Reference < Object
A mutable, fixed-resolution RGBA image. All native operations must run on the UI thread between UIng.init and UIng.uninit. Call free explicitly or use open; native resources are not released by a GC finalizer. Requires ImageBuffer-capable libui-ng (dev da49cf29 or later), included in the release pinned in download.cr.
Constructors
Creates and fills a buffer. NRGBA/NRGBA64 use straight alpha; other image types use premultiplied alpha. An explicit format overrides that choice.
Class methods
Always frees the buffer, including on exceptions; returns the block value. Keep the event loop inside the block when callbacks refer to this buffer.
Keeps the event loop inside the block and frees the buffer on every exit.
Instance methods
Copies a CrImage image with matching dimensions. Alpha representation and stride are adapted to this buffer's format. Does not request a redraw.
Copies the input before return. Final-row padding is optional. Straight RGBA is premultiplied natively; premultiplied input requires R, G, B <= A. Updates do not request a redraw; call Area#queue_redraw_all as needed.
pixels starts at the patch's top-left pixel. The rectangle must fit fully inside this buffer; pixels outside it are preserved, without compositing.
Copies the entire patch at destination (x, y), using its visible bounds for the patch dimensions. Pixels outside the destination are preserved.