Function push_polyline_scaled

Source
pub fn push_polyline_scaled(
    out: &mut Vec<StrokeVertex>,
    w: f32,
    h: f32,
    scale: Scale,
    polyline: &DrawPolyline,
)
Expand description

Appends antialiased triangles for a logical-coordinate polyline.

Stroke width and points are multiplied by DPR. Non-finite points, consecutive physical points closer than 0.001 pixel, nonpositive/non-finite widths, and transparent strokes are skipped. Each open path gets one-pixel AA fringes, square AA caps, and bevel joins; output is always a triangle-list multiple of three.

§Panics

Panics only if internal segment construction reports a nonempty collection whose final segment cannot be retrieved.

§Examples

use ailloli_ui_core::{math::Scale, Color, Point, StrokeStyle};
use ailloli_ui_render_wgpu::passes::push_polyline_scaled;
use ailloli_ui_runtime::DrawPolyline;
let line = DrawPolyline { points: vec![Point::new(0.0, 0.0), Point::new(10.0, 0.0)],
    stroke: StrokeStyle::new(2.0, Color::WHITE) };
let mut vertices = Vec::new();
push_polyline_scaled(&mut vertices, 100.0, 100.0, Scale::new(1.0), &line);
assert_eq!(vertices.len(), 30);