TuttleOFX
1
|
00001 #ifndef _TERRY_NUMERIC_SCALAR_HPP_ 00002 #define _TERRY_NUMERIC_SCALAR_HPP_ 00003 00004 #include "assign.hpp" 00005 00006 namespace terry { 00007 namespace numeric { 00008 00009 00010 /// @brief destination is set to be product of the source and a scalar 00011 template <typename PixelAccum, typename SrcView, typename Scalar, typename DstView> 00012 GIL_FORCEINLINE 00013 void view_multiplies_scalar( const SrcView& src, const Scalar& scalar, const DstView& dst ) 00014 { 00015 assert( src.dimensions() == dst.dimensions() ); 00016 00017 typedef typename pixel_proxy<typename SrcView::value_type>::type PIXEL_SRC_REF; 00018 typedef typename pixel_proxy<typename DstView::value_type>::type PIXEL_DST_REF; 00019 00020 int height = src.height(); 00021 for( int rr = 0; rr < height; ++rr ) 00022 { 00023 typename SrcView::x_iterator it_src = src.row_begin(rr); 00024 typename DstView::x_iterator it_dst = dst.row_begin(rr); 00025 typename SrcView::x_iterator it_src_end = src.row_end(rr); 00026 while( it_src != it_src_end ) 00027 { 00028 pixel_assigns_t<PixelAccum,PIXEL_DST_REF>()( 00029 pixel_multiplies_scalar_t<PIXEL_SRC_REF,Scalar,PixelAccum>()( *it_src, scalar ), 00030 *it_dst ); 00031 00032 ++it_src; ++it_dst; 00033 } 00034 } 00035 } 00036 00037 } 00038 } 00039 00040 #endif