pub struct Rect {
pub x: f32,
pub y: f32,
pub w: f32,
pub h: f32,
}Expand description
An axis-aligned rectangle in canvas coordinates.
Fields§
§x: f32§y: f32§w: f32§h: f32Implementations§
Source§impl Rect
impl Rect
pub const fn new(x: f32, y: f32, w: f32, h: f32) -> Self
Sourcepub const fn from_point_size(origin: Point2D, w: f32, h: f32) -> Self
pub const fn from_point_size(origin: Point2D, w: f32, h: f32) -> Self
Create from origin point and size.
Sourcepub fn contains(&self, px: f32, py: f32) -> bool
pub fn contains(&self, px: f32, py: f32) -> bool
True if the point (px, py) is inside this rectangle (half-open: inclusive on
the near edge, exclusive on the far edge).
pub fn origin(&self) -> Point2D
pub fn center(&self) -> Point2D
Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnsafeUnpin for Rect
impl UnwindSafe for Rect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more