pub struct Image<'a>(pub *mut Image, _, _);
Expand description
Image type
Tuple Fields§
§0: *mut Image
Implementations§
Source§impl<'a> Image<'a>
impl<'a> Image<'a>
Sourcepub fn as_mut_halide_buffer(&mut self) -> Result<Buffer<'_>, Error>
pub fn as_mut_halide_buffer(&mut self) -> Result<Buffer<'_>, Error>
Use the image as a mutable halide_buffer_t
Sourcepub fn as_halide_buffer(&self) -> Result<Buffer<'_>, Error>
pub fn as_halide_buffer(&self) -> Result<Buffer<'_>, Error>
Use the image as a halide_buffer_t
NOTE: This buffer should only be used immutably, it is not safe to
use the resulting Buffer as an output argument. Use as_mut_halide_buffer
if you will be mutating the contents
Source§impl<'a> Image<'a>
impl<'a> Image<'a>
Sourcepub fn read_default<P: AsRef<Path>>(path: P) -> Result<Image<'a>, Error>
pub fn read_default<P: AsRef<Path>>(path: P) -> Result<Image<'a>, Error>
Read default colorspace/type from disk using ezimage
Sourcepub fn read<P: AsRef<Path>>(
path: P,
color: Color,
t: Type,
) -> Result<Image<'a>, Error>
pub fn read<P: AsRef<Path>>( path: P, color: Color, t: Type, ) -> Result<Image<'a>, Error>
Read from disk using ezimage
Sourcepub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
pub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
Write image to disk using ezimage
Sourcepub fn new_with_data<T, X: AsMut<[T]>>(
meta: Meta,
data: X,
) -> Result<Self, Error>
pub fn new_with_data<T, X: AsMut<[T]>>( meta: Meta, data: X, ) -> Result<Self, Error>
Wrap existing data
Sourcepub fn new_like_with_color(&self, color: Color) -> Result<Self, Error>
pub fn new_like_with_color(&self, color: Color) -> Result<Self, Error>
Create a new image similar to an existing image with the color changed
Sourcepub fn new_like_with_type(&self, t: Type) -> Result<Self, Error>
pub fn new_like_with_type(&self, t: Type) -> Result<Self, Error>
Create a new image similar to an existing image with the type changed
pub fn get_type(&self) -> Type
pub fn get_color(&self) -> Color
Sourcepub fn data_mut<T>(&mut self) -> Result<&mut [T], Error>
pub fn data_mut<T>(&mut self) -> Result<&mut [T], Error>
Get the underlying data as a mutable slice
Sourcepub fn buffer_mut(&mut self) -> Result<&mut [u8], Error>
pub fn buffer_mut(&mut self) -> Result<&mut [u8], Error>
Get the underlying data as a mutable byte slice
Sourcepub fn at<T>(&mut self, x: usize, y: usize) -> Result<&mut [T], Error>
pub fn at<T>(&mut self, x: usize, y: usize) -> Result<&mut [T], Error>
Get a mutable reference to the data at position (x, y)
Sourcepub fn for_each<T, F: FnMut((usize, usize), &mut [T])>(
&mut self,
f: F,
) -> Result<(), Error>
pub fn for_each<T, F: FnMut((usize, usize), &mut [T])>( &mut self, f: F, ) -> Result<(), Error>
Iterate over each pixel and apply f
Sourcepub fn for_each2<T, F: FnMut((usize, usize), &mut [T], &[T])>(
&mut self,
other: &Image<'_>,
f: F,
) -> Result<(), Error>
pub fn for_each2<T, F: FnMut((usize, usize), &mut [T], &[T])>( &mut self, other: &Image<'_>, f: F, ) -> Result<(), Error>
Iterate over each pixel in two images of the same size and apply f
Sourcepub fn convert_in_place(&mut self, color: Color, t: Type) -> Result<(), Error>
pub fn convert_in_place(&mut self, color: Color, t: Type) -> Result<(), Error>
Convert an image colorspace in-place, overwriting the source image
Sourcepub fn convert_to(&self, dest: &mut Image<'_>) -> Result<(), Error>
pub fn convert_to(&self, dest: &mut Image<'_>) -> Result<(), Error>
Convert an image colorspace based on the destination image type, allocating a new image
Sourcepub fn convert(&self, color: Color, t: Type) -> Result<Image<'_>, Error>
pub fn convert(&self, color: Color, t: Type) -> Result<Image<'_>, Error>
Convert an image colorspace, allocating a new image
pub fn convert_aces0(&self) -> Result<Image<'_>, Error>
pub fn convert_aces1(&self) -> Result<Image<'_>, Error>
pub fn convert_aces0_to_xyz(&self) -> Result<Image<'_>, Error>
pub fn convert_aces1_to_xyz(&self) -> Result<Image<'_>, Error>
Sourcepub fn scale(&self, x: f64, y: f64) -> Result<Image<'_>, Error>
pub fn scale(&self, x: f64, y: f64) -> Result<Image<'_>, Error>
Scale an image using the given factor for each dimension
Sourcepub fn resize_to(&self, dest: &mut Image<'_>) -> Result<(), Error>
pub fn resize_to(&self, dest: &mut Image<'_>) -> Result<(), Error>
Resize an image to match the destination image size