summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-09-10 23:54:05 +0200
committerLibravatar GitHub <noreply@github.com>2024-09-10 23:54:05 +0200
commit2a17afb7374deabcc7571688e58fcce01182d646 (patch)
treeee262e6998a189cf7a9e088e79e0094ec667d308 /graphics
parentf7bca570c3d0e73ce57a0406319c606e7c5f1463 (diff)
parentfe8f41278dc922e12ffeb7a50bfb17a47b4bf956 (diff)
downloadiced-2a17afb7374deabcc7571688e58fcce01182d646.tar.gz
iced-2a17afb7374deabcc7571688e58fcce01182d646.tar.bz2
iced-2a17afb7374deabcc7571688e58fcce01182d646.zip
Merge pull request #2473 from vladh/add-stroke-rectangle
Add stroke_rectangle
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/geometry/frame.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/graphics/src/geometry/frame.rs b/graphics/src/geometry/frame.rs
index b5f2f139..3dee7e75 100644
--- a/graphics/src/geometry/frame.rs
+++ b/graphics/src/geometry/frame.rs
@@ -65,6 +65,17 @@ where
self.raw.stroke(path, stroke);
}
+ /// Draws the stroke of an axis-aligned rectangle with the provided style
+ /// given its top-left corner coordinate and its `Size` on the [`Frame`] .
+ pub fn stroke_rectangle<'a>(
+ &mut self,
+ top_left: Point,
+ size: Size,
+ stroke: impl Into<Stroke<'a>>,
+ ) {
+ self.raw.stroke_rectangle(top_left, size, stroke);
+ }
+
/// Draws the characters of the given [`Text`] on the [`Frame`], filling
/// them with the given color.
///
@@ -200,6 +211,12 @@ pub trait Backend: Sized {
fn paste(&mut self, frame: Self);
fn stroke<'a>(&mut self, path: &Path, stroke: impl Into<Stroke<'a>>);
+ fn stroke_rectangle<'a>(
+ &mut self,
+ top_left: Point,
+ size: Size,
+ stroke: impl Into<Stroke<'a>>,
+ );
fn fill(&mut self, path: &Path, fill: impl Into<Fill>);
fn fill_text(&mut self, text: impl Into<Text>);
@@ -248,6 +265,13 @@ impl Backend for () {
fn paste(&mut self, _frame: Self) {}
fn stroke<'a>(&mut self, _path: &Path, _stroke: impl Into<Stroke<'a>>) {}
+ fn stroke_rectangle<'a>(
+ &mut self,
+ _top_left: Point,
+ _size: Size,
+ _stroke: impl Into<Stroke<'a>>,
+ ) {
+ }
fn fill(&mut self, _path: &Path, _fill: impl Into<Fill>) {}
fn fill_text(&mut self, _text: impl Into<Text>) {}