pub struct ImageBitmap { /* private fields */ }Expand description
Immutable image data used by UI primitives and render backends.
Implementations§
Source§impl ImageBitmap
impl ImageBitmap
Sourcepub fn from_rgba8(
width: u32,
height: u32,
pixels: Vec<u8>,
) -> Result<ImageBitmap, ImageBitmapError>
pub fn from_rgba8( width: u32, height: u32, pixels: Vec<u8>, ) -> Result<ImageBitmap, ImageBitmapError>
Creates a bitmap by taking ownership of tightly packed RGBA8 pixels. Any spare capacity in the pixel buffer is released.
Sourcepub fn from_rgba8_slice(
width: u32,
height: u32,
pixels: &[u8],
) -> Result<ImageBitmap, ImageBitmapError>
pub fn from_rgba8_slice( width: u32, height: u32, pixels: &[u8], ) -> Result<ImageBitmap, ImageBitmapError>
Copies tightly packed RGBA8 pixels into a new bitmap.
Sourcepub fn from_alpha8(
width: u32,
height: u32,
color: [u8; 3],
alpha: Vec<u8>,
) -> Result<ImageBitmap, ImageBitmapError>
pub fn from_alpha8( width: u32, height: u32, color: [u8; 3], alpha: Vec<u8>, ) -> Result<ImageBitmap, ImageBitmapError>
Takes ownership of one alpha byte per pixel with a constant RGB color. Any spare capacity in the alpha buffer is released.
Sourcepub fn pixels(&self) -> &[u8] ⓘ
pub fn pixels(&self) -> &[u8] ⓘ
Returns the raw pixel bytes in Self::format.
Sourcepub fn format(&self) -> ImagePixelFormat
pub fn format(&self) -> ImagePixelFormat
Returns the storage format of Self::pixels.
Sourcepub fn rgba8_pixel(&self, index: usize) -> [u8; 4]
pub fn rgba8_pixel(&self, index: usize) -> [u8; 4]
Returns the unpremultiplied RGBA8 pixel at a row-major index.
§Panics
Panics when index is outside the image.
Sourcepub fn rgba8_pixels(&self) -> Cow<'_, [u8]>
pub fn rgba8_pixels(&self) -> Cow<'_, [u8]>
Returns tightly packed RGBA8 bytes, borrowing RGBA images and expanding alpha masks.
Sourcepub fn intrinsic_size(&self) -> Size
pub fn intrinsic_size(&self) -> Size
Returns intrinsic size in logical units.
Trait Implementations§
Source§impl Clone for ImageBitmap
impl Clone for ImageBitmap
Source§fn clone(&self) -> ImageBitmap
fn clone(&self) -> ImageBitmap
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageBitmap
impl Debug for ImageBitmap
impl Eq for ImageBitmap
Source§impl From<ImageBitmap> for Painter
impl From<ImageBitmap> for Painter
Source§fn from(value: ImageBitmap) -> Self
fn from(value: ImageBitmap) -> Self
Converts to this type from the input type.
Source§impl Hash for ImageBitmap
impl Hash for ImageBitmap
Source§impl PartialEq for ImageBitmap
impl PartialEq for ImageBitmap
Source§impl RenderHash for ImageBitmap
impl RenderHash for ImageBitmap
fn render_hash(&self) -> u64
Auto Trait Implementations§
impl Freeze for ImageBitmap
impl RefUnwindSafe for ImageBitmap
impl Send for ImageBitmap
impl Sync for ImageBitmap
impl Unpin for ImageBitmap
impl UnsafeUnpin for ImageBitmap
impl UnwindSafe for ImageBitmap
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