[−][src]Struct imageproc::rect::Rect
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()));
Implementations
impl Rect
[src]
pub fn at(x: i32, y: i32) -> RectPosition
[src]
Reduces possibility of confusing coordinates and dimensions when specifying rects.
See the struct-level documentation for examples.
pub fn top(&self) -> i32
[src]
Smallest y-coordinate reached by rect.
See the struct-level documentation for examples.
pub fn left(&self) -> i32
[src]
Smallest x-coordinate reached by rect.
See the struct-level documentation for examples.
pub fn bottom(&self) -> i32
[src]
Greatest y-coordinate reached by rect.
See the struct-level documentation for examples.
pub fn right(&self) -> i32
[src]
Greatest x-coordinate reached by rect.
See the struct-level documentation for examples.
pub fn width(&self) -> u32
[src]
Width of rect.
pub fn height(&self) -> u32
[src]
Height of rect.
pub fn intersect(&self, other: Rect) -> Option<Rect>
[src]
Returns the intersection of self and other, or none if they are are disjoint.
Examples
use imageproc::rect::Rect; use imageproc::rect::Region; // Intersecting a rectangle with itself let r = Rect::at(4, 5).of_size(6, 7); assert_eq!(r.intersect(r), Some(r)); // Intersecting overlapping but non-equal rectangles let r = Rect::at(0, 0).of_size(5, 5); let s = Rect::at(1, 4).of_size(10, 12); let i = Rect::at(1, 4).of_size(4, 1); assert_eq!(r.intersect(s), Some(i)); // Intersecting disjoint rectangles let r = Rect::at(0, 0).of_size(5, 5); let s = Rect::at(10, 10).of_size(100, 12); assert_eq!(r.intersect(s), None);
Trait Implementations
impl Clone for Rect
[src]
impl Copy for Rect
[src]
impl Debug for Rect
[src]
impl Eq for Rect
[src]
impl PartialEq<Rect> for Rect
[src]
impl Region<f32> for Rect
[src]
impl Region<i32> for Rect
[src]
impl StructuralEq for Rect
[src]
impl StructuralPartialEq for Rect
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src where
Scheme: ApproxScheme,
[src]
Scheme: ApproxScheme,
type Err = NoError
The error type produced by a failed conversion.
pub fn approx_from(
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
[src]
src: Src
) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src where
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
[src]
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
pub fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, Dst> ConvAsUtil<Dst> for T
[src]
fn approx(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
impl<T> ConvUtil for T
[src]
fn approx_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ApproxInto<Dst, DefaultApprox>,
[src]
Self: ApproxInto<Dst, DefaultApprox>,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err> where
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
[src]
Scheme: ApproxScheme,
Self: ApproxInto<Dst, Scheme>,
fn into_as<Dst>(self) -> Dst where
Self: Into<Dst>,
[src]
Self: Into<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: TryInto<Dst>,
[src]
Self: TryInto<Dst>,
fn value_as<Dst>(self) -> Result<Dst, Self::Err> where
Self: ValueInto<Dst>,
[src]
Self: ValueInto<Dst>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<Src> TryFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
pub fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<Src, Dst> TryInto<Dst> for Src where
Dst: TryFrom<Src>,
[src]
Dst: TryFrom<Src>,
type Err = <Dst as TryFrom<Src>>::Err
The error type produced by a failed conversion.
pub fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<Src> ValueFrom<Src> for Src
[src]
type Err = NoError
The error type produced by a failed conversion.
pub fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
[src]
impl<Src, Dst> ValueInto<Dst> for Src where
Dst: ValueFrom<Src>,
[src]
Dst: ValueFrom<Src>,