pub struct PreloadedImageData {
pub data: Cow<'static, [u8]>,
pub width: u32,
pub height: u32,
pub id: String,
}Expand description
Preloaded decoded raster image data
Fields§
§data: Cow<'static, [u8]>The decoded image data in RGBA format with blended semi trsparent color. Make sure that if you submit the data directly it must be blended for semi transparent colors. Either a static slice or an owned vector. Povide a static slice that is pre-blended in case of static resource linking for rendering.
width: u32The width of image in pixels
height: u32The height of image in pixels
id: StringOriginal id used to resolve the image
Implementations§
Source§impl PreloadedImageData
impl PreloadedImageData
Sourcepub fn blend_rgba_slice(rgba_slice: &[u8]) -> Vec<u8> ⓘ
pub fn blend_rgba_slice(rgba_slice: &[u8]) -> Vec<u8> ⓘ
Converts raw rgba pixmap source to the rgba source with blended semi transparent colors.
Sourcepub fn new(id: String, width: u32, height: u32, rgba_data: &[u8]) -> Self
pub fn new(id: String, width: u32, height: u32, rgba_data: &[u8]) -> Self
Creates a new PreloadedImageData from the given rgba8 buffer and blends all the semi transparent colors.
Sourcepub fn new_blended(
id: String,
width: u32,
height: u32,
rgba_data: &'static [u8],
) -> Self
pub fn new_blended( id: String, width: u32, height: u32, rgba_data: &'static [u8], ) -> Self
Creates a new PreloadedImageData from the given rgba8 buffer
which is meant to be already blended for semi transparent colors.
You can use PreloadedImageData::blend_rgba_slice to blend the colors in advance.