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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user