26 #ifndef SCRIBO_FILTER_IMAGES_IN_PARAGRAPH_HH
27 # define SCRIBO_FILTER_IMAGES_IN_PARAGRAPH_HH
35 # include <mln/core/concept/image.hh>
36 # include <mln/draw/box_plain.hh>
37 # include <scribo/core/component_set.hh>
38 # include <scribo/core/document.hh>
61 # ifndef MLN_INCLUDE_ONLY
67 mln_trace(
"scribo::filter::images_in_paragraph");
69 mln_precondition(doc.is_valid());
71 if (! doc.has_elements())
75 initialize(billboard, doc.image());
78 for_all_comps(p, doc.paragraphs())
79 if (doc.paragraphs()(p).is_valid())
80 mln::draw::
box_plain(billboard, doc.paragraphs()(p).
bbox(), true);
83 component_set<L> elts = doc.elements();
84 for_all_comps(c, elts)
85 if (elts(c).is_valid() && elts(c).type() == component::
Image)
87 const mln_box(L)& b_ = elts(c).bbox();
89 const bool tl = billboard(b_.pmin());
90 const bool tr = billboard.at_(b_.pmin().row(), b_.pmax().col());
91 const bool ml = billboard.at_(b_.pcenter().row(), b_.pmin().col());
92 const bool mc = billboard.at_(b_.pcenter().row(), b_.pcenter().col());
93 const bool mr = billboard.at_(b_.pcenter().row(), b_.pmax().col());
94 const bool bl = billboard.at_(b_.pmax().row(), b_.pmin().col());
95 const bool br = billboard(b_.pmax());
99 if (tl && tr && ml && mc && mr && bl && br)
105 doc.set_elements(elts);
109 # endif // ! MLN_INCLUDE_ONLY
115 #endif // ! SCRIBO_FILTER_IMAGES_IN_PARAGRAPH_HH