pub struct WidgetApp {
pub width: u32,
pub height: u32,
pub font: FontCache,
pub theme: ThemeData,
/* private fields */
}Expand description
Off-screen widget renderer — renders a widget tree to a SkiaCanvas or PNG bytes.
Use this for golden / snapshot tests: render a widget to PNG, save it, and compare future runs byte-for-byte to catch visual regressions.
For a real windowed app, use rosace::App from the umbrella crate instead.
ⓘ
// Render to PNG bytes (dark theme by default):
let png = WidgetApp::new(800, 600).render_png(&root);
// Light theme:
let png = WidgetApp::new(800, 600).light().render_png(&root);
// Custom theme:
let png = WidgetApp::new(800, 600).theme(my_theme).render_png(&root);Fields§
§width: u32§height: u32§font: FontCache§theme: ThemeDataImplementations§
Source§impl WidgetApp
impl WidgetApp
Sourcepub fn background(self, c: Color) -> Self
pub fn background(self, c: Color) -> Self
Override the background color explicitly (ignores theme background).
Sourcepub fn render(&self, root: &dyn Widget) -> SkiaCanvas
pub fn render(&self, root: &dyn Widget) -> SkiaCanvas
Render the widget tree to a SkiaCanvas.
Sourcepub fn render_into(&self, canvas: &mut SkiaCanvas, root: &dyn Widget)
pub fn render_into(&self, canvas: &mut SkiaCanvas, root: &dyn Widget)
Paint the widget tree onto an existing canvas (for windowed apps).
Auto Trait Implementations§
impl !Freeze for WidgetApp
impl !RefUnwindSafe for WidgetApp
impl !Sync for WidgetApp
impl !UnwindSafe for WidgetApp
impl Send for WidgetApp
impl Unpin for WidgetApp
impl UnsafeUnpin for WidgetApp
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