Struct img::ImageVal
[−]
[src]
pub struct ImageVal<ImageP>(pub ImageP)
where
ImageP: Image;
Newtype which wraps Image
This type should be used in all places where you are working with actual values. This is
for example the case function definitions, parameters and return types. For all cases
where you want a type bound of a parameter you should use Image
.
Even though ImageVal
does not implement Image
itself, it derives
all functions from it. Additional to that, it is possible to do arithmetic operations if
the used pixel type implement PixelArithmetic
.
Therefore it is possible to work with ImageVal
without accessing
the newtype element.
Examples
use img::{ScalarVal, Gray8U, GrayVal8U, ImageBufferVal}; // Setup image with every pixel set to the linear index let mut a = ImageBufferVal::<Gray8U>::new_with_size(3, 3); for y in 0..3 { for x in 0..3 { let linear_idx = y * 3 + x; a.set_pixel(x, y, GrayVal8U::new(ScalarVal(linear_idx as u8))); } } // Calculate the pixelwise square on the image directly a = &a * &a; // Check result for y in 0..3 { for x in 0..3 { let linear_idx = y * 3 + x; let linear_idx_sq = linear_idx * linear_idx; assert_eq!(a.get_pixel(x, y).unwrap(), GrayVal8U::new(ScalarVal(linear_idx_sq as u8))); } }
Methods
impl<ImageP> ImageVal<ImageP> where
ImageP: Image,
[src]
ImageP: Image,
TODO: Impl documentation
fn get_size_in_bytes(&self) -> usize
fn load_from_raw_buffer(&mut self, buffer: &[u8])
fn write_into_raw_buffer(&self, buffer: &mut [u8])
fn width(&self) -> u32
fn height(&self) -> u32
fn pitch(&self) -> u32
fn get_pixel(&self, x: u32, y: u32) -> Option<PixelVal<ImageP::PixelT>>
fn set_pixel(&mut self, x: u32, y: u32, value: PixelVal<ImageP::PixelT>)
Trait Implementations
impl<ImageP: Clone> Clone for ImageVal<ImageP> where
ImageP: Image,
[src]
ImageP: Image,
fn clone(&self) -> ImageVal<ImageP>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, PixelX, ImageA, ImageB> Add<&'a ImageVal<ImageB>> for &'a ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
type Output = ImageBufferVal<ImageA::PixelT>
The resulting type after applying the +
operator
fn add(self, rhs: &'a ImageVal<ImageB>) -> Self::Output
The method for the +
operator
impl<'a, PixelX, ImageA, ImageB> Sub<&'a ImageVal<ImageB>> for &'a ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
type Output = ImageBufferVal<ImageA::PixelT>
The resulting type after applying the -
operator
fn sub(self, rhs: &'a ImageVal<ImageB>) -> Self::Output
The method for the -
operator
impl<'a, PixelX, ImageA, ImageB> Mul<&'a ImageVal<ImageB>> for &'a ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
type Output = ImageBufferVal<ImageA::PixelT>
The resulting type after applying the *
operator
fn mul(self, rhs: &'a ImageVal<ImageB>) -> Self::Output
The method for the *
operator
impl<'a, PixelX, ImageA, ImageB> Div<&'a ImageVal<ImageB>> for &'a ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
type Output = ImageBufferVal<ImageA::PixelT>
The resulting type after applying the /
operator
fn div(self, rhs: &'a ImageVal<ImageB>) -> Self::Output
The method for the /
operator
impl<'a, ImageT> Add<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the +
operator
fn add(self, rhs: PixelVal<ImageT::PixelT>) -> Self::Output
The method for the +
operator
impl<'a, ImageT> Add<ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the +
operator
fn add(
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
The method for the +
operator
impl<'a, ImageT> Sub<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the -
operator
fn sub(self, rhs: PixelVal<ImageT::PixelT>) -> Self::Output
The method for the -
operator
impl<'a, ImageT> Sub<ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the -
operator
fn sub(
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
The method for the -
operator
impl<'a, ImageT> Mul<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the *
operator
fn mul(self, rhs: PixelVal<ImageT::PixelT>) -> Self::Output
The method for the *
operator
impl<'a, ImageT> Mul<ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the *
operator
fn mul(
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
The method for the *
operator
impl<'a, ImageT> Div<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the /
operator
fn div(self, rhs: PixelVal<ImageT::PixelT>) -> Self::Output
The method for the /
operator
impl<'a, ImageT> Div<ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>> for &'a ImageVal<ImageT> where
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
[src]
ImageT: Image,
ImageT::PixelT: PixelArithmetic,
TODO: Impl documentation
type Output = ImageBufferVal<ImageT::PixelT>
The resulting type after applying the /
operator
fn div(
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
self,
rhs: ScalarVal<<ImageT::PixelT as PixelArithmetic>::ScalarT>
) -> Self::Output
The method for the /
operator
impl<'a, PixelX, ImageA, ImageB> AddAssign<&'a ImageVal<ImageB>> for ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
fn add_assign(&mut self, rhs: &'a ImageVal<ImageB>)
The method for the +=
operator
impl<ImageA> AddAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn add_assign(&mut self, rhs: PixelVal<ImageA::PixelT>)
The method for the +=
operator
impl<ImageA> AddAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn add_assign(
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
The method for the +=
operator
impl<'a, PixelX, ImageA, ImageB> SubAssign<&'a ImageVal<ImageB>> for ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
fn sub_assign(&mut self, rhs: &'a ImageVal<ImageB>)
The method for the -=
operator
impl<ImageA> SubAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn sub_assign(&mut self, rhs: PixelVal<ImageA::PixelT>)
The method for the -=
operator
impl<ImageA> SubAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn sub_assign(
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
The method for the -=
operator
impl<'a, PixelX, ImageA, ImageB> MulAssign<&'a ImageVal<ImageB>> for ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
fn mul_assign(&mut self, rhs: &'a ImageVal<ImageB>)
The method for the *=
operator
impl<ImageA> MulAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn mul_assign(&mut self, rhs: PixelVal<ImageA::PixelT>)
The method for the *=
operator
impl<ImageA> MulAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn mul_assign(
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
The method for the *=
operator
impl<'a, PixelX, ImageA, ImageB> DivAssign<&'a ImageVal<ImageB>> for ImageVal<ImageA> where
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
[src]
PixelX: PixelArithmetic,
ImageA: Image<PixelT = PixelX>,
ImageB: Image<PixelT = PixelX>,
TODO: Impl documentation
fn div_assign(&mut self, rhs: &'a ImageVal<ImageB>)
The method for the /=
operator
impl<ImageA> DivAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn div_assign(&mut self, rhs: PixelVal<ImageA::PixelT>)
The method for the /=
operator
impl<ImageA> DivAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
[src]
ImageA: Image,
ImageA::PixelT: PixelArithmetic,
TODO: Impl documentation
fn div_assign(
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
&mut self,
rhs: ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>
)
The method for the /=
operator