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> 26 namespace boost {
namespace gil {
30 struct equal_pixels_fn : binary_operation_obj<equal_pixels_fn, bool>
32 template <
typename V1,
typename V2>
34 bool apply_compatible(V1
const& v1, V2
const& v2)
const 45 template <
typename Types,
typename View>
50 std::bind(detail::equal_pixels_fn(), std::placeholders::_1, dst));
56 template <
typename View,
typename Types>
61 std::bind(detail::equal_pixels_fn(), src, std::placeholders::_1));
67 template <
typename Types1,
typename Types2>
75 struct copy_pixels_fn :
public binary_operation_obj<copy_pixels_fn>
77 template <
typename View1,
typename View2>
79 void apply_compatible(View1
const& src, View2
const& dst)
const 90 template <
typename Types,
typename View>
93 apply_operation(src, std::bind(detail::copy_pixels_fn(), std::placeholders::_1, dst));
99 template <
typename Types,
typename View>
102 apply_operation(dst, std::bind(detail::copy_pixels_fn(), src, std::placeholders::_1));
108 template <
typename Types1,
typename Types2>
115 struct default_color_converter;
121 template <
typename Types,
typename View,
typename CC>
124 using cc_fn = detail::copy_and_convert_pixels_fn<CC>;
125 apply_operation(src, std::bind(cc_fn{cc}, std::placeholders::_1, dst));
131 template <
typename Types,
typename View>
134 using cc_fn = detail::copy_and_convert_pixels_fn<default_color_converter>;
142 template <
typename View,
typename Types,
typename CC>
145 using cc_fn = detail::copy_and_convert_pixels_fn<CC>;
146 apply_operation(dst, std::bind(cc_fn{cc}, src, std::placeholders::_1));
152 template <
typename View,
typename Types>
155 using cc_fn = detail::copy_and_convert_pixels_fn<default_color_converter>;
163 template <
typename Types1,
typename Types2,
typename CC>
174 template <
typename Types1,
typename Types2>
180 detail::copy_and_convert_pixels_fn<default_color_converter>());
185 template <
bool IsCompatible>
186 struct fill_pixels_fn1
188 template <
typename V,
typename Value>
189 static void apply(V
const &src, Value
const &val) {
fill_pixels(src, val); }
194 struct fill_pixels_fn1<false>
196 template <
typename V,
typename Value>
197 static void apply(V
const &, Value
const &) {
throw std::bad_cast();}
200 template <
typename Value>
201 struct fill_pixels_fn
203 fill_pixels_fn(Value
const& val) : val_(val) {}
205 using result_type = void;
206 template <
typename V>
207 result_type operator()(V
const&
view)
const 211 pixels_are_compatible
213 typename V::value_type,
216 >::apply(
view, val_);
227 template <
typename Types,
typename Value>
void copy_pixels(any_image_view< Types1 > const &src, any_image_view< Types2 > const &dst)
Definition: extension/dynamic_image/algorithm.hpp:109
BOOST_FORCEINLINE auto 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:33
void fill_pixels(any_image_view< Types > const &view, Value const &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:228
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:66
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:443
bool equal_pixels(any_image_view< Types1 > const &src, any_image_view< Types2 > const &dst)
Definition: extension/dynamic_image/algorithm.hpp:68
void copy_and_convert_pixels(any_image_view< Types1 > const &src, any_image_view< Types2 > const &dst)
Definition: extension/dynamic_image/algorithm.hpp:175