00001 #include <mln/core/image/image2d.hh>
00002 #include <mln/core/image/dmorph/image_if.hh>
00003 #include <mln/core/var.hh>
00004
00005 #include <mln/make/image.hh>
00006
00007 #include <mln/value/rgb8.hh>
00008 #include <mln/value/label_8.hh>
00009 #include <mln/literal/colors.hh>
00010
00011 #include <mln/data/fill.hh>
00012
00013 #include <doc/tools/sample_utils.hh>
00014
00015 bool row_oddity(mln::point2d p)
00016 {
00017 return p.row() % 2;
00018 }
00019
00020 int main()
00021 {
00022 using namespace mln;
00023 using value::rgb8;
00024 using value::label_8;
00025
00026
00027
00028 bool vals[6][5] = {
00029 {0, 1, 1, 0, 0},
00030 {0, 1, 1, 0, 0},
00031 {0, 0, 0, 0, 0},
00032 {1, 1, 0, 1, 0},
00033 {1, 0, 1, 1, 1},
00034 {1, 0, 0, 0, 0}
00035 };
00036 image2d<bool> ima = make::image(vals);
00037
00038
00039
00040
00041
00042 image2d<rgb8> ima2;
00043 initialize(ima2, ima);
00044 data::fill(ima2, literal::black);
00045
00046 data::fill((ima2 | row_oddity).rw(), literal::red);
00047
00048
00049 doc::ppmsave(ima2, "fill-subimage-cfun");
00050 }