pub struct DrawingPasses<'p, 'd, R: Renderer> {
data: &'p Drawing<'d>,
shape_mode: Box<dyn Fn(ShapeId) -> RenderMode + 'p>,
route_mode: Box<dyn Fn(RouteId) -> RouteRenderMode + 'p>,
suppressed: Option<(RouteId, LabelPass)>,
blocks: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>,
pins: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>,
routes: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>,
overlay: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>,
}Expand description
Centralized scene renderer and the single source of truth for paint order.
draw lays the scene down in one fixed order — background images, areas,
block bodies, block icons, block pins, ports, routes, text boxes, then a
foreground overlay. A block is drawn in two passes (body then pins) with the
icon layer between, so a block’s pins and pin text read on top of its icon;
routes pass over the block cluster but under the text-box layer. The same
passes drive the static view, the SVG export, and every tool’s interactive
preview.
Callers vary only what differs from a plain render:
shape_mode: a per-shapeRenderMode(also applied to areas), e.g. to preview a dragged or selected shape.route_mode: a per-routeRouteRenderMode.blocks/pins/routes: replace a whole pass when a closure can’t express the need (hand-drawn pins, hidden routes).overlay: draw on top once the scene is complete.
Fields§
§data: &'p Drawing<'d>§shape_mode: Box<dyn Fn(ShapeId) -> RenderMode + 'p>§route_mode: Box<dyn Fn(RouteId) -> RouteRenderMode + 'p>§suppressed: Option<(RouteId, LabelPass)>The route whose labels a tool draws itself, and which of them.
blocks: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>§pins: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>§routes: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>§overlay: Option<Box<dyn FnOnce(&mut Style<'_, R>) + 'p>>Implementations§
Source§impl<'p, 'd, R: Renderer> DrawingPasses<'p, 'd, R>
impl<'p, 'd, R: Renderer> DrawingPasses<'p, 'd, R>
pub fn new(data: &'p Drawing<'d>) -> Self
Sourcepub fn shape_mode(self, f: impl Fn(ShapeId) -> RenderMode + 'p) -> Self
pub fn shape_mode(self, f: impl Fn(ShapeId) -> RenderMode + 'p) -> Self
Render mode for each shape (and area), keyed by id. Defaults to
Normal for every shape.
Sourcepub fn route_mode(self, f: impl Fn(RouteId) -> RouteRenderMode + 'p) -> Self
pub fn route_mode(self, f: impl Fn(RouteId) -> RouteRenderMode + 'p) -> Self
Render mode for each route, keyed by id. Defaults to Normal.
Sourcepub fn suppress_route_labels(self, route: RouteId) -> Self
pub fn suppress_route_labels(self, route: RouteId) -> Self
Skip drawing every label on route, for a tool that draws them all
itself.
Sourcepub fn suppress_route_label(self, route: RouteId, label: RouteLabelId) -> Self
pub fn suppress_route_label(self, route: RouteId, label: RouteLabelId) -> Self
Skip drawing one label on route — the one a tool drags or edits in
place — and draw its siblings as they stand.
Sourcepub fn blocks(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
pub fn blocks(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
Replace the block-body pass entirely — e.g. to draw some blocks’ bodies
specially while relocating a pin group (pair with Self::pins).
Sourcepub fn pins(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
pub fn pins(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
Replace the block-pin pass entirely — the layer drawn over block icons — e.g. to fade the pins a tool is relocating.
Sourcepub fn routes(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
pub fn routes(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
Replace the routes pass entirely — e.g. to hide routes touching a pin that has no valid drop slot.
Sourcepub fn overlay(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
pub fn overlay(self, f: impl FnOnce(&mut Style<'_, R>) + 'p) -> Self
Draw on top of the finished scene (marquees, drag ghosts, selection frames, waypoint handles, tag overlays).
pub fn draw(self, painter: &mut Style<'_, R>)
Auto Trait Implementations§
impl<'p, 'd, R> Freeze for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> !RefUnwindSafe for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> !Send for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> !Sync for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> Unpin for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> UnsafeUnpin for DrawingPasses<'p, 'd, R>
impl<'p, 'd, R> !UnwindSafe for DrawingPasses<'p, 'd, R>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more