28 #ifndef SCRIBO_DEBUG_TEXT_AREAS_IMAGE_HH
29 # define SCRIBO_DEBUG_TEXT_AREAS_IMAGE_HH
35 # include <mln/core/concept/image.hh>
37 # include <mln/core/image/imorph/tr_image.hh>
39 # include <mln/core/routine/duplicate.hh>
41 # include <mln/data/paste.hh>
42 # include <mln/data/fill.hh>
44 # include <mln/fun/x2x/translation.hh>
46 # include <mln/math/max.hh>
48 # include <mln/literal/black.hh>
50 # include <scribo/core/component_set.hh>
64 template <
typename I,
typename L>
67 const scribo::component_set<L>& comps);
70 # ifndef MLN_INCLUDE_ONLY
72 template <
typename I,
typename L>
75 const scribo::component_set<L>& comps)
77 mln_trace(
"scribo::debug::text_areas_image");
79 const I& input_rgb =
exact(input_rgb_);
80 mln_precondition(input_rgb.is_valid());
82 typedef mln_site(I) P;
85 float height = 1, width = 0;
86 for_all_comps(i, comps)
87 if (comps(i).is_valid())
89 height += comps(i).bbox().nrows() + shift;
96 I output(height, width);
99 algebra::vec<2, float> dv;
102 for_all_comps(i, comps)
103 if (comps(i).is_valid())
109 trans_t trans(dv - comps(i).
bbox().pmin().to_vec());
112 tr_box(comps(i).
bbox().pmin().to_vec() + trans.t(),
113 comps(i).
bbox().pmax().to_vec() + trans.t());
115 typedef mln_domain(I) domain_t;
116 tr_image<domain_t, tmp_t, trans_t> tr_ima(tr_box, tmp, trans);
119 dv[0] += comps(i).
bbox().
nrows() + shift;
126 # endif // ! MLN_INCLUDE_ONLY
134 #endif // ! SCRIBO_DEBUG_TEXT_AREAS_IMAGE_HH