#[non_exhaustive]pub enum Image {
None,
StaticArgb {
argb: &'static [u8],
width: usize,
},
}Expand description
An image, as held by properties of the image type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
None
No image, the value of an image property without one.
StaticArgb
An image decoded at compile time into a static array of packed bytes.
Bytes rather than Color values so that the generated code can
carry the image in a byte-string literal, which parses much faster
than an array of per-pixel constructor calls.
Implementations§
Source§impl Image
impl Image
Sourcepub const fn width(self) -> usize
pub const fn width(self) -> usize
The width in pixels. An Image::None has a width of 0.
use slint_sc::Image;
assert_eq!(Image::None.width(), 0);
let image = Image::StaticArgb { argb: &[0x80; 24], width: 3 };
assert_eq!(image.width(), 3);Sourcepub const fn height(self) -> usize
pub const fn height(self) -> usize
The height in pixels, derived from the pixel count and the width: an
incomplete last pixel or row is not counted. An Image::None, and
an Image::StaticArgb with a width of 0, have a height of 0.
use slint_sc::Image;
assert_eq!(Image::None.height(), 0);
let image = Image::StaticArgb { argb: &[0x80; 24], width: 3 };
assert_eq!(image.height(), 2);Trait Implementations§
impl Copy for Image
impl Eq for Image
impl StructuralPartialEq for Image
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
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