pub struct RuntimeAtlas { /* private fields */ }Expand description
Runtime atlas with pixel data management.
This extends AtlasSession by managing actual pixel data in addition to geometry.
Useful for game engines that need to dynamically update GPU textures.
Implementations§
Source§impl RuntimeAtlas
impl RuntimeAtlas
Sourcepub fn new(cfg: PackerConfig, strategy: RuntimeStrategy) -> Self
pub fn new(cfg: PackerConfig, strategy: RuntimeStrategy) -> Self
Create a new runtime atlas with pixel data management.
Sourcepub fn with_background_color(self, color: Rgba<u8>) -> Self
pub fn with_background_color(self, color: Rgba<u8>) -> Self
Set the background color for new pages.
Sourcepub fn append_with_image(
&mut self,
key: String,
image: &RgbaImage,
) -> Result<(usize, Frame<String>, UpdateRegion)>
pub fn append_with_image( &mut self, key: String, image: &RgbaImage, ) -> Result<(usize, Frame<String>, UpdateRegion)>
Append a texture with its pixel data. Returns (page_id, frame, update_region).
Sourcepub fn append(
&mut self,
key: String,
w: u32,
h: u32,
) -> Result<(usize, Frame<String>)>
pub fn append( &mut self, key: String, w: u32, h: u32, ) -> Result<(usize, Frame<String>)>
Append a texture by dimensions only (no pixel data). Returns (page_id, frame).
Sourcepub fn evict_with_clear(
&mut self,
page_id: usize,
key: &str,
clear: bool,
) -> Option<UpdateRegion>
pub fn evict_with_clear( &mut self, page_id: usize, key: &str, clear: bool, ) -> Option<UpdateRegion>
Evict a texture and optionally clear its region. Returns the region that was cleared (if clear=true).
Sourcepub fn evict_by_key_with_clear(
&mut self,
key: &str,
clear: bool,
) -> Option<UpdateRegion>
pub fn evict_by_key_with_clear( &mut self, key: &str, clear: bool, ) -> Option<UpdateRegion>
Evict a texture by key and optionally clear its region.
Sourcepub fn get_page_image(&self, page_id: usize) -> Option<&RgbaImage>
pub fn get_page_image(&self, page_id: usize) -> Option<&RgbaImage>
Get a reference to the pixel data of a page.
Sourcepub fn get_page_image_mut(&mut self, page_id: usize) -> Option<&mut RgbaImage>
pub fn get_page_image_mut(&mut self, page_id: usize) -> Option<&mut RgbaImage>
Get a mutable reference to the pixel data of a page.
pub fn get_frame(&self, key: &str) -> Option<(usize, &Frame<String>)>
pub fn contains(&self, key: &str) -> bool
pub fn keys(&self) -> Vec<&str>
pub fn texture_count(&self) -> usize
pub fn stats(&self) -> RuntimeStats
pub fn snapshot_atlas(&self) -> Atlas<String>
Auto Trait Implementations§
impl Freeze for RuntimeAtlas
impl RefUnwindSafe for RuntimeAtlas
impl Send for RuntimeAtlas
impl Sync for RuntimeAtlas
impl Unpin for RuntimeAtlas
impl UnwindSafe for RuntimeAtlas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more