Struct imgproc_rs::image::Image [−][src]
A struct representing an image
Implementations
impl<T: Number> Image<T>
[src]
pub fn from_slice(
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: &[T]
) -> Self
[src]
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: &[T]
) -> Self
Creates a new Image<T>
from a slice
pub fn from_vec(
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<T>
) -> Self
[src]
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<T>
) -> Self
Creates a new Image<T>
from a vector
pub fn from_vec_of_vec(
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<Vec<T>>
) -> Self
[src]
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<Vec<T>>
) -> Self
Creates a new Image<T>
from a vector of vectors
pub fn from_vec_of_slice(
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<&[T]>
) -> Self
[src]
width: u32,
height: u32,
channels: u8,
alpha: bool,
data: Vec<&[T]>
) -> Self
Creates a new Image<T>
from a vector of slices
pub fn blank(info: ImageInfo) -> Self
[src]
Creates an Image<T>
populated with zeroes
pub fn empty(info: ImageInfo) -> Self
[src]
Creates an empty Image<T>
pub fn index(&self, x: u32, y: u32) -> usize
[src]
Returns the 1d index corresponding to the 2d (x, y)
indices
pub fn data(&self) -> &[T]
[src]
Returns all data as a slice
pub fn data_mut(&mut self) -> &mut [T]
[src]
Returns all data as a mutable slice
pub fn get_pixel_unchecked(&self, x: u32, y: u32) -> &[T]
[src]
Returns a slice representing the pixel located at (x, y)
without checking index bounds
pub fn get_pixel_mut(&mut self, x: u32, y: u32) -> &mut [T]
[src]
Returns a mutable slice representing the pixel located at (x, y)
Panics
Panics if x
or y
is out of bounds
pub fn get_pixel_mut_unchecked(&mut self, x: u32, y: u32) -> &mut [T]
[src]
Returns a mutable slice representing the pixel located at (x, y)
without checking index
bounds
pub fn get_subimage(
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<'_, T>
[src]
&self,
x: u32,
y: u32,
width: u32,
height: u32
) -> SubImage<'_, T>
Returns a SubImage<T>
representing the part of the image of width width
and height
height
, with upper left hand corner located at (x, y)
Panics
Panics if x
or y
is out of bounds
pub fn get_neighborhood_1d(
&self,
x: u32,
y: u32,
size: u32,
is_vert: bool
) -> SubImage<'_, T>
[src]
&self,
x: u32,
y: u32,
size: u32,
is_vert: bool
) -> SubImage<'_, T>
Returns a SubImage<T>
representing the row or column of pixels of length size
centered at
(x, y)
. If is_vert
is true
, returns the column; otherwise, returns the row.
Uses clamp padding for edge pixels (edge pixels are repeated indefinitely)
Panics
Panics if x
or y
is out of bounds
pub fn get_neighborhood_2d(&self, x: u32, y: u32, size: u32) -> SubImage<'_, T>
[src]
Returns a SubImage<T>
representing the “square” of pixels of side length size
centered
at (x, y)
. Uses clamp padding for edge pixels (edge pixels are repeated indefinitely)
Panics
Panics if x
or y
is out of bounds
pub fn set_pixel(&mut self, x: u32, y: u32, pixel: &[T])
[src]
Replaces the pixel located at (x, y)
with pixel
Panics
Panics if the length of pixel
is not equal to the number of channels in the image or x
or y
is out of bounds
pub fn set_pixel_indexed(&mut self, index: usize, pixel: &[T])
[src]
Replaces the pixel at index index
with pixel
Panics
Panics if the length of pixel
is not equal to the number of channels in the image
pub fn map_pixels<S: Number, F>(&self, f: F) -> Image<S> where
F: Fn(&[T]) -> Vec<S>,
[src]
F: Fn(&[T]) -> Vec<S>,
Applies function f
to each pixel
pub fn map_pixels_if_alpha<S: Number, F, G>(&self, f: F, g: G) -> Image<S> where
F: Fn(&[T]) -> Vec<S>,
G: Fn(T) -> S,
[src]
F: Fn(&[T]) -> Vec<S>,
G: Fn(T) -> S,
If alpha
, applies function f
to the non-alpha portion of each pixel and applies
function g
to the alpha channel of each pixel; otherwise, applies function f
to
each pixel
pub fn map_channels<S: Number, F>(&self, f: F) -> Image<S> where
F: Fn(T) -> S,
[src]
F: Fn(T) -> S,
Applies function f
to each channel of each pixel
pub fn map_channels_if_alpha<S: Number, F, G>(&self, f: F, g: G) -> Image<S> where
F: Fn(T) -> S,
G: Fn(T) -> S,
[src]
F: Fn(T) -> S,
G: Fn(T) -> S,
If alpha
, applies function f
to each non-alpha channel of each pixel and
applies function g
to the alpha channel of each pixel;
otherwise, applies function f
to each channel of each pixel
pub fn apply_pixels<F>(&mut self, f: F) where
F: Fn(&[T]) -> Vec<T>,
[src]
F: Fn(&[T]) -> Vec<T>,
Applies function f
to each pixel
pub fn apply_pixels_if_alpha<F, G>(&mut self, f: F, g: G) where
F: Fn(&[T]) -> Vec<T>,
G: Fn(T) -> T,
[src]
F: Fn(&[T]) -> Vec<T>,
G: Fn(T) -> T,
If alpha
, applies function f
to the non-alpha portion of each pixel and
applies function g
to the alpha channel of each pixel;
otherwise, applies function f
to each pixel
pub fn apply_channels<F>(&mut self, f: F) where
F: Fn(T) -> T,
[src]
F: Fn(T) -> T,
Applies function f
to each channel of each pixel
pub fn apply_channels_if_alpha<F, G>(&mut self, f: F, g: G) where
F: Fn(T) -> T,
G: Fn(T) -> T,
[src]
F: Fn(T) -> T,
G: Fn(T) -> T,
If alpha
, applies function f
to each non-alpha channel of each pixel and
applies function g
to the alpha channel of each pixel;
otherwise, applies function f
to each channel of each pixel
pub fn edit_channel<F>(&mut self, f: F, index: usize) where
F: Fn(T) -> T,
[src]
F: Fn(T) -> T,
Applies function f
to each channel of index index
of each pixel. Modifies self
Trait Implementations
impl<T: Number> BaseImage<T> for Image<T>
[src]
impl<T: Clone + Number> Clone for Image<T>
[src]
impl<T: Debug + Number> Debug for Image<T>
[src]
impl From<Image<f32>> for Image<f64>
[src]
impl From<Image<f32>> for Image<u8>
[src]
impl From<Image<f64>> for Image<u8>
[src]
impl From<Image<u128>> for Image<f64>
[src]
impl From<Image<u16>> for Image<f64>
[src]
impl From<Image<u32>> for Image<f64>
[src]
impl From<Image<u64>> for Image<f64>
[src]
impl From<Image<u8>> for Image<f64>
[src]
impl From<Image<usize>> for Image<f64>
[src]
impl<T: Number> Index<usize> for Image<T>
[src]
impl<T: Number> IndexMut<usize> for Image<T>
[src]
impl<'a, T: Number> IntoIterator for &'a Image<T>
[src]
type Item = (u32, u32, &'a [T])
The type of the elements being iterated over.
type IntoIter = PixelIter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: PartialEq + Number> PartialEq<Image<T>> for Image<T>
[src]
impl<T: Number> StructuralPartialEq for Image<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Image<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Image<T>
impl<T> Sync for Image<T>
impl<T> Unpin for Image<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Image<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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<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<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,