pub struct Rect {
pub x1: f64,
pub y1: f64,
pub x2: f64,
pub y2: f64,
}Expand description
A rectangle defined by two corner points.
In PDF coordinate space, (x1, y1) is typically the lower-left corner
and (x2, y2) is the upper-right corner, though this is not enforced
until normalize() is called.
Fields§
§x1: f64§y1: f64§x2: f64§y2: f64Implementations§
Source§impl Rect
impl Rect
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Normalize so that (x1,y1) is lower-left and (x2,y2) is upper-right.
Sourcepub fn normalized(&self) -> Self
pub fn normalized(&self) -> Self
Return a normalized copy.
Sourcepub fn contains(&self, x: f64, y: f64) -> bool
pub fn contains(&self, x: f64, y: f64) -> bool
Returns true if the point (x, y) is inside this rectangle. The rectangle should be normalized first for correct results.
Sourcepub fn intersect(&self, other: &Rect) -> Option<Rect>
pub fn intersect(&self, other: &Rect) -> Option<Rect>
Compute the intersection of two rectangles. Returns None if they do not intersect.
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