mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
simplify visitor code in image_compositing
This commit is contained in:
parent
f734368a73
commit
7fc9dfe06b
@ -191,7 +191,20 @@ struct composite_visitor
|
||||
dy_(dy) {}
|
||||
|
||||
template <typename T>
|
||||
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<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
||||
void operator() (image_gray32f & dst) const
|
||||
{
|
||||
composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
||||
private:
|
||||
image_any const& src_;
|
||||
@ -199,26 +212,9 @@ struct composite_visitor
|
||||
float opacity_;
|
||||
int dx_;
|
||||
int dy_;
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
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> (image_rgba8 & dst) const
|
||||
{
|
||||
composite(dst, util::get<image_rgba8>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
||||
template <>
|
||||
void composite_visitor::operator()<image_gray32f> (image_gray32f & dst) const
|
||||
{
|
||||
composite(dst, util::get<image_gray32f>(src_), mode_, opacity_, dx_, dy_);
|
||||
}
|
||||
|
||||
} // end ns
|
||||
|
||||
template <>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user