Struct freya_engine::prelude::Rect
#[repr(C)]pub struct Rect {
pub left: f32,
pub top: f32,
pub right: f32,
pub bottom: f32,
}
Fields§
§left: f32
The x coordinate of the rectangle’s left edge.
top: f32
The y coordinate of the rectangle’s top edge.
right: f32
The x coordinate of the rectangle’s right edge.
bottom: f32
The y coordinate of the rectangle’s bottom edge.
Implementations§
§impl Rect
impl Rect
pub fn new(left: f32, top: f32, right: f32, bottom: f32) -> Rect
pub fn new_empty() -> Rect
pub fn from_wh(w: f32, h: f32) -> Rect
pub fn from_iwh(w: i32, h: i32) -> Rect
pub fn from_size(size: impl Into<Size>) -> Rect
pub fn from_xywh(x: f32, y: f32, w: f32, h: f32) -> Rect
pub fn from_point_and_size(p: impl Into<Point>, sz: impl Into<Size>) -> Rect
pub fn from_isize(isize: impl Into<ISize>) -> Rect
pub fn from_irect(irect: impl AsRef<IRect>) -> Rect
pub fn is_empty(&self) -> bool
pub fn is_sorted(&self) -> bool
pub fn is_finite(&self) -> bool
pub const fn x(&self) -> f32
pub const fn y(&self) -> f32
pub const fn left(&self) -> f32
pub const fn top(&self) -> f32
pub const fn right(&self) -> f32
pub const fn bottom(&self) -> f32
pub fn size(&self) -> Size
pub fn width(&self) -> f32
pub fn height(&self) -> f32
pub fn center_x(&self) -> f32
pub fn center_y(&self) -> f32
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: f32, top: f32, right: f32, bottom: f32)
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<Rect>
pub fn set_xywh(&mut self, x: f32, y: f32, width: f32, height: f32)
pub fn set_wh(&mut self, w: f32, h: f32)
pub fn set_iwh(&mut self, width: i32, height: i32)
pub fn with_offset(&self, d: impl Into<Point>) -> Rect
pub fn with_inset(&self, d: impl Into<Point>) -> Rect
pub fn with_outset(&self, d: impl Into<Point>) -> Rect
pub fn offset(&mut self, d: impl Into<Point>)
pub fn offset_to(&mut self, new_p: impl Into<Point>)
pub fn with_offset_to(&self, new_p: impl Into<Point>) -> Rect
pub fn inset(&mut self, d: impl Into<Point>)
pub fn outset(&mut self, d: impl Into<Point>)
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) -> &[f32; 4]
pub fn dump(&self, as_hex: impl Into<Option<bool>>)
pub fn dump_hex(&self)
Trait Implementations§
§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