12 #ifndef GIL_DYNAMICIMAGE_ALGORITHM_HPP
13 #define GIL_DYNAMICIMAGE_ALGORITHM_HPP
15 #include "../../algorithm.hpp"
17 #include <boost/bind.hpp>
28 namespace boost {
namespace gil {
31 struct equal_pixels_fn :
public binary_operation_obj<equal_pixels_fn,bool> {
32 template <
typename V1,
typename V2>
33 BOOST_FORCEINLINE
bool apply_compatible(
const V1& v1,
const V2& v2)
const {
40 template <
typename Types1,
42 bool equal_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
43 return apply_operation(src,boost::bind(detail::equal_pixels_fn(), _1, dst));
47 template <
typename View1,
49 bool equal_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
50 return apply_operation(dst,boost::bind(detail::equal_pixels_fn(), src, _1));
54 template <
typename Types1,
56 bool equal_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
61 struct copy_pixels_fn :
public binary_operation_obj<copy_pixels_fn> {
62 template <
typename View1,
typename View2>
63 BOOST_FORCEINLINE
void apply_compatible(
const View1& src,
const View2& dst)
const {
70 template <
typename Types1,
72 void copy_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
77 template <
typename View1,
79 void copy_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
84 template <
typename Types1,
86 void copy_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
93 struct default_color_converter;
96 template <
typename Types1,
99 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const View2& dst, CC cc) {
100 apply_operation(src,boost::bind(detail::copy_and_convert_pixels_fn<CC>(cc), _1, dst));
104 template <
typename Types1,
106 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const View2& dst) {
107 apply_operation(src,boost::bind(detail::copy_and_convert_pixels_fn<default_color_converter>(), _1, dst));
111 template <
typename View1,
114 void copy_and_convert_pixels(
const View1& src,
const any_image_view<Types2>& dst, CC cc) {
115 apply_operation(dst,boost::bind(detail::copy_and_convert_pixels_fn<CC>(cc), src, _1));
119 template <
typename View1,
121 void copy_and_convert_pixels(
const View1& src,
const any_image_view<Types2>& dst) {
122 apply_operation(dst,boost::bind(detail::copy_and_convert_pixels_fn<default_color_converter>(), src, _1));
126 template <
typename Types1,
129 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst, CC cc) {
134 template <
typename Types1,
136 void copy_and_convert_pixels(
const any_image_view<Types1>& src,
const any_image_view<Types2>& dst) {
137 apply_operation(src,dst,detail::copy_and_convert_pixels_fn<default_color_converter>());
141 template <
bool COMPATIBLE>
struct fill_pixels_fn1 {
142 template <
typename V,
typename Value>
static void apply(
const V& src,
const Value& val) {
fill_pixels(src,val); }
146 template <>
struct fill_pixels_fn1<false> {
147 template <
typename V,
typename Value>
static void apply(
const V& src,
const Value& val) {
throw std::bad_cast();}
150 template <
typename Value>
151 struct fill_pixels_fn {
152 fill_pixels_fn(
const Value& val) : _val(val) {}
154 typedef void result_type;
155 template <
typename V> result_type operator()(
const V& img_view)
const {
156 fill_pixels_fn1<pixels_are_compatible<typename V::value_type, Value>::value>::apply(img_view,_val);
164 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:166
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:35
BOOST_FORCEINLINE bool equal_pixels(const View1 &v1, const View2 &v2)
std::equal for image views
Definition: algorithm.hpp:956
BOOST_FORCEINLINE void copy_pixels(const View1 &src, const View2 &dst)
std::copy for image views
Definition: algorithm.hpp:289
Support for run-time instantiated images and image views.
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:64