pub struct PixelRect {
pub x_off: u64,
pub y_off: u64,
pub x_size: u64,
pub y_size: u64,
}Expand description
Rectangle in pixel space
Fields§
§x_off: u64X offset in pixels
y_off: u64Y offset in pixels
x_size: u64Width in pixels
y_size: u64Height in pixels
Implementations§
Source§impl PixelRect
impl PixelRect
Sourcepub fn new(x_off: u64, y_off: u64, x_size: u64, y_size: u64) -> Self
pub fn new(x_off: u64, y_off: u64, x_size: u64, y_size: u64) -> Self
Creates a new pixel rectangle
Sourcepub fn contains(&self, x: u64, y: u64) -> bool
pub fn contains(&self, x: u64, y: u64) -> bool
Checks if a point is contained in this rectangle
Sourcepub fn intersect(&self, other: &Self) -> Option<Self>
pub fn intersect(&self, other: &Self) -> Option<Self>
Computes the intersection with another rectangle
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Checks if this rectangle intersects with another
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PixelRect
impl<'de> Deserialize<'de> for PixelRect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for PixelRect
impl StructuralPartialEq for PixelRect
Auto Trait Implementations§
impl Freeze for PixelRect
impl RefUnwindSafe for PixelRect
impl Send for PixelRect
impl Sync for PixelRect
impl Unpin for PixelRect
impl UnsafeUnpin for PixelRect
impl UnwindSafe for PixelRect
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