1use embedded_graphics::{prelude::Point, primitives::Rectangle};
2
3#[derive(Clone, Copy, PartialEq, Eq)]
4pub struct Insets {
5 pub left: i32,
6 pub top: i32,
7 pub right: i32,
8 pub bottom: i32,
9}
10
11impl Insets {
12 pub fn grow(self, rect: Rectangle) -> Rectangle {
13 let bottom_right = rect.bottom_right().unwrap_or(rect.top_left);
14 Rectangle::with_corners(
15 Point::new(rect.top_left.x - self.left, rect.top_left.y - self.top),
16 Point::new(bottom_right.x + self.right, bottom_right.y + self.bottom),
17 )
18 }
19}