From 6fae8bf6cbe7155bcee42eaeba68e31564df057c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez <hector0193@gmail.com> Date: Tue, 4 Apr 2023 01:47:58 +0200 Subject: Implement `Frame::clip` for `iced_tiny_skia` --- tiny_skia/src/geometry.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs index 4e3941f3..508965ad 100644 --- a/tiny_skia/src/geometry.rs +++ b/tiny_skia/src/geometry.rs @@ -125,7 +125,12 @@ impl Frame { self.transform = self.stack.pop().expect("Pop transform"); } - pub fn clip(&mut self, _frame: Self, _translation: Vector) {} + pub fn clip(&mut self, frame: Self, translation: Vector) { + self.primitives.push(Primitive::Translate { + translation, + content: Box::new(frame.into_primitive()), + }); + } pub fn translate(&mut self, translation: Vector) { self.transform = -- cgit