pub struct GlyphAtlas {
pub allocator: BucketedAtlasAllocator,
pub pixels: Vec<u8>,
pub width: u32,
pub height: u32,
pub dirty: bool,
}Fields§
§allocator: BucketedAtlasAllocator§pixels: Vec<u8>§width: u32§height: u32§dirty: boolImplementations§
Source§impl GlyphAtlas
impl GlyphAtlas
pub fn new() -> Self
Sourcepub fn allocate(&mut self, width: u32, height: u32) -> Option<Allocation>
pub fn allocate(&mut self, width: u32, height: u32) -> Option<Allocation>
Allocate a region for a glyph of width×height pixels. The
returned allocation reserves a 1-pixel gutter on the right and
bottom so adjacent glyphs can’t bleed into each other under
float-precision UV rounding. Callers still blit only the
requested width×height pixels at rect.min; the extra
column/row of transparent pixels is the safety margin.
pub fn deallocate(&mut self, id: AllocId)
Sourcepub fn blit_rgba(&mut self, x: u32, y: u32, w: u32, h: u32, data: &[u8])
pub fn blit_rgba(&mut self, x: u32, y: u32, w: u32, h: u32, data: &[u8])
Blit RGBA pixel data into the atlas at the given position.
Sourcepub fn debug_poison_rect(&mut self, x: u32, y: u32, w: u32, h: u32)
pub fn debug_poison_rect(&mut self, x: u32, y: u32, w: u32, h: u32)
Fill a rectangle with solid magenta and mark the atlas dirty.
Debug-build aid: called (under cfg(debug_assertions)) for every
rectangle freed by glyph eviction, so any consumer still sampling
the freed region — i.e. a retained quad whose UVs were never
invalidated — renders unmissable magenta blocks instead of subtly
wrong glyphs. Always compiled so tests can exercise it directly.