pub struct ImageFile {
pub id: ImageId,
pub bytes: Vec<u8>,
pub width: u32,
pub height: u32,
pub pixels: Arc<Vec<u8>>,
pub pixels_width: u32,
pub pixels_height: u32,
}Expand description
A decoded image file: its bytes, its own size, and the pixels it is drawn
from — the file’s own, or resampled to at most MAX_IMAGE_SIDE a side.
Fields§
§id: ImageId§bytes: Vec<u8>§width: u32The file’s size in pixels: what an Image hugs by.
height: u32§pixels: Arc<Vec<u8>>Straight-alpha RGBA, pixels_width × pixels_height.
pixels_width: u32§pixels_height: u32Implementations§
Source§impl ImageFile
impl ImageFile
Sourcepub fn new(bytes: Vec<u8>) -> Result<ImageFile, String>
pub fn new(bytes: Vec<u8>) -> Result<ImageFile, String>
Decodes bytes, a PNG or JPEG file, or says why it can’t.
Sourcepub fn with_id(id: ImageId, bytes: Vec<u8>) -> Result<ImageFile, String>
pub fn with_id(id: ImageId, bytes: Vec<u8>) -> Result<ImageFile, String>
Decodes bytes, already known to be the file id.
Sourcepub fn image_data(&self) -> ImageData
pub fn image_data(&self) -> ImageData
The pixels as an image for one drawing to paint, under a blob of its
own that shares the pixels: see render::Renderer::drawing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageFile
impl RefUnwindSafe for ImageFile
impl Send for ImageFile
impl Sync for ImageFile
impl Unpin for ImageFile
impl UnsafeUnpin for ImageFile
impl UnwindSafe for ImageFile
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