GIL_FORCEINLINE PixelDst& operator()(const Scalar s, PixelDst& p) const { static_for_each(p, std::bind1st(channel_divides_scalar_assign_t<Scalar, typename channel_type<PixelDst>::type>(), s)); return p; }
PixelR& operator()( const Scalar s, PixelR& dst ) const { static_for_each( dst, std::bind1st( channel_assigns_t<Scalar, typename channel_type<PixelR>::type>(), s ) ); return dst; }
GIL_FORCEINLINE PixelDst& operator()(const PixelSrc& p1, PixelDst& p2) const { static_for_each( p1, p2, channel_minus_assign_t<typename channel_type<PixelSrc>::type, typename channel_type<PixelDst>::type>()); return p2; }
GIL_FORCEINLINE PixelRefR& operator()(PixelRefR& dst) const { static_for_each(_color, dst, channel_assigns_t<typename channel_type<PixelRef>::type, typename channel_type<PixelRefR>::type>()); return dst; }
void operator()(const SrcP& src, Weight weight, DstP& dst) const { static_for_each(src,dst, add_dst_mul_src_channel<Weight>(weight)); // pixel_assigns_t<DstP,DstP&>()( // pixel_plus_t<DstP,DstP,DstP>()( // pixel_multiplies_scalar_t<SrcP,Weight,DstP>()(src,weight), // dst), // dst); }
Pixel& operator()( const Pixel& p1, Pixel& p2 ) const { static_for_each( p1, p2, channel_color_distribution_t< typename channel_type<Pixel>::type, IN, OUT >() ); return p2; }
Pixel& operator()( const Pixel& p1, Pixel& p2 ) const { static_for_each( p1, p2, channel_color_gradation_t< Channel, IN, OUT >( _in, _out ) ); return p2; }
inline void PrintTo(const Nebula::RawImage& img, ::std::ostream* os) { *os << "RawImage[ " << img.width() << " x " << img.height() << " :"; for (auto p : const_view(img)) { *os << " ("; static_for_each(p, [=](Nebula::RawChannel ch) { *os << " " << ch; }); *os << " )"; } *os << " ]"; }
void negative( const RGB_VIEW& view ) { typedef typename channel_type< RGB_VIEW >::type channel_t; channel_t max = channel_traits<channel_t>::max_value(); for( int y=0; y < view.height(); ++y ) { typename RGB_VIEW::x_iterator it = view.row_begin( y ); for( int x = 0; x < view.width(); ++x ) { static_for_each( it[x], calc_negative() ); } } }
void brightness( const RGB_VIEW& src , const RGB_VIEW& dst , float factor ) { calc_brightness calc; calc._factor = factor; for( int y=0; y < src.height(); ++y ) { typename RGB_VIEW::x_iterator src_it = src.row_begin( y ); typename RGB_VIEW::x_iterator dst_it = dst.row_begin( y ); for( int x = 0; x < src.width(); ++x ) { static_for_each( dst_it[x], src_it[x], calc ); } } }
void brightness_( const RGB_VIEW& src , const RGB_VIEW& dst , VALUE number ) { calc_brightness_<VALUE> calc; calc._number = number; for( int y=0; y < src.height(); ++y ) { typename RGB_VIEW::x_iterator src_it = src.row_begin( y ); typename RGB_VIEW::x_iterator dst_it = dst.row_begin( y ); for( int x = 0; x < src.width(); ++x ) { static_for_each( dst_it[x], src_it[x], calc ); } } }
void negative( const RGB_VIEW& src , const RGB_VIEW& dst ) { // make sure src and dst have same dimensions. // for rgba do it only for rgb channels typedef typename channel_type< RGB_VIEW >::type channel_t; channel_t max = channel_traits<channel_t>::max_value(); for( int y=0; y < src.height(); ++y ) { typename RGB_VIEW::x_iterator src_it = src.row_begin( y ); typename RGB_VIEW::x_iterator dst_it = dst.row_begin( y ); for( int x = 0; x < src.width(); ++x ) { static_for_each( dst_it[x], src_it[x], calc_negative() ); } } }
PixelRefR operator () (const PixelRef& src, PixelRefR& dst) const { static_for_each(src,dst,channel_assigns_t<typename channel_type<PixelRef>::type, typename channel_type<PixelRefR>::type>()); return dst; }
void operator()(const P1& src, P2& dst) const { static_for_each(src,dst,default_channel_converter()); }
void copy_clamp_pixel(const SrcPixel& src, DstPixel& dst) { static_for_each(src,dst,clamp_channel_fn()); }
void cast_pixel(const SrcPixel& src, DstPixel& dst) { static_for_each(src,dst,cast_channel_fn()); }
void swap(const interleaved_ref<ChannelReference,Layout>& x, const interleaved_ref<ChannelReference,Layout>& y) { static_for_each(x,y,detail::swap_fn_t()); };
std::ostream& output_frame (std::ostream& os, const Frame& f) { os << "< "; static_for_each (f, item_output_fn (os)); return os << ">"; }
PixelRef& operator () (PixelRef& p) const { static_for_each(p,channel_zeros_t<typename channel_type<PixelRef>::type>()); return p; }
void zero_channels(Pixel& p) { static_for_each(p,channel_zeros_t<typename channel_type<Pixel>::type>()); }