#ifndef GIL_FUNCTORS_HPP #define GIL_FUNCTORS_HPP #include "ColorMerge.hpp" namespace boost { namespace gil { struct FunctorATop : public boost::gil::merge_functor { template inline static void merge( const AlphaA& a, const AlphaB& b, const SrcAV& A, const SrcBV& B, DstV & dst ) { // Ab + B(1-a) dst = (DstV)( A * b + B * ( 1 - a ) ); } }; struct FunctorAverage : public boost::gil::merge_functor { template inline static void merge( const SrcAV& srcA, const SrcBV& srcB, DstV& dst ) { // (A + B) / 2 dst = (DstV)( ( ((float)srcA) + srcB ) / 2.0f ); } }; struct FunctorPlus : public boost::gil::merge_functor { template inline static void merge( const SrcAV& srcA, const SrcBV& srcB, DstV& dst ) { // A + B return (DstV)( srcA + srcB ); } }; } } #endif //GIL_FUNCTORS_HPP