mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add epaint::RoundedRect primitive (#8440)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::{Color32, CornerRadius, MarginF32, Rect, RectShape, Vec2};
|
||||
use crate::{Color32, CornerRadius, MarginF32, Rect, RectShape, RoundedRect, Vec2};
|
||||
|
||||
/// The color and fuzziness of a fuzzy shape.
|
||||
///
|
||||
@@ -56,10 +56,12 @@ impl Shadow {
|
||||
} = *self;
|
||||
let [offset_x, offset_y] = offset;
|
||||
|
||||
let rect = rect
|
||||
.translate(Vec2::new(offset_x as _, offset_y as _))
|
||||
.expand(spread as _);
|
||||
let corner_radius = corner_radius.into() + CornerRadius::from(spread);
|
||||
let (rect, corner_radius) = RoundedRect::new(
|
||||
rect.translate(Vec2::new(offset_x as _, offset_y as _)),
|
||||
corner_radius.into(),
|
||||
)
|
||||
.expand(f32::from(spread))
|
||||
.into_parts();
|
||||
|
||||
RectShape::filled(rect, corner_radius, color).with_blur_width(blur as _)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user