Struct ImageSlice

Source
pub struct ImageSlice<'a, P: 'a> { /* private fields */ }
Expand description

A shared view of some image data.

Implementations§

Source§

impl<'a, P: 'a> ImageSlice<'a, P>

Source

pub unsafe fn from_raw_parts( width: usize, height: usize, pitch: isize, ptr: *const P, ) -> Self

Makes an image slice from the base parts.

Absolutely no checks are performed, you must not lie to this method.

Trait Implementations§

Source§

impl<'a, P: Clone + 'a> Clone for ImageSlice<'a, P>

Source§

fn clone(&self) -> ImageSlice<'a, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, P: Debug + 'a> Debug for ImageSlice<'a, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, P: Hash + 'a> Hash for ImageSlice<'a, P>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, P: 'a> Index<(usize, usize)> for ImageSlice<'a, P>

Source§

type Output = P

The returned type after indexing.
Source§

fn index(&self, (x, y): (usize, usize)) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, P: 'a> IntoIterator for ImageSlice<'a, P>

Source§

type Item = (usize, usize, &'a P)

(x, y, pixel_ref)

Source§

type IntoIter = ImageRefIter<'a, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, P: Ord + 'a> Ord for ImageSlice<'a, P>

Source§

fn cmp(&self, other: &ImageSlice<'a, P>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a, P: PartialEq + 'a> PartialEq for ImageSlice<'a, P>

Source§

fn eq(&self, other: &ImageSlice<'a, P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, P: PartialOrd + 'a> PartialOrd for ImageSlice<'a, P>

Source§

fn partial_cmp(&self, other: &ImageSlice<'a, P>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, P: 'a> ReadableImage<P> for ImageSlice<'a, P>

Source§

fn width(&self) -> usize

Can’t exceed isize::MAX
Source§

fn height(&self) -> usize

Can’t exceed isize::MAX
Source§

fn pitch(&self) -> isize

Offset from the start of one row to the start of the next row.
Source§

fn as_ptr(&self) -> *const P

Raw const pointer to the data.
Source§

fn get(&self, loc: (usize, usize)) -> Option<&P>

Performs an optional indexing by reference, gives None for out of bounds.
Source§

fn slice(&self, r: Range<(usize, usize)>) -> ImageSlice<'_, P>

Grabs out a sub-slice of the data. Read more
Source§

fn iter(&self) -> ImageRefIter<'_, P>

Lets you iterate any image by reference.
Source§

fn to_vecimage(&self) -> VecImage<P>
where Self: Sized, P: Default + Clone,

This is like to_owned, you get your own version of the data. Read more
Source§

fn upscale(&self, scale: usize) -> VecImage<P>
where P: Copy + Default,

Scales up into a new VecImage by the given amount. Read more
Source§

impl<'a, P: Eq + 'a> Eq for ImageSlice<'a, P>

Source§

impl<'a, P: 'a> StructuralPartialEq for ImageSlice<'a, P>

Auto Trait Implementations§

§

impl<'a, P> Freeze for ImageSlice<'a, P>

§

impl<'a, P> RefUnwindSafe for ImageSlice<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> !Send for ImageSlice<'a, P>

§

impl<'a, P> !Sync for ImageSlice<'a, P>

§

impl<'a, P> Unpin for ImageSlice<'a, P>

§

impl<'a, P> UnwindSafe for ImageSlice<'a, P>
where P: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.