[−][src]Struct etagere::BucketedAtlasAllocator
A faster but less precise Shelf-packing dynamic texture atlas allocator, inspired by https://github.com/mapbox/shelf-pack/
Items are accumulated into buckets which are laid out in rows (shelves) of variable height. When allocating we first look for a suitable bucket. If none is found, a new shelf of the desired height is pushed.
Lifetime isn't tracked at item granularity. Instead, items are grouped into buckets and deallocation happens per bucket when all items of the buckets are removed. When the top-most shelf is empty, it is removed, potentially cascading into garbage-collecting the next shelf, etc.
This allocator works well when there are a lot of small items with similar sizes (typically, glyph atlases).
Implementations
impl BucketedAtlasAllocator
[src]
pub fn with_options(size: Size, options: &AllocatorOptions) -> Self
[src]
Create an atlas allocator with provided options.
pub fn new(size: Size) -> Self
[src]
Create an atlas allocator with default options.
pub fn clear(&mut self)
[src]
pub fn size(&self) -> Size
[src]
pub fn is_empty(&self) -> bool
[src]
pub fn allocate(&mut self, requested_size: Size) -> Option<Allocation>
[src]
Allocate a rectangle in the atlas.
pub fn deallocate(&mut self, id: AllocId)
[src]
Deallocate a rectangle in the atlas.
Space is only reclaimed when all items of the same bucket are deallocated.
pub fn dump_svg(&self, output: &mut dyn Write) -> Result<()>
[src]
Dump a visual representation of the atlas in SVG format.
pub fn dump_into_svg(
&self,
rect: Option<&Rectangle>,
output: &mut dyn Write
) -> Result<()>
[src]
&self,
rect: Option<&Rectangle>,
output: &mut dyn Write
) -> Result<()>
Dump a visual representation of the atlas in SVG, omitting the beginning and end of the SVG document, so that it can be included in a larger document.
If a rectangle is provided, translate and scale the output to fit it.
Trait Implementations
impl Clone for BucketedAtlasAllocator
[src]
pub fn clone(&self) -> BucketedAtlasAllocator
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for BucketedAtlasAllocator
impl Send for BucketedAtlasAllocator
impl Sync for BucketedAtlasAllocator
impl Unpin for BucketedAtlasAllocator
impl UnwindSafe for BucketedAtlasAllocator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,