8 #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ALGORITHM_HPP
9 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ALGORITHM_HPP
11 #include <boost/gil/extension/dynamic_image/any_image.hpp>
13 #include <boost/gil/algorithm.hpp>
15 #include <boost/bind.hpp>
26 namespace boost {
namespace gil {
29 struct equal_pixels_fn :
public binary_operation_obj<equal_pixels_fn,bool> {
30 template <
typename V1,
typename V2>
31 BOOST_FORCEINLINE
bool apply_compatible(
const V1& v1,
const V2& v2)
const {
38 template <
typename Types1,
40 bool equal_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
41 return apply_operation(src,boost::bind(detail::equal_pixels_fn(), _1, dst));
45 template <
typename View1,
47 bool equal_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
48 return apply_operation(dst,boost::bind(detail::equal_pixels_fn(), src, _1));
52 template <
typename Types1,
54 bool equal_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
59 struct copy_pixels_fn :
public binary_operation_obj<copy_pixels_fn> {
60 template <
typename View1,
typename View2>
61 BOOST_FORCEINLINE
void apply_compatible(
const View1& src,
const View2& dst)
const {
68 template <
typename Types1,
70 void copy_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
75 template <
typename View1,
77 void copy_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
82 template <
typename Types1,
84 void copy_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
91 struct default_color_converter;
94 template <
typename Types1,
97 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const View2& dst, CC cc) {
98 apply_operation(src,boost::bind(detail::copy_and_convert_pixels_fn<CC>(cc), _1, dst));
102 template <
typename Types1,
104 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
105 apply_operation(src,boost::bind(detail::copy_and_convert_pixels_fn<default_color_converter>(), _1, dst));
109 template <
typename View1,
112 void copy_and_convert_pixels(
const View1& src,
const any_image_view<Types2>& dst, CC cc) {
113 apply_operation(dst,boost::bind(detail::copy_and_convert_pixels_fn<CC>(cc), src, _1));
117 template <
typename View1,
119 void copy_and_convert_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
120 apply_operation(dst,boost::bind(detail::copy_and_convert_pixels_fn<default_color_converter>(), src, _1));
124 template <
typename Types1,
127 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst, CC cc) {
132 template <
typename Types1,
134 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
135 apply_operation(src,dst,detail::copy_and_convert_pixels_fn<default_color_converter>());
139 template <
bool COMPATIBLE>
struct fill_pixels_fn1 {
140 template <
typename V,
typename Value>
static void apply(
const V& src,
const Value& val) {
fill_pixels(src,val); }
144 template <>
struct fill_pixels_fn1<false> {
145 template <
typename V,
typename Value>
static void apply(
const V&,
const Value&) {
throw std::bad_cast();}
148 template <
typename Value>
149 struct fill_pixels_fn {
150 fill_pixels_fn(
const Value& val) : _val(val) {}
152 typedef void result_type;
153 template <
typename V> result_type operator()(
const V& img_view)
const {
154 fill_pixels_fn1<pixels_are_compatible<typename V::value_type, Value>::value>::apply(img_view,_val);
162 template <
typename Types,
void fill_pixels(const any_image_view< Types > &img_view, const Value &val)
fill_pixels for any image view. The pixel to fill with must be compatible with the current view ...
Definition: extension/dynamic_image/algorithm.hpp:164
BOOST_FORCEINLINE UnaryOp::result_type apply_operation(variant< Types > &arg, UnaryOp op)
Invokes a generic mutable operation (represented as a unary function object) on a variant...
Definition: apply_operation.hpp:31
BOOST_FORCEINLINE bool equal_pixels(const View1 &v1, const View2 &v2)
std::equal for image views
Definition: algorithm.hpp:937
BOOST_FORCEINLINE void copy_pixels(const View1 &src, const View2 &dst)
std::copy for image views
Definition: algorithm.hpp:270
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:60