TuttleOFX  1
MergeAbstractFunctor.hpp
Go to the documentation of this file.
00001 #ifndef _TERRY_MERGEABSTRACTFUNCTOR_HPP_
00002 #define _TERRY_MERGEABSTRACTFUNCTOR_HPP_
00003 
00004 #include <boost/gil/color_convert.hpp>
00005 #include <boost/gil/pixel.hpp>
00006 
00007 namespace terry {
00008 
00009 struct merge_per_channel {}; ///< standard per channel functor
00010 struct merge_per_channel_with_alpha {}; ///< standard per channel functor with the alpha values stored inside the functor
00011 struct merge_per_pixel {}; ///< per pixel functor (instead of per channel)
00012 
00013 /**
00014  * @defgroup ViewsMerging
00015  * @brief merging functor base class
00016  */
00017 template <typename Pixel, typename OPERATES>
00018 struct merge_functor
00019 {
00020         typedef OPERATES operating_mode_t;
00021 };
00022 
00023 /**
00024  * @defgroup ViewsMerging
00025  * @brief merging functor that allows users to implement pixel merging operator
00026  */
00027 template <typename Pixel>
00028 struct merge_functor<Pixel, merge_per_pixel>
00029 {
00030         typedef merge_per_pixel operating_mode_t;
00031         // no pure virtual here because virtual is not inlined with all compilators
00032         inline void operator()( const Pixel& A,
00033                                 const Pixel& B, Pixel& d );
00034 };
00035 
00036 /**
00037  * @defgroup ViewsMerging
00038  * @brief merging functor that allows users to implement channel merging
00039  *                operator with alpha
00040  */
00041 template <typename Pixel>
00042 struct merge_functor<Pixel, merge_per_channel_with_alpha>
00043 {
00044         typedef typename channel_type<Pixel>::type value_t;
00045         typedef merge_per_channel_with_alpha operating_mode_t;
00046         value_t a;      /// Alpha source A
00047         value_t b;      /// Alpha source B
00048 
00049         // no pure virtual here because virtual is not inlined with all compilators
00050         template<typename Channel>
00051         inline void operator()( const Channel& A, const Channel& B, Channel& d );
00052 };
00053 
00054 /**
00055  * @defgroup ViewsMerging
00056  * @brief merging functor that allows users to implement channel merging
00057  *                operator with no alpha
00058  */
00059 template <typename Pixel>
00060 struct merge_functor<Pixel, merge_per_channel>
00061 {
00062         typedef merge_per_channel operating_mode_t;
00063 
00064         // no pure virtual here because virtual is not inlined with all compilators
00065         template<typename Channel>
00066         inline void operator()( const Channel& A, const Channel& B, Channel& d );
00067 };
00068 
00069 }
00070 
00071 #endif