diff --git a/src/image_compositing.cpp b/src/image_compositing.cpp index a8f9bba3c..d6c8a3333 100644 --- a/src/image_compositing.cpp +++ b/src/image_compositing.cpp @@ -191,7 +191,20 @@ struct composite_visitor dy_(dy) {} template - void operator() (T & dst) const; + void operator() (T & dst) const + { + throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported"); + } + + void operator()(image_rgba8 & dst) const + { + composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); + } + + void operator() (image_gray32f & dst) const + { + composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); + } private: image_any const& src_; @@ -199,26 +212,9 @@ struct composite_visitor float opacity_; int dx_; int dy_; + }; -template -void composite_visitor::operator() (T & dst) const -{ - throw std::runtime_error("Error: Composite with " + std::string(typeid(dst).name()) + " is not supported"); -} - -template <> -void composite_visitor::operator() (image_rgba8 & dst) const -{ - composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); -} - -template <> -void composite_visitor::operator() (image_gray32f & dst) const -{ - composite(dst, util::get(src_), mode_, opacity_, dx_, dy_); -} - } // end ns template <>