Enum termwiz::image::ImageDataType
source · [−]pub enum ImageDataType {
EncodedFile(Vec<u8>),
Rgba8 {
data: Vec<u8>,
width: u32,
height: u32,
hash: [u8; 32],
},
AnimRgba8 {
width: u32,
height: u32,
durations: Vec<Duration>,
frames: Vec<Vec<u8>>,
hashes: Vec<[u8; 32]>,
},
}
Variants
EncodedFile(Vec<u8>)
Data is in the native image file format (best for file formats that have animated content)
Rgba8
Data is RGBA u8 data
AnimRgba8
Data is an animated sequence
Implementations
sourceimpl ImageDataType
impl ImageDataType
pub fn new_single_frame(width: u32, height: u32, data: Vec<u8>) -> Self
pub fn hash_bytes(bytes: &[u8]) -> [u8; 32]
pub fn compute_hash(&self) -> [u8; 32]
sourcepub fn adjust_speed(&mut self, speed_factor: f32)
pub fn adjust_speed(&mut self, speed_factor: f32)
Divides the animation frame durations by the provided speed_factor, so a factor of 2 will halve the duration.
Panics
if the speed_factor is negative, non-finite or the result overflows the allow Duration range.
pub fn decode(self) -> Self
Trait Implementations
sourceimpl Clone for ImageDataType
impl Clone for ImageDataType
sourcefn clone(&self) -> ImageDataType
fn clone(&self) -> ImageDataType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ImageDataType
impl Debug for ImageDataType
sourceimpl<'de> Deserialize<'de> for ImageDataType
impl<'de> Deserialize<'de> for ImageDataType
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<ImageDataType> for ImageDataType
impl PartialEq<ImageDataType> for ImageDataType
sourcefn eq(&self, other: &ImageDataType) -> bool
fn eq(&self, other: &ImageDataType) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ImageDataType) -> bool
fn ne(&self, other: &ImageDataType) -> bool
This method tests for !=
.
sourceimpl Serialize for ImageDataType
impl Serialize for ImageDataType
impl Eq for ImageDataType
impl StructuralEq for ImageDataType
impl StructuralPartialEq for ImageDataType
Auto Trait Implementations
impl RefUnwindSafe for ImageDataType
impl Send for ImageDataType
impl Sync for ImageDataType
impl Unpin for ImageDataType
impl UnwindSafe for ImageDataType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more