$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doc/examples/fill.cc
1 #include <mln/core/image/image2d.hh>
2 #include <mln/core/image/dmorph/image_if.hh>
3 
4 #include <mln/value/rgb8.hh>
5 #include <mln/io/ppm/load.hh>
6 #include <mln/literal/colors.hh>
7 
8 #include <tests/data.hh>
9 #include <doc/tools/sample_utils.hh>
10 
11 // \{
12 template <typename I>
13 void fill(I& ima, mln_value(I) v)
14 {
15  mln_piter(I) p(ima.domain());
16  for_all(p)
17  ima(p) = v;
18 }
19 // \}
20 
21 int main()
22 {
23  using namespace mln;
24 
26  io::ppm::load(ima, MLN_IMG_DIR "/small.ppm");
27 
28  // \{
29  box2d b(20,20);
30  fill((ima | b).rw(), literal::green);
31  // \}
32  doc::ppmsave(ima, "fill");
33 
34  // \{
35  fill(ima, literal::green);
36  // \}
37  doc::ppmsave(ima, "fill");
38 }