Skip to main content

cbf_compositor/model/
geometry.rs

1/// Rectangle in compositor-window coordinates.
2#[derive(Debug, Clone, Copy, PartialEq)]
3pub struct Rect {
4    /// Left edge of the rectangle.
5    pub x: f64,
6    /// Top edge of the rectangle.
7    pub y: f64,
8    /// Rectangle width.
9    pub width: f64,
10    /// Rectangle height.
11    pub height: f64,
12}
13
14impl Rect {
15    /// Create a new rectangle from origin and size values.
16    pub const fn new(x: f64, y: f64, width: f64, height: f64) -> Self {
17        Self {
18            x,
19            y,
20            width,
21            height,
22        }
23    }
24}