#[repr(C)]pub struct Rect {
pub left: scalar,
pub top: scalar,
pub right: scalar,
pub bottom: scalar,
}
Fields§
§left: scalar
The x coordinate of the rectangle’s left edge.
top: scalar
The y coordinate of the rectangle’s top edge.
right: scalar
The x coordinate of the rectangle’s right edge.
bottom: scalar
The y coordinate of the rectangle’s bottom edge.
Implementations§
source§impl Rect
impl Rect
pub fn new(left: scalar, top: scalar, right: scalar, bottom: scalar) -> Self
pub fn new_empty() -> Self
pub fn from_wh(w: scalar, h: scalar) -> Self
pub fn from_iwh(w: i32, h: i32) -> Self
pub fn from_size(size: impl Into<Size>) -> Self
pub fn from_xywh(x: scalar, y: scalar, w: scalar, h: scalar) -> Self
pub fn from_point_and_size(p: impl Into<Point>, sz: impl Into<Size>) -> Self
pub fn from_isize(isize: impl Into<ISize>) -> Self
pub fn from_irect(irect: impl AsRef<IRect>) -> Self
pub fn is_empty(&self) -> bool
pub fn is_sorted(&self) -> bool
pub fn is_finite(&self) -> bool
pub const fn x(&self) -> scalar
pub const fn y(&self) -> scalar
pub const fn left(&self) -> scalar
pub const fn top(&self) -> scalar
pub const fn right(&self) -> scalar
pub const fn bottom(&self) -> scalar
pub fn size(&self) -> Size
pub fn width(&self) -> scalar
pub fn height(&self) -> scalar
pub fn center_x(&self) -> scalar
pub fn center_y(&self) -> scalar
pub fn center(&self) -> Point
pub fn to_quad(self) -> [Point; 4]
pub fn set_empty(&mut self)
pub fn set_irect(&mut self, irect: impl AsRef<IRect>)
pub fn set_ltrb( &mut self, left: scalar, top: scalar, right: scalar, bottom: scalar )
pub fn set_bounds(&mut self, points: &[Point])
pub fn set_bounds_check(&mut self, points: &[Point]) -> bool
pub fn set_bounds_no_check(&mut self, points: &[Point])
pub fn set_bounds2(&mut self, p0: impl Into<Point>, p1: impl Into<Point>)
pub fn from_bounds(points: &[Point]) -> Option<Self>
pub fn set_xywh(&mut self, x: scalar, y: scalar, width: scalar, height: scalar)
pub fn set_wh(&mut self, w: scalar, h: scalar)
pub fn set_iwh(&mut self, width: i32, height: i32)
pub fn with_offset(&self, d: impl Into<Vector>) -> Self
pub fn with_inset(&self, d: impl Into<Vector>) -> Self
pub fn with_outset(&self, d: impl Into<Vector>) -> Self
pub fn offset(&mut self, d: impl Into<Vector>)
pub fn offset_to(&mut self, new_p: impl Into<Point>)
pub fn with_offset_to(&self, new_p: impl Into<Point>) -> Self
pub fn inset(&mut self, d: impl Into<Vector>)
pub fn outset(&mut self, d: impl Into<Vector>)
pub fn intersect(&mut self, r: impl AsRef<Rect>) -> bool
pub fn intersect2(&mut self, a: impl AsRef<Rect>, b: impl AsRef<Rect>) -> bool
pub fn intersects(&self, r: impl AsRef<Rect>) -> bool
pub fn intersects2(a: impl AsRef<Rect>, b: impl AsRef<Rect>) -> bool
pub fn join(&mut self, r: impl AsRef<Rect>)
pub fn join2(a: impl AsRef<Rect>, b: impl AsRef<Rect>) -> Rect
pub fn join_non_empty_arg(&mut self, r: impl AsRef<Rect>)
pub fn join_possibly_empty_rect(&mut self, r: impl AsRef<Rect>)
pub fn round(&self) -> IRect
pub fn round_in(&self) -> IRect
pub fn sort(&mut self)
pub fn sorted(&self) -> Rect
pub fn as_scalars(&self) -> &[scalar; 4]
pub fn dump(&self, as_hex: impl Into<Option<bool>>)
pub fn dump_hex(&self)
Trait Implementations§
source§impl PartialEq<Rect> for Rect
impl PartialEq<Rect> for Rect
source§impl QuickReject<Rect> for Canvas
impl QuickReject<Rect> for Canvas
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin 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