Struct tiny_skia_path::IntRect
source · pub struct IntRect { /* private fields */ }
Expand description
An integer rectangle.
§Guarantees
- Width and height are in 1..=i32::MAX range.
- x+width and y+height does not overflow.
Implementations§
source§impl IntRect
impl IntRect
sourcepub fn from_xywh(x: i32, y: i32, width: u32, height: u32) -> Option<Self>
pub fn from_xywh(x: i32, y: i32, width: u32, height: u32) -> Option<Self>
Creates a new IntRect
.
sourcepub fn from_ltrb(left: i32, top: i32, right: i32, bottom: i32) -> Option<Self>
pub fn from_ltrb(left: i32, top: i32, right: i32, bottom: i32) -> Option<Self>
Creates a new IntRect
.
sourcepub fn contains(&self, other: &Self) -> bool
pub fn contains(&self, other: &Self) -> bool
Checks that the rect is completely includes other
Rect.
sourcepub fn intersect(&self, other: &Self) -> Option<Self>
pub fn intersect(&self, other: &Self) -> Option<Self>
Returns an intersection of two rectangles.
Returns None
otherwise.
sourcepub fn make_outset(&self, dx: i32, dy: i32) -> Option<Self>
pub fn make_outset(&self, dx: i32, dy: i32) -> Option<Self>
Outsets the rectangle.
sourcepub fn translate(&self, tx: i32, ty: i32) -> Option<Self>
pub fn translate(&self, tx: i32, ty: i32) -> Option<Self>
Translates the rect by the specified offset.
sourcepub fn translate_to(&self, x: i32, y: i32) -> Option<Self>
pub fn translate_to(&self, x: i32, y: i32) -> Option<Self>
Translates the rect to the specified position.
Trait Implementations§
source§impl PartialEq for IntRect
impl PartialEq for IntRect
impl Copy for IntRect
impl StructuralPartialEq for IntRect
Auto Trait Implementations§
impl RefUnwindSafe for IntRect
impl Send for IntRect
impl Sync for IntRect
impl Unpin for IntRect
impl UnwindSafe for IntRect
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