Skip to main content

Crop

Trait Crop 

Source
pub trait Crop<T, const N: usize>: Sized + IRectangle<T, N>
where T: Number,
{ // Required method fn crop(self, subrect: RectangleBase<Vector<T, N>>) -> Option<Self>; // Provided methods unsafe fn crop_unchecked(self, subrect: RectangleBase<Vector<T, N>>) -> Self { ... } fn crop_or_panic(self, subrect: RectangleBase<Vector<T, N>>) -> Self { ... } fn crop_intersect(self, subrect: RectangleBase<Vector<T, N>>) -> Self { ... } fn crop_margin( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Option<Self> { ... } unsafe fn crop_margin_unchecked( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Self { ... } fn crop_margin_intersect( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Self { ... } }
Expand description

Crop a selection to a sub selection, where the sub selection is contained in the selection.

Required Methods§

Source

fn crop(self, subrect: RectangleBase<Vector<T, N>>) -> Option<Self>

Crop the current rectangle to the given sub rectangle.

The sub rectangle will always be inside the current rectangle.

Provided Methods§

Source

unsafe fn crop_unchecked(self, subrect: RectangleBase<Vector<T, N>>) -> Self

Crop the current rectangle to the given sub rectangle.

The sub rectangle will always be inside the current rectangle.

Source

fn crop_or_panic(self, subrect: RectangleBase<Vector<T, N>>) -> Self

Crop the current rectangle to the given sub rectangle.

The sub rectangle will always be inside the current rectangle.

Source

fn crop_intersect(self, subrect: RectangleBase<Vector<T, N>>) -> Self

Crop the current rectangle to the given sub rectangle.

The sub rectangle will always be inside the current rectangle. If the sub rectangle is outside or partially outside the current view, it will be intersected with the current rectangle.

Source

fn crop_margin( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Option<Self>

Source

unsafe fn crop_margin_unchecked( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Self

Source

fn crop_margin_intersect( self, margin_start: Vector<T, N>, margin_end: Vector<T, N>, ) -> Self

Crop self by adding a margin to the start and the end of the current rectangle size.

The sub self will always be inside the self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, Idx> Crop<Idx, 2> for ImageBase<T, Idx>
where Idx: Integer, T: ToColor,

Source§

fn crop( self, subrect: RectangleBase<Vector<Idx, 2>>, ) -> Option<ImageBase<T, Idx>>

Implementors§

Source§

impl<'a, G, T, Idx, const N: usize> Crop<Idx, N> for GridView<'a, G, T, Idx, N>
where G: IGrid<T, Idx, N>, Idx: Integer,

Source§

impl<'a, G, T, Idx, const N: usize> Crop<Idx, N> for GridViewMut<'a, G, T, Idx, N>
where G: IGrid<T, Idx, N>, Idx: Integer,

Source§

impl<T, Idx, const N: usize> Crop<Idx, N> for GridBase<T, Idx, N>
where Idx: Integer, T: Clone,

Source§

impl<T, const N: usize> Crop<T, N> for RectangleBase<Vector<T, N>>
where T: Number,