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 id(&self) -> u64
pub fn id(&self) -> u64
Content-derived bitmap identity used by renderer caches. Each frame
of an ExternalTexture has its own id.
Sourcepub fn storage_id(&self) -> u64
pub fn storage_id(&self) -> u64
Identity of the bitmap’s storage: the same for every frame of an
ExternalTexture, equal to Self::id for pixel bitmaps.
Sourcepub fn external_handle<T>(&self) -> Option<&T>where
T: 'static,
pub fn external_handle<T>(&self) -> Option<&T>where
T: 'static,
The renderer handle of an ExternalTexture frame, when it is a T.
Sourcepub fn pixels(&self) -> &[u8] ⓘ
pub fn pixels(&self) -> &[u8] ⓘ
Returns the raw pixel bytes in Self::format, empty for an
ExternalTexture frame.
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;
transparent for an ExternalTexture frame.
§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; empty for an ExternalTexture frame.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more