27 #ifndef MLN_BORDER_FILL_HH
28 # define MLN_BORDER_FILL_HH
37 # include <mln/core/concept/image.hh>
38 # include <mln/core/box_runstart_piter.hh>
39 # include <mln/opt/element.hh>
61 void fill(
const Image<I>& ima,
const mln_value(I)& v);
64 # ifndef MLN_INCLUDE_ONLY
72 void fill_tests(
const Image<I>& ima,
const mln_value(I)&)
74 mln_precondition(
exact(ima).is_valid());
86 void fill_size_1(
const Image<I>& ima_,
const mln_value(I)& v)
88 mln_trace(
"border::impl::fill_size_1");
90 const I& ima =
exact(ima_);
91 internal::fill_tests(ima, v);
93 typedef mln_psite(I) P;
94 typedef mln_psite(I) P;
95 mln_box_runstart_piter(I) pl(ima.domain());
97 unsigned len_r = pl.run_length();
102 unsigned end = ima.offset_of_point (pl);
117 template <
typename I>
119 void fill_size_n(
const I& ima_,
const mln_value(I)& v)
121 mln_trace(
"border::impl::fill_size_n");
123 I& ima =
const_cast<I&
>(
exact(ima_) );
124 internal::fill_tests(ima, v);
126 typedef mln_psite(I) P;
127 mln_box_runstart_piter(I) pl(ima.domain());
128 unsigned len_r = pl.run_length();
133 unsigned end = ima.offset_of_point (pl);
134 for (
unsigned i = st; i < end; ++i)
152 template <
typename I>
154 void fill_dispatch(
const Image<I>& ima,
const mln_value(I)& v);
156 template <
typename I>
158 void fill_dispatch(mln::trait::image::category::primary,
159 mln::trait::image::speed::fastest,
160 I& ima,
const mln_value(I)& v)
162 if (
sizeof(mln_value(I)) == 1)
163 impl::fill_size_1(ima, v);
165 impl::fill_size_n(ima, v);
168 template <
typename I>
170 void fill_dispatch(mln::trait::image::category::primary,
171 mln::trait::image::speed::any,
172 I& ,
const mln_value(I)& )
177 template <
typename I>
179 void fill_dispatch(mln::trait::image::category::morpher,
180 mln::trait::image::speed::any,
181 I& ima,
const mln_value(I)& v)
183 fill_dispatch(ima.unmorph_(), v);
186 template <
typename I>
188 void fill_dispatch(
const Image<I>& ima_,
const mln_value(I)& v)
190 I& ima =
const_cast<I&
>(
exact(ima_));
191 fill_dispatch(mln_trait_image_category(I)(),
192 mln_trait_image_speed(I)(),
202 template <
typename I>
204 void fill(
const Image<I>& ima,
const mln_value(I)& v)
206 mln_trace(
"border::fill");
208 internal::fill_tests(ima, v);
209 internal::fill_dispatch(ima, v);
214 # endif // ! MLN_INCLUDE_ONLY
221 #endif // ! MLN_BORDER_FILL_HH