Struct imageproc::rect::Rect
[−]
[src]
pub struct Rect { /* fields omitted */ }
A rectangular region of non-zero width and height.
Examples
use imageproc::rect::Rect; use imageproc::rect::Region; // Construct a rectangle with top-left corner at (4, 5), width 6 and height 7. let rect = Rect::at(4, 5).of_size(6, 7); // Contains top-left point: assert_eq!(rect.left(), 4); assert_eq!(rect.top(), 5); assert!(rect.contains(rect.left(), rect.top())); // Contains bottom-right point, at (left + width - 1, top + height - 1): assert_eq!(rect.right(), 9); assert_eq!(rect.bottom(), 11); assert!(rect.contains(rect.right(), rect.bottom()));
Methods
impl Rect
[src]
fn at(x: i32, y: i32) -> RectPosition
Reduces possibility of confusing coordinates and dimensions when specifying rects.
fn top(&self) -> i32
Smallest y-coordinate reached by rect.
fn left(&self) -> i32
Smallest x-coordinate reached by rect.
fn bottom(&self) -> i32
Greatest y-coordinate reached by rect.
fn right(&self) -> i32
Greatest x-coordinate reached by rect.
fn width(&self) -> u32
Width of rect.
fn height(&self) -> u32
Height of rect.
fn intersect(&self, other: Rect) -> Option<Rect>
Returns the intersection of self and other, or none if they are are disjoint.
Trait Implementations
impl Copy for Rect
[src]
impl Clone for Rect
[src]
fn clone(&self) -> Rect
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Rect
[src]
impl PartialEq for Rect
[src]
fn eq(&self, __arg_0: &Rect) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rect) -> bool
This method tests for !=
.