pub struct Context { /* private fields */ }
Expand description
Bundle of a Packer
and a Dictionary
Implementations§
Source§impl Context
impl Context
Sourcepub fn pack(&mut self, path: &PathBuf, gap: u32) -> Option<Rect>
pub fn pack(&mut self, path: &PathBuf, gap: u32) -> Option<Rect>
Packs image loaded from the provided path
into the packer with the provided gap
and
records it into the dictionary. Returns the rect
the texture was packed in if successful
Sourcepub fn save_to_file(
&self,
name: &str,
image: ImageFormat,
dict: Option<DictionaryFormat>,
) -> Result<()>
pub fn save_to_file( &self, name: &str, image: ImageFormat, dict: Option<DictionaryFormat>, ) -> Result<()>
Saves both the packer and the dictionary to a file with given name
, image
format and
dictionary
format. If dictionary is None
then the dictionary is not serialized
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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> 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