Struct vizia_core::vg::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_ltrb(l: f32, t: f32, b: f32, r: f32) -> 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§
source§impl From<BoundingBox> for Rect
impl From<BoundingBox> for Rect
source§fn from(bb: BoundingBox) -> Self
fn from(bb: BoundingBox) -> Self
Converts to this type from the input type.
source§impl From<Rect> for BoundingBox
impl From<Rect> for BoundingBox
§impl QuickReject<Rect> for Canvas
impl QuickReject<Rect> for Canvas
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 UnwindSafe for Rect
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.