TuttleOFX
1
|
00001 #ifndef _TERRY_NUMERIC_ASSIGN_MINMAX_HPP_ 00002 #define _TERRY_NUMERIC_ASSIGN_MINMAX_HPP_ 00003 00004 #include "assign.hpp" 00005 #include "operations_assign.hpp" 00006 00007 #include <boost/gil/gil_config.hpp> 00008 #include <boost/gil/pixel.hpp> 00009 #include <boost/gil/color_base_algorithm.hpp> 00010 00011 #include <functional> 00012 00013 namespace terry { 00014 using namespace boost::gil; 00015 00016 namespace numeric { 00017 00018 00019 /// \ingroup PixelNumericOperations 00020 /// \brief construct for setting a pixel to the min channel value (see channel_traits::min_value) 00021 template <typename PixelR> // models pixel concept 00022 struct pixel_assigns_min_t 00023 { 00024 typedef typename boost::gil::channel_type<PixelR>::type Channel; 00025 GIL_FORCEINLINE 00026 PixelR& operator()(PixelR& dst) const 00027 { 00028 pixel_assigns_scalar_t<Channel,PixelR>()( channel_traits<Channel>::min_value(), dst); 00029 return dst; 00030 } 00031 }; 00032 00033 template <typename Pixel> 00034 GIL_FORCEINLINE 00035 void pixel_assigns_min(Pixel& p) 00036 { 00037 pixel_assigns_min_t<Pixel>()(p); 00038 } 00039 00040 /// \ingroup PixelNumericOperations 00041 /// \brief construct for setting a pixel to the max channel value (see channel_traits::max_value) 00042 template <typename PixelR> // models pixel concept 00043 struct pixel_assigns_max_t 00044 { 00045 typedef typename boost::gil::channel_type<PixelR>::type Channel; 00046 GIL_FORCEINLINE 00047 PixelR& operator() (PixelR& dst) const 00048 { 00049 pixel_assigns_scalar_t<Channel,PixelR>()( channel_traits<Channel>::max_value() , dst); 00050 return dst; 00051 } 00052 }; 00053 00054 template <typename Pixel> 00055 GIL_FORCEINLINE 00056 void pixel_assigns_max(Pixel& p) 00057 { 00058 pixel_assigns_max_t<Pixel>()(p); 00059 } 00060 00061 00062 00063 00064 } 00065 } 00066 00067 #endif