pub struct ImageCache { /* private fields */ }Expand description
Manages image resources for the renderer.
Implementations§
Source§impl ImageCache
impl ImageCache
Sourcepub fn new_with_config(config: AtlasConfig) -> ImageCache
pub fn new_with_config(config: AtlasConfig) -> ImageCache
Create a new image cache with custom atlas configuration.
Sourcepub fn new_dummy() -> ImageCache
pub fn new_dummy() -> ImageCache
Create a new dummy image atlas that is supposed to act as a stub.
Sourcepub fn get(&self, id: ImageId) -> Option<&ImageResource>
pub fn get(&self, id: ImageId) -> Option<&ImageResource>
Get an image resource by its Id.
Sourcepub fn allocate(
&mut self,
width: u32,
height: u32,
padding: u16,
) -> Result<ImageId, AtlasError>
pub fn allocate( &mut self, width: u32, height: u32, padding: u16, ) -> Result<ImageId, AtlasError>
Allocate an image in the cache, with optional transparent padding.
Sourcepub fn allocate_excluding(
&mut self,
width: u32,
height: u32,
padding: u16,
exclude_atlas_id: Option<AtlasId>,
) -> Result<ImageId, AtlasError>
pub fn allocate_excluding( &mut self, width: u32, height: u32, padding: u16, exclude_atlas_id: Option<AtlasId>, ) -> Result<ImageId, AtlasError>
Allocate an image in the cache, with optional transparency padding and optionally excluding a specific atlas.
Sourcepub fn deallocate(&mut self, id: ImageId) -> Option<ImageResource>
pub fn deallocate(&mut self, id: ImageId) -> Option<ImageResource>
Deallocate an image from the cache, returning the image resource if it existed.
Sourcepub fn atlas_manager(&self) -> &MultiAtlasManager
pub fn atlas_manager(&self) -> &MultiAtlasManager
Get access to the atlas manager.
Sourcepub fn atlas_count(&self) -> usize
pub fn atlas_count(&self) -> usize
Get the number of atlases.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageCache
impl RefUnwindSafe for ImageCache
impl Send for ImageCache
impl Sync for ImageCache
impl Unpin for ImageCache
impl UnsafeUnpin for ImageCache
impl UnwindSafe for ImageCache
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