Struct rasterize::ImageOwned

source ·
pub struct ImageOwned<P> { /* private fields */ }
Expand description

Create an image that owns the data

Implementations§

source§

impl<P> ImageOwned<P>

source

pub fn new(shape: Shape, data: Vec<P>) -> Self

Construct owned image from the data and the shape

source

pub fn new_default(size: Size) -> Self
where P: Default,

Construct owned image filled with default color with provided size

source

pub fn new_with<F>(size: Size, f: F) -> Self
where F: FnMut(usize, usize) -> P,

Construct owned image from the size and the function which is called with all (row, col) pair and returns pixel value.

source

pub fn empty() -> Self

Construct empty image of zero size

source

pub fn into_vec(self) -> Vec<P>

Convert image to a vector

Trait Implementations§

source§

impl<P: Clone> Clone for ImageOwned<P>

source§

fn clone(&self) -> ImageOwned<P>

Returns a copy 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 ImageOwned<P>

source§

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

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

impl<P> Image for ImageOwned<P>

§

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§

impl<C> ImageMut for ImageOwned<C>

source§

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

Get a mutable slice of image data
source§

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

Get a mutable reference to the specified pixel
source§

fn view_mut( &mut self, row_min: usize, row_max: usize, col_min: usize, col_max: usize ) -> ImageMutRef<'_, Self::Pixel>

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

fn as_mut(&mut self) -> ImageMutRef<'_, Self::Pixel>

Create concrete type reference to the image
source§

fn iter_mut(&mut self) -> ImageMutIter<'_, Self::Pixel>

Create iterator over mutable references to all the pixel of the image

Auto Trait Implementations§

§

impl<P> Freeze for ImageOwned<P>

§

impl<P> RefUnwindSafe for ImageOwned<P>
where P: RefUnwindSafe,

§

impl<P> Send for ImageOwned<P>
where P: Send,

§

impl<P> Sync for ImageOwned<P>
where P: Sync,

§

impl<P> Unpin for ImageOwned<P>
where P: Unpin,

§

impl<P> UnwindSafe for ImageOwned<P>
where P: UnwindSafe,

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> 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,

§

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>,

§

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>,

§

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.