pub enum IndexedWrapper {
Static(IndexedImage),
Animated(AnimatedIndexedImage),
}
Expand description
Store static or animated images in a generic way
Supports most methods
Variants§
Static(IndexedImage)
Animated(AnimatedIndexedImage)
Implementations§
Source§impl IndexedWrapper
impl IndexedWrapper
Sourcepub fn set_palette(
&mut self,
palette: &[Color],
) -> Result<(), IndexedImageError>
pub fn set_palette( &mut self, palette: &[Color], ) -> Result<(), IndexedImageError>
Replace palette for image Will only return an error if the new palette has fewer colors than the image needs
Sourcepub fn set_palette_replace_id(
&mut self,
palette: &[Color],
id: u8,
) -> Result<(), IndexedImageError>
pub fn set_palette_replace_id( &mut self, palette: &[Color], id: u8, ) -> Result<(), IndexedImageError>
Replace palette for image, any pixels outside the new palette will be replaced with id
Will only return an error if id is outside the new palette
Sourcepub fn set_palette_replace_color<C>(&mut self, palette: &[Color], color: C)
pub fn set_palette_replace_color<C>(&mut self, palette: &[Color], color: C)
Replace palette for image, any color indexes outside the palette will be expanded with color
pub fn size(&self) -> (u8, u8)
pub fn get_pixels(&self) -> &[u8] ⓘ
pub fn get_pixel_index(&self, x: u8, y: u8) -> Result<usize, IndexedImageError>
pub fn get_color(&self, idx: u8) -> Result<Color, IndexedImageError>
pub fn set_color( &mut self, idx: u8, color: Color, ) -> Result<(), IndexedImageError>
pub fn get_palette(&self) -> &[Color]
pub fn min_palette_size_supported(&self) -> u8
pub fn width(&self) -> u8
pub fn height(&self) -> u8
pub fn update(&mut self, delta: f64)
pub fn reset(&mut self)
pub fn set_animate(&mut self, animate: bool)
pub fn animating(&self) -> bool
pub fn frame_count(&self) -> u8
pub fn is_animation(&self) -> bool
Trait Implementations§
Source§impl Clone for IndexedWrapper
impl Clone for IndexedWrapper
Source§fn clone(&self) -> IndexedWrapper
fn clone(&self) -> IndexedWrapper
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for IndexedWrapper
impl Debug for IndexedWrapper
Source§impl From<AnimatedIndexedImage> for IndexedWrapper
impl From<AnimatedIndexedImage> for IndexedWrapper
Source§fn from(value: AnimatedIndexedImage) -> IndexedWrapper
fn from(value: AnimatedIndexedImage) -> IndexedWrapper
Converts to this type from the input type.
Source§impl From<IndexedImage> for IndexedWrapper
impl From<IndexedImage> for IndexedWrapper
Source§fn from(value: IndexedImage) -> IndexedWrapper
fn from(value: IndexedImage) -> IndexedWrapper
Converts to this type from the input type.
Source§impl PartialEq for IndexedWrapper
impl PartialEq for IndexedWrapper
impl StructuralPartialEq for IndexedWrapper
Auto Trait Implementations§
impl Freeze for IndexedWrapper
impl RefUnwindSafe for IndexedWrapper
impl Send for IndexedWrapper
impl Sync for IndexedWrapper
impl Unpin for IndexedWrapper
impl UnwindSafe for IndexedWrapper
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.