diff options
author | 2024-07-02 23:59:24 +0300 | |
---|---|---|
committer | 2024-09-13 00:58:27 +0200 | |
commit | 7e89015e60d16dabe66dac8b168e212a7ac4b164 (patch) | |
tree | 1380cc1a56c20cba6e28dafd260a61be30d79dd9 /graphics/src/geometry/path.rs | |
parent | aed59bae5033c68fb7e1e1b07e7935d763d3665a (diff) | |
download | iced-7e89015e60d16dabe66dac8b168e212a7ac4b164.tar.gz iced-7e89015e60d16dabe66dac8b168e212a7ac4b164.tar.bz2 iced-7e89015e60d16dabe66dac8b168e212a7ac4b164.zip |
Add `rounded_rectangle` to `geometry::Path`
Diffstat (limited to '')
-rw-r--r-- | graphics/src/geometry/path.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/graphics/src/geometry/path.rs b/graphics/src/geometry/path.rs index 3d8fc6fa..c4f51593 100644 --- a/graphics/src/geometry/path.rs +++ b/graphics/src/geometry/path.rs @@ -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 { |