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]

TODO: Impl documentation

Trait Implementations

impl<ImageP: Clone> Clone for ImageVal<ImageP> where
    ImageP: Image
[src]

Returns a copy of the value. Read more

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]

TODO: Impl documentation

The resulting type after applying the + operator

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]

TODO: Impl documentation

The resulting type after applying the - operator

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]

TODO: Impl documentation

The resulting type after applying the * operator

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]

TODO: Impl documentation

The resulting type after applying the / operator

The method for the / operator

impl<'a, ImageT> Add<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
    ImageT: Image,
    ImageT::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The resulting type after applying the + operator

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]

TODO: Impl documentation

The resulting type after applying the + operator

The method for the + operator

impl<'a, ImageT> Sub<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
    ImageT: Image,
    ImageT::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The resulting type after applying the - operator

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]

TODO: Impl documentation

The resulting type after applying the - operator

The method for the - operator

impl<'a, ImageT> Mul<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
    ImageT: Image,
    ImageT::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The resulting type after applying the * operator

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]

TODO: Impl documentation

The resulting type after applying the * operator

The method for the * operator

impl<'a, ImageT> Div<PixelVal<ImageT::PixelT>> for &'a ImageVal<ImageT> where
    ImageT: Image,
    ImageT::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The resulting type after applying the / operator

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]

TODO: Impl documentation

The resulting type after applying the / operator

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]

TODO: Impl documentation

The method for the += operator

impl<ImageA> AddAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The method for the += operator

impl<ImageA> AddAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

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]

TODO: Impl documentation

The method for the -= operator

impl<ImageA> SubAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The method for the -= operator

impl<ImageA> SubAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

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]

TODO: Impl documentation

The method for the *= operator

impl<ImageA> MulAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The method for the *= operator

impl<ImageA> MulAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

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]

TODO: Impl documentation

The method for the /= operator

impl<ImageA> DivAssign<PixelVal<ImageA::PixelT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The method for the /= operator

impl<ImageA> DivAssign<ScalarVal<<ImageA::PixelT as PixelArithmetic>::ScalarT>> for ImageVal<ImageA> where
    ImageA: Image,
    ImageA::PixelT: PixelArithmetic
[src]

TODO: Impl documentation

The method for the /= operator