Add rounded_rectangle to geometry::Path
This commit is contained in:
parent
aed59bae50
commit
7e89015e60
2 changed files with 79 additions and 2 deletions
|
|
@ -9,7 +9,8 @@ pub use builder::Builder;
|
|||
|
||||
pub use lyon_path;
|
||||
|
||||
use iced_core::{Point, Size};
|
||||
use crate::core::border;
|
||||
use crate::core::{Point, Size};
|
||||
|
||||
/// An immutable set of points that may or may not be connected.
|
||||
///
|
||||
|
|
@ -47,6 +48,16 @@ impl Path {
|
|||
Self::new(|p| p.rectangle(top_left, size))
|
||||
}
|
||||
|
||||
/// Creates a new [`Path`] representing a rounded rectangle given its top-left
|
||||
/// corner coordinate, its [`Size`] and [`border::Radius`].
|
||||
pub fn rounded_rectangle(
|
||||
top_left: Point,
|
||||
size: Size,
|
||||
radius: border::Radius,
|
||||
) -> Self {
|
||||
Self::new(|p| p.rounded_rectangle(top_left, size, radius))
|
||||
}
|
||||
|
||||
/// Creates a new [`Path`] representing a circle given its center
|
||||
/// coordinate and its radius.
|
||||
pub fn circle(center: Point, radius: f32) -> Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue