Skip to main content

Module buffer

Module buffer 

Source
Expand description

Opaque pixel buffer abstraction.

Provides format-aware pixel storage that carries its own metadata: PixelBuffer (owned), PixelSlice (borrowed, immutable), and PixelSliceMut (borrowed, mutable).

These types track pixel format via PixelDescriptor and color context via ColorContext.

Typed variants (e.g., PixelBuffer<Rgb<u8>>) enforce format correctness at compile time through the Pixel trait. Use erase() to convert to a type-erased form, or try_typed() to go back.

For format conversions (e.g., convert_to, to_rgb8), see the zenpixels-convert crate which provides PixelBufferConvertExt.

Structs§

Bgrx
32-bit BGR pixel with padding byte (BGRx).
InPlacePixels
Everything a layout-changing in-place transform receives from PixelBuffer::transform_in_place: the buffer’s backing bytes (from the aligned base, including stride padding) plus its current description. Plain data — constructible directly (e.g. by transform unit tests exercising arbitrary strides); the staleness protection lives in transform_in_place’s atomic adoption, not here.
PixelBuffer
Owned pixel buffer with format metadata.
PixelSlice
Borrowed view of pixel data.
PixelSliceMut
Mutable borrowed view of pixel data.
Rgbx
32-bit RGB pixel with padding byte (RGBx).

Enums§

BufferError
Errors from pixel buffer operations.

Traits§

Pixel
Compile-time pixel format descriptor.