pub struct SceneImage {
pub pixmap: Pixmap,
pub object_fit: ObjectFit,
}Expand description
Image resource inside a scene (self-contained RGBA8 bitmap).
Holds an already-decoded pixel bitmap (crate::Pixmap); lievisual does not decode —
decoding is the caller’s / resource-loading layer’s responsibility. frame (given in
Element::Image) is the display area; object_fit decides how the image maps onto frame.
Fields§
§pixmap: PixmapDecoded RGBA8 bitmap.
object_fit: ObjectFitFit mode.
Implementations§
Source§impl SceneImage
impl SceneImage
Sourcepub fn from_pixmap(pixmap: Pixmap) -> Self
pub fn from_pixmap(pixmap: Pixmap) -> Self
Construct from an already-decoded RGBA8 bitmap (default object_fit = Contain).
Sourcepub fn from_rgba8(
width: u32,
height: u32,
pixels: impl Into<Arc<[u8]>>,
) -> Option<Self>
pub fn from_rgba8( width: u32, height: u32, pixels: impl Into<Arc<[u8]>>, ) -> Option<Self>
Convenience: build a bitmap from RGBA8 pixels (default object_fit = Contain).
The length must be 4 * width * height, otherwise None is returned.
Sourcepub fn from_png(bytes: &[u8]) -> Option<Self>
pub fn from_png(bytes: &[u8]) -> Option<Self>
Convenience: decode from PNG bytes (png is a permanent dependency). Returns None
for non-PNG input or decode failure.
Sourcepub fn with_object_fit(self, fit: ObjectFit) -> Self
pub fn with_object_fit(self, fit: ObjectFit) -> Self
Set the fit mode.
Sourcepub fn preserve_aspect_ratio(&self) -> &'static str
pub fn preserve_aspect_ratio(&self) -> &'static str
The preserveAspectRatio fragment (without prefix) used for SVG output.
None together with "none" plus the raw pixel width/height on the SVG side
achieves “no scaling, top-left”.
Trait Implementations§
Source§impl Clone for SceneImage
impl Clone for SceneImage
Source§fn clone(&self) -> SceneImage
fn clone(&self) -> SceneImage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more