1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Refactor TessellationOptions to expose slider for feathering size (#1408)

The epaint tessellator uses "feathering" to accomplish anti-aliasing. This PS allows you to control the feathering size, i.e. how blurry the edges of epaint shapes are.

This changes the interface of Tessellator slightly, and renames some options in TessellationOptions.
This commit is contained in:
Emil Ernerfeldt
2022-03-23 11:41:38 +01:00
committed by GitHub
parent a9fd03709e
commit 1387d6e9d6
7 changed files with 115 additions and 107 deletions

View File

@@ -599,10 +599,8 @@ fn add_hline(point_scale: PointScale, [start, stop]: [Pos2; 2], stroke: Stroke,
if antialiased {
let mut path = crate::tessellator::Path::default(); // TODO: reuse this to avoid re-allocations.
path.add_line_segment([start, stop]);
let options = crate::tessellator::TessellationOptions::from_pixels_per_point(
point_scale.pixels_per_point(),
);
path.stroke_open(stroke, &options, mesh);
let feathering = 1.0 / point_scale.pixels_per_point();
path.stroke_open(feathering, stroke, mesh);
} else {
// Thin lines often lost, so this is a bad idea