pub struct Handle { /* private fields */ }
Expand description
A handle of some image data.
Implementations§
source§impl Handle
impl Handle
sourcepub fn from_path<T: Into<PathBuf>>(path: T) -> Handle
pub fn from_path<T: Into<PathBuf>>(path: T) -> Handle
Creates an image Handle
pointing to the image of the given path.
Makes an educated guess about the image format by examining the data in the file.
sourcepub fn from_pixels(
width: u32,
height: u32,
pixels: impl AsRef<[u8]> + Send + Sync + 'static
) -> Handle
pub fn from_pixels( width: u32, height: u32, pixels: impl AsRef<[u8]> + Send + Sync + 'static ) -> Handle
Creates an image Handle
containing the image pixels directly. This
function expects the input data to be provided as a Vec<u8>
of RGBA
pixels.
This is useful if you have already decoded your image.
sourcepub fn from_memory(bytes: impl AsRef<[u8]> + Send + Sync + 'static) -> Handle
pub fn from_memory(bytes: impl AsRef<[u8]> + Send + Sync + 'static) -> Handle
Creates an image Handle
containing the image data directly.
Makes an educated guess about the image format by examining the given data.
This is useful if you already have your image loaded in-memory, maybe because you downloaded or generated it procedurally.
Trait Implementations§
source§impl PartialEq for Handle
impl PartialEq for Handle
impl Eq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
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