26 #include <mln/core/image/image2d.hh>
27 #include <mln/canvas/browsing/snake_generic.hh>
28 #include <mln/fun/p2v/iota.hh>
29 #include <mln/debug/println.hh>
32 template <
typename I,
typename F>
33 struct assign_browsing_functor
35 typedef mln_site(I) S;
36 enum { dim = S::dim };
38 typedef assign_browsing_functor<I, F>
self;
40 typedef
void (assign_browsing_functor<I,F>::*move_fun)();
44 std::vector<move_fun> moves;
45 std::vector<dpsite> dps;
47 assign_browsing_functor(I& input, F f = F())
53 dps[0] = dpsite(1, 0);
54 dps[1] = dpsite(0, 1);
55 dps[2] = dpsite(0, -1);
56 moves[0] = &self::down;
57 moves[1] = &self::fwd;
58 moves[2] = &self::bkd;
69 void fwd() { std::cout <<
"fwd" << std::endl;
next(); }
70 void bkd() { std::cout <<
"bkd" << std::endl;
next(); }
71 void down() { std::cout <<
"down" << std::endl;
next(); }
77 template <
typename I,
typename F,
typename B>
79 const Function_v2v<F>& f_,
80 const Browsing<B>& browse_)
83 const F& f =
exact(f_);
84 const B& browse =
exact(browse_);
86 assign_browsing_functor<I, F> fun(ima, f);
98 std::cout << ima2.bbox() << std::endl;