use anyhow::Result;
use skia_safe::Canvas;
use crate::engine::animator::AnimatedProperties;
use crate::layout::{Constraints, LayoutNode};
#[derive(Debug, Clone)]
pub struct RenderContext {
pub time: f64,
pub scene_duration: f64,
pub frame_index: u32,
pub fps: u32,
pub video_width: u32,
pub video_height: u32,
pub stagger_offset: f64,
}
pub trait Widget {
fn render(&self, canvas: &Canvas, layout: &LayoutNode, ctx: &RenderContext, props: &AnimatedProperties) -> Result<()>;
fn measure(&self, constraints: &Constraints) -> (f32, f32);
fn layout(&self, constraints: &Constraints) -> LayoutNode {
let (w, h) = self.measure(constraints);
LayoutNode::new(0.0, 0.0, w, h)
}
}