Struct ImageRef

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

Reference to an image or another reference

Implementations§

Source§

impl<'a, P> ImageRef<'a, P>

Source

pub fn new(shape: Shape, data: &'a [P]) -> Self

Trait Implementations§

Source§

impl<'a, P: Clone> Clone for ImageRef<'a, P>

Source§

fn clone(&self) -> ImageRef<'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<P> Debug for ImageRef<'_, P>

Source§

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

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

impl<P> Image for ImageRef<'_, P>

Source§

type Pixel = P

Pixel type
Source§

fn shape(&self) -> Shape

Shape of the image
Source§

fn data(&self) -> &[Self::Pixel]

Data containing image
Source§

fn size(&self) -> Size

Image size
Source§

fn width(&self) -> usize

Image width
Source§

fn height(&self) -> usize

Image height
Source§

fn get(&self, row: usize, col: usize) -> Option<&Self::Pixel>

Get pixel at the specified row and column
Source§

fn view( &self, row_min: usize, row_max: usize, col_min: usize, col_max: usize, ) -> ImageRef<'_, Self::Pixel>

Create sub-image bounded by constraints, _max values are not inclusive.
Source§

fn as_ref(&self) -> ImageRef<'_, Self::Pixel>

Create immutable view to the image of the concrete type of ImageRef
Source§

fn iter(&self) -> ImageIter<'_, Self::Pixel>

Iterate over pixels
Source§

fn write(self, fmt: ImageWriteFormat, out: impl Write) -> Result<(), Error>
where Self::Pixel: Color, Self: Sized,

Source§

fn write_rgba<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write raw (height, width, RGBA…) data
Source§

fn write_ppm<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write image in PPM format
Source§

fn write_bmp<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write image in BMP format

Auto Trait Implementations§

§

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

§

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

§

impl<'a, P> Send for ImageRef<'a, P>
where P: Sync,

§

impl<'a, P> Sync for ImageRef<'a, P>
where P: Sync,

§

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

§

impl<'a, P> UnwindSafe for ImageRef<'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.