Generic Image Library: static_transform

###  | #  |

- Main Page
- Modules
- Namespaces
- Classes
- Files

Functions
static_transform
Algorithms and Utility Functions

Equivalent to std::transform. Pairs the elements semantically. More...

## Functions
template<typename Src , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (Src &src, Dst &dst, Op op)
template<typename Src , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (const Src &src, Dst &dst, Op op)
template<typename P2 , typename P3 , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (P2 &p2, P3 &p3, Dst &dst, Op op)
template<typename P2 , typename P3 , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (P2 &p2, const P3 &p3, Dst &dst, Op op)
template<typename P2 , typename P3 , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (const P2 &p2, P3 &p3, Dst &dst, Op op)
template<typename P2 , typename P3 , typename Dst , typename Op >
BOOST_FORCEINLINE Op | static_transform (const P2 &p2, const P3 &p3, Dst &dst, Op op)

## Detailed Description

Equivalent to std::transform. Pairs the elements semantically.

Example: Write a generic function that adds two pixels into a homogeneous result pixel.

template <typename Result>
struct my_plus {
template <typename T1, typename T2>
Result operator()(T1 f1, T2 f2) const { return f1+f2; }
};
template <typename Pixel1, typename Pixel2, typename Pixel3>
void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) {
typedef typename channel_type<Pixel3>::type result_channel_t;
static_transform(p1,p2,result,my_plus<result_channel_t>());
}
rgb8_pixel_t p1(1,2,3);
bgr8_pixel_t p2(3,2,1);
rgb8_pixel_t result;
sum_channels(p1,p2,result);
assert(result == rgb8_pixel_t(2,4,6));