Skip to main content

paint_bevel

Function paint_bevel 

Source
pub fn paint_bevel(
    painter: &Painter,
    rect: Rect,
    bevel: Bevel,
    palette: &Palette,
    stroke: f32,
)
Expand description

Paint a two-tone edge just inside rect.

Fill first, bevel after: this adds two polylines and nothing else, so it composes over whatever is already there. That is what lets it go over an egui::TextEdit after ui.add, where the widget’s own fill has landed.

Two three-point polylines meeting at opposite corners, rather than four segments, so egui mitres the corner joins instead of leaving a notch.

The dark polyline is drawn second, so the two corners where the runs meet take its tone. That is the right answer here rather than a concession. makeover_layout::Bevel holds those corners to belong to both edges, and a renderer with room to divide one should; at the default one-point stroke the corner is a one-point square, so the division is sub-pixel and antialiasing resolves it to the same blend the mitre already gives. Splitting it would add a seam and no information. makeover-tui does split, because a terminal cell is large enough that not splitting costs a visible cell of edge weight — the same rule, at a resolution where it has something to say.