pub struct Rect {
pub x0: f32,
pub y0: f32,
pub x1: f32,
pub y1: f32,
}Expand description
2D Bounding box in PDF user-space points with bottom-left origin. Invariant: x0 <= x1 and y0 <= y1 (enforced by construction in constructor).
Fields§
§x0: f32§y0: f32§x1: f32§y1: f32Implementations§
Source§impl Rect
impl Rect
Sourcepub fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> Self
pub fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> Self
Creates a new bounding box, ensuring x0 <= x1 and y0 <= y1.
Sourcepub fn union(&self, other: &Rect) -> Rect
pub fn union(&self, other: &Rect) -> Rect
Computes the minimal bounding box containing both self and other.
Sourcepub fn expand(&self, pad_x: f32, pad_y: f32) -> Rect
pub fn expand(&self, pad_x: f32, pad_y: f32) -> Rect
Expands the bounding box by pad_x horizontally and pad_y vertically.
Sourcepub fn contains_point(&self, x: f32, y: f32) -> bool
pub fn contains_point(&self, x: f32, y: f32) -> bool
Checks if a point is within this bounding box.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more