1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -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

@@ -63,11 +63,15 @@ impl Shadow {
use crate::tessellator::*;
let rect = RectShape::filled(rect.expand(half_ext), ext_rounding, color);
let mut tessellator = Tessellator::from_options(TessellationOptions {
aa_size: extrusion,
anti_alias: true,
..Default::default()
});
let pixels_per_point = 1.0; // doesn't matter here
let mut tessellator = Tessellator::new(
pixels_per_point,
TessellationOptions {
feathering: true,
feathering_size_in_pixels: extrusion * pixels_per_point,
..Default::default()
},
);
let mut mesh = Mesh::default();
tessellator.tessellate_rect(&rect, &mut mesh);
mesh