#[non_exhaustive]pub enum JsImage {
#[non_exhaustive] Path(PathBuf),
#[non_exhaustive] Bytes(Vec<u8>),
#[non_exhaustive] Resource(ResourceId),
#[non_exhaustive] Rgba {
rgba: Vec<u8>,
width: u32,
height: u32,
},
}Expand description
An image type that accepts file paths, raw bytes, previously loaded images and image objects.
This type is meant to be used along the transformImage API.
§Stability
The stability of the variants are not guaranteed, and matching against them is not recommended.
Use JsImage::into_img instead.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
#[non_exhaustive]Path(PathBuf)
A reference to a image in the filesystem.
#[non_exhaustive]Bytes(Vec<u8>)
Image from raw bytes.
#[non_exhaustive]Resource(ResourceId)
An image that was previously loaded with the API and is stored in the resource table.
#[non_exhaustive]Rgba
Raw RGBA definition of an image.
Fields
This variant is marked as non-exhaustive
Implementations§
Source§impl JsImage
impl JsImage
Sourcepub fn into_img(self, resources_table: &ResourceTable) -> Result<Arc<Image<'_>>>
pub fn into_img(self, resources_table: &ResourceTable) -> Result<Arc<Image<'_>>>
Converts this intermediate image format into an actual Image.
This will retrieve the image from the passed ResourceTable if it is JsImage::Resource
and will return an error if it doesn’t exist in the passed ResourceTable so make sure
the passed ResourceTable is the same one used to store the image, usually this should be
the webview resources table.