Expand description
Contiguous framebuffer surfaces for strat9.
This crate is the single internal API for pixel buffers: one geometry
type, one pixel format, one damage model, one clipping rule. It has no OS
dependency (and no allocator unless you use OwnedSurface), so it
builds for the kernel and runs its tests on the host:
cargo test -p fbsurface§Layers
| Type | Role |
|---|---|
Dims, Rect, RectSet | geometry and damage, no pixel knowledge |
Format, Packed, Rgb | native layout and one explicit conversion point |
PixelOps, ScalarOps | raw 32-bit primitives, monomorphised |
Canvas | validated surface: fill, blit, blend, convert, damage |
View, Source | read-only surface and the sealed copy source |
OwnedSurface | heap 32 bpp back buffer with persistent damage |
Canvas borrows caller memory or points at MMIO; OwnedSurface owns a
Vec<u32> and builds a temporary Canvas for each drawing call, which
keeps the borrow checker in charge of the storage lifetime.
The kernel adapter lives in strat9-kernel’s framebuffer::surface:
it implements PixelOps over the existing SSE2 backend and returns an
FPU guard from every drawing call. Nothing in this crate knows about
interrupts, locks or physical memory.
§What is deliberately absent
No text, fonts, widgets, Z-order, windows or presentation policy. No
trait objects: the storage is a pointer plus a pitch, and the backend is
a type parameter. No implicit allocation (except OwnedSurface) and no
implicit format conversion: Canvas::blit refuses mismatched layouts,
and Canvas::convert_from is the one place that re-encodes pixels.
Re-exports§
pub use canvas::Canvas;pub use canvas::Error;pub use format::Format;pub use format::Packed;pub use format::Rgb;pub use geom::Dims;pub use geom::Rect;pub use geom::RectSet;pub use geom::DEFAULT_SET_CAPACITY;pub use ops::blend_word;pub use ops::NoGuard;pub use ops::PixelGuard;pub use ops::PixelOps;pub use ops::ScalarOps;pub use owned::OwnedSurface;pub use view::Source;pub use view::View;
Modules§
- canvas
- The surface type: a validated, contiguous rectangle of pixels.
- format
- Pixel formats and the packed-pixel newtype.
- geom
- Pure geometry: sizes, rectangles and bounded rectangle sets.
- ops
- Low-level 32-bit pixel primitives.
- owned
- Heap-backed surfaces.
- view
- Read-only surfaces, and the sealed source trait used by bulk copies.
Constants§
- MAX_
RECTS - Maximum number of damage rectangles tracked by default.