Expand description
Image type
Fields
meta: Meta<T, C>
Metadata
data: Box<[T]>
Pixel data
Implementations
sourceimpl<T: Type, C: Color> Image<T, C>
impl<T: Type, C: Color> Image<T, C>
sourcepub unsafe fn new_with_data(
size: impl Into<Size>,
data: impl Into<Box<[T]>>
) -> Image<T, C>
pub unsafe fn new_with_data(
size: impl Into<Size>,
data: impl Into<Box<[T]>>
) -> Image<T, C>
Create a new image with the given size and data
Safety
This is marked as unsafe because it does not check to ensure the data passed in matches the dimensions
sourcepub fn new_like_with_type<U: Type>(&self) -> Image<U, C>
pub fn new_like_with_type<U: Type>(&self) -> Image<U, C>
Create a new image with the same size and color as an existing image with the given type
sourcepub fn new_like_with_color<D: Color>(&self) -> Image<T, D>
pub fn new_like_with_color<D: Color>(&self) -> Image<T, D>
Create a new image with the same size and type as an existing image with the given color
sourcepub fn new_like_with_type_and_color<U: Type, D: Color>(&self) -> Image<U, D>
pub fn new_like_with_type_and_color<U: Type, D: Color>(&self) -> Image<U, D>
Create a new image with the same size as an existing image with the given type and color
sourcepub fn into_buffer(self) -> Vec<u8>
pub fn into_buffer(self) -> Vec<u8>
Convert image data into byte vec
sourcepub fn buffer(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn buffer(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get image data as bytes
sourcepub fn buffer_mut(&mut self) -> &mut [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn buffer_mut(&mut self) -> &mut [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get image data as mutable bytes
sourcepub fn get_mut(&mut self, pt: impl Into<Point>) -> DataMut<'_, T, C>
pub fn get_mut(&mut self, pt: impl Into<Point>) -> DataMut<'_, T, C>
Get mutable data at specified index
sourcepub fn set(&mut self, pt: impl Into<Point>, data: impl AsRef<[T]>)
pub fn set(&mut self, pt: impl Into<Point>, data: impl AsRef<[T]>)
Set data to specified location
sourcepub fn in_bounds(&self, pt: impl Into<Point>) -> bool
pub fn in_bounds(&self, pt: impl Into<Point>) -> bool
Returns true when (x, y) is in bounds for the given image
sourcepub fn at(&self, pt: impl Into<Point>, px: impl AsMut<[T]>) -> bool
pub fn at(&self, pt: impl Into<Point>, px: impl AsMut<[T]>) -> bool
Get image data from an image, reusing an existing data buffer big enough for a single pixel
sourcepub fn pixel_at(&self, pt: impl Into<Point>, px: &mut Pixel<C>) -> bool
pub fn pixel_at(&self, pt: impl Into<Point>, px: &mut Pixel<C>) -> bool
Load data from and Image
into an existing Pixel
structure
sourcepub fn set_pixel(&mut self, pt: impl Into<Point>, px: &Pixel<C>)
pub fn set_pixel(&mut self, pt: impl Into<Point>, px: &Pixel<C>)
Set a normalized pixel to the specified location
sourcepub fn rows(&self) -> impl ParallelIterator<Item = (usize, &[T])>
pub fn rows(&self) -> impl ParallelIterator<Item = (usize, &[T])>
Iterate over image rows
sourcepub fn rows_mut(&mut self) -> impl ParallelIterator<Item = (usize, &mut [T])>
pub fn rows_mut(&mut self) -> impl ParallelIterator<Item = (usize, &mut [T])>
Iterate over mutable image rows
sourcepub fn row_range(
&self,
y: usize,
height: usize
) -> impl ParallelIterator<Item = (usize, &[T])>
pub fn row_range(
&self,
y: usize,
height: usize
) -> impl ParallelIterator<Item = (usize, &[T])>
Iterate over image rows
sourcepub fn row_range_mut(
&mut self,
y: usize,
height: usize
) -> impl ParallelIterator<Item = (usize, &mut [T])>
pub fn row_range_mut(
&mut self,
y: usize,
height: usize
) -> impl ParallelIterator<Item = (usize, &mut [T])>
Iterate over mutable image rows
sourcepub fn iter_region_mut<'a>(
&'a mut self,
roi: Region
) -> impl 'a + ParallelIterator<Item = (Point, DataMut<'_, T, C>)>
pub fn iter_region_mut<'a>(
&'a mut self,
roi: Region
) -> impl 'a + ParallelIterator<Item = (Point, DataMut<'_, T, C>)>
Iterate over part of an image with mutable data access
sourcepub fn iter_region<'a>(
&'a self,
roi: Region
) -> impl 'a + ParallelIterator<Item = (Point, Data<'_, T, C>)>
pub fn iter_region<'a>(
&'a self,
roi: Region
) -> impl 'a + ParallelIterator<Item = (Point, Data<'_, T, C>)>
Iterate over part of an image
sourcepub fn iter<'a>(
&'a self
) -> impl 'a + ParallelIterator<Item = (Point, Data<'_, T, C>)>
pub fn iter<'a>(
&'a self
) -> impl 'a + ParallelIterator<Item = (Point, Data<'_, T, C>)>
Get pixel iterator
sourcepub fn iter_mut<'a>(
&'a mut self
) -> impl 'a + ParallelIterator<Item = (Point, DataMut<'_, T, C>)>
pub fn iter_mut<'a>(
&'a mut self
) -> impl 'a + ParallelIterator<Item = (Point, DataMut<'_, T, C>)>
Get mutable pixel iterator
sourcepub fn for_each<F: Sync + Send + Fn(Point, DataMut<'_, T, C>)>(&mut self, f: F)
pub fn for_each<F: Sync + Send + Fn(Point, DataMut<'_, T, C>)>(&mut self, f: F)
Iterate over each pixel applying f
to every pixel
sourcepub fn for_each_region<F: Sync + Send + Fn(Point, DataMut<'_, T, C>)>(
&mut self,
roi: Region,
f: F
)
pub fn for_each_region<F: Sync + Send + Fn(Point, DataMut<'_, T, C>)>(
&mut self,
roi: Region,
f: F
)
Iterate over a region of pixels qpplying f
to every pixel
sourcepub fn for_each2<F: Sync + Send + Fn(Point, DataMut<'_, T, C>, Data<'_, T, C>)>(
&mut self,
other: &Image<T, C>,
f: F
)
pub fn for_each2<F: Sync + Send + Fn(Point, DataMut<'_, T, C>, Data<'_, T, C>)>(
&mut self,
other: &Image<T, C>,
f: F
)
Iterate over each pixel of two images at once
sourcepub fn each_pixel<F: Sync + Send + FnMut(Point, &Pixel<C>)>(&self, f: F)
pub fn each_pixel<F: Sync + Send + FnMut(Point, &Pixel<C>)>(&self, f: F)
Iterate over pixels, with a mutable closure
sourcepub fn each_pixel_region<F: Sync + Send + FnMut(Point, &Pixel<C>)>(
&self,
region: Region,
f: F
)
pub fn each_pixel_region<F: Sync + Send + FnMut(Point, &Pixel<C>)>(
&self,
region: Region,
f: F
)
Iterate over pixels in region, with a mutable closure
sourcepub fn each_pixel_mut<F: Sync + Send + FnMut(Point, &mut Pixel<C>)>(
&mut self,
f: F
)
pub fn each_pixel_mut<F: Sync + Send + FnMut(Point, &mut Pixel<C>)>(
&mut self,
f: F
)
Iterate over mutable pixels, with a mutable closure
sourcepub fn each_pixel_region_mut<F: Sync + Send + FnMut(Point, &mut Pixel<C>)>(
&mut self,
region: Region,
f: F
)
pub fn each_pixel_region_mut<F: Sync + Send + FnMut(Point, &mut Pixel<C>)>(
&mut self,
region: Region,
f: F
)
Iterate over mutable pixels in region, with a mutable closure
sourcepub fn copy_from_region(
&mut self,
offs: impl Into<Point>,
other: &Image<T, C>,
roi: Region
)
pub fn copy_from_region(
&mut self,
offs: impl Into<Point>,
other: &Image<T, C>,
roi: Region
)
Copy into a region from another image starting at the given offset
sourcepub fn apply<U: Type, D: Color>(
&mut self,
filter: impl Filter<U, D, T, C>,
input: &[&Image<U, D>]
) -> &mut Self
pub fn apply<U: Type, D: Color>(
&mut self,
filter: impl Filter<U, D, T, C>,
input: &[&Image<U, D>]
) -> &mut Self
Apply a filter using an Image as output
sourcepub async fn apply_async<'a, U: Type, D: Color>(
&mut self,
mode: AsyncMode,
filter: impl Filter<U, D, T, C> + Unpin,
input: &[&Image<U, D>]
) -> &mut Self
pub async fn apply_async<'a, U: Type, D: Color>(
&mut self,
mode: AsyncMode,
filter: impl Filter<U, D, T, C> + Unpin,
input: &[&Image<U, D>]
) -> &mut Self
Apply an async filter using an Image as output
sourcepub fn run_in_place(&mut self, filter: impl Filter<T, C>) -> &mut Self
pub fn run_in_place(&mut self, filter: impl Filter<T, C>) -> &mut Self
Run a filter using the same Image as input and output
sourcepub fn run<U: Type, D: Color>(
&self,
filter: impl Filter<T, C, U, D>,
output: Option<Meta<U, D>>
) -> Image<U, D>
pub fn run<U: Type, D: Color>(
&self,
filter: impl Filter<T, C, U, D>,
output: Option<Meta<U, D>>
) -> Image<U, D>
Run a filter using an Image as input
sourcepub async fn run_async<'a, U: 'a + Type, D: 'a + Color>(
&self,
mode: AsyncMode,
filter: impl Filter<T, C, U, D> + Unpin,
output: Option<Meta<U, D>>
) -> Image<U, D>
pub async fn run_async<'a, U: 'a + Type, D: 'a + Color>(
&self,
mode: AsyncMode,
filter: impl Filter<T, C, U, D> + Unpin,
output: Option<Meta<U, D>>
) -> Image<U, D>
Run an async filter using an Image as input
sourcepub fn convert_to<U: Type, D: Color>(&self, dest: &mut Image<U, D>)
pub fn convert_to<U: Type, D: Color>(&self, dest: &mut Image<U, D>)
Convert image type/color
sourcepub fn set_gamma_log(&mut self)
pub fn set_gamma_log(&mut self)
Convert to log RGB
sourcepub fn set_gamma_lin(&mut self)
pub fn set_gamma_lin(&mut self)
Convert to linear RGB
Trait Implementations
sourceimpl<'de, T: Type, C: Color> Deserialize<'de> for Image<T, C> where
T: Deserialize<'de>,
C: Deserialize<'de>,
impl<'de, T: Type, C: Color> Deserialize<'de> for Image<T, C> where
T: Deserialize<'de>,
C: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl ToTexture<u8, Rgb> for Image<u8, Rgb>
impl ToTexture<u8, Rgb> for Image<u8, Rgb>
sourceimpl ToTexture<u8, Rgba> for Image<u8, Rgba>
impl ToTexture<u8, Rgba> for Image<u8, Rgba>
impl<T: Eq + Type, C: Eq + Color> Eq for Image<T, C>
impl<T: Type, C: Color> StructuralEq for Image<T, C>
impl<T: Type, C: Color> StructuralPartialEq for Image<T, C>
Auto Trait Implementations
impl<T, C> RefUnwindSafe for Image<T, C> where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C> Send for Image<T, C>
impl<T, C> Sync for Image<T, C>
impl<T, C> Unpin for Image<T, C>
impl<T, C> UnwindSafe for Image<T, C> where
C: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more