Image
An image node from an ImageSource.
GUITUIRuns in the browser
imagePreview




Usage example
fn image_rgba_demo() -> NodeBuilder { let pixels: Vec<u8> = (0..32_u32 * 32) .flat_map(|i| { let shade = u8::try_from((i % 32) * 8).unwrap_or(u8::MAX); [shade, 120, 255 - shade, 255] }) .collect(); let frame = container().layout(LayoutStyle::flex_column().fill_width()); match image_rgba(32, 32, pixels) { Some(picture) => frame.child(picture), None => frame.child(text("image_rgba rejected").nowrap()), }}fn image_rgba_demo() -> NodeBuilder { let pixels: Vec<u8> = (0..32_u32 * 32) .flat_map(|i| { let shade = u8::try_from((i % 32) * 8) .unwrap_or(u8::MAX); [shade, 120, 255 - shade, 255] }) .collect(); let frame = container().layout( LayoutStyle::flex_column() .fill_width(), ); match image_rgba(32, 32, pixels) { Some(picture) => { frame.child(picture) } None => frame.child( text("image_rgba rejected") .nowrap(), ), }}API
| Name | Signature | Purpose |
|---|---|---|
image | fn image(source: ImageSource) -> sigil::kernel::ImageBuilder | An image node from an ImageSource. |