pub struct Image { /* private fields */ }Expand description
A tree-compatible image widget that blits a PNG file or bytes onto the canvas.
Wraps crate::ImageWidget as a Widget so it can be used as a child
of Column, Row, Stack, etc.
Implementations§
Source§impl Image
impl Image
Sourcepub fn asset(name: impl AssetRef) -> Self
pub fn asset(name: impl AssetRef) -> Self
Create an image from a bundled asset by logical name — resolved
per-platform via rosace_core::asset (dev: assets/<name>; mobile:
the app bundle). Portable across platforms and hot-reloads under
rsc dev. Prefer this over file for shipped images.
Sourcepub fn placeholder(color: Color) -> Self
pub fn placeholder(color: Color) -> Self
Show a colored placeholder rectangle (no image data).
pub fn fit(self, f: ImageFit) -> Self
pub fn width(self, w: f32) -> Self
pub fn height(self, h: f32) -> Self
Trait Implementations§
Source§impl Widget for Image
impl Widget for Image
Source§fn layout(&self, _ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, _ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnsafeUnpin for Image
impl UnwindSafe for Image
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
Source§impl<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.