pub struct DrawCtx { /* private fields */ }Expand description
What a crate::Custom node draws into. Coordinates are the node’s own:
the origin is the node center, positive x is right, positive y is down.
The closure runs every time the frame is painted. It has to be a function
of t, of signals it captured, and of DrawCtx::rng: the same inputs
must produce the same shapes, because a frame can be painted more than
once and a seek paints it without the frames in between.
Implementations§
Source§impl DrawCtx
impl DrawCtx
Sourcepub fn quality(&self) -> f64
pub fn quality(&self) -> f64
1 is a full frame. A later draft mode will pass a smaller value so a closure can draw fewer shapes; it does not change positions.
Sourcepub fn rng(&self, seed: u64) -> DrawRng
pub fn rng(&self, seed: u64) -> DrawRng
Generator for seed. It does not touch the scene’s random(), and
the same seed is the same sequence on every paint of this frame.
Sourcepub fn line(&mut self, a: impl Into<Point>, b: impl Into<Point>) -> Pen<'_>
pub fn line(&mut self, a: impl Into<Point>, b: impl Into<Point>) -> Pen<'_>
A straight segment from a to b.
Sourcepub fn circle(&mut self, center: impl Into<Point>, radius: f64) -> Pen<'_>
pub fn circle(&mut self, center: impl Into<Point>, radius: f64) -> Pen<'_>
A filled or stroked circle.
Sourcepub fn image(&mut self, rect: Rect, image: Rc<RasterImage>)
pub fn image(&mut self, rect: Rect, image: Rc<RasterImage>)
A picture stretched over rect, in the node’s coordinates. Draws
with the node’s opacity, like the shapes.