* scribo/inverse_video/handle_collisions.hh: Here.
---
scribo/ChangeLog | 6 +++
scribo/scribo/inverse_video/handle_collisions.hh | 50 +++++++--------------
2 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index e868468..0c7b65f 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-26 Coddy Levi <levi(a)lrde.epita.fr>
+
+ Bug corrected, several improvements, interface modified.
+
+ * scribo/inverse_video/handle_collisions.hh: Here.
+
2011-05-25 Coddy Levi <levi(a)lrde.epita.fr>
New algorithm to detect superpositions between two line sets.
diff --git a/scribo/scribo/inverse_video/handle_collisions.hh
b/scribo/scribo/inverse_video/handle_collisions.hh
index 54e585c..4a772c3 100644
--- a/scribo/scribo/inverse_video/handle_collisions.hh
+++ b/scribo/scribo/inverse_video/handle_collisions.hh
@@ -81,18 +81,17 @@ namespace scribo
unsigned ls1_size_;
const scribo::line_set<L>& ls1_;
const scribo::line_set<L>& ls2_;
- };
+ };
} // end of namespace scribo::text::internal
// Facade
- template <typename I,
- typename L,
- typename F>
+ template <typename I, typename L>
void
handle_collisions(image2d<I>& input,
scribo::line_set<L>& ls1,
scribo::line_set<L>& ls2,
- F choose)
+ void (*choose)(scribo::line_info<L>&,
+ scribo::line_info<L>&))
{
mln::trace::entering("scribo::inverse_video::handle_collisions");
@@ -122,7 +121,7 @@ namespace scribo
: v[i];
if (!scribo::text::internal::looks_like_a_text_line(ls(l))
- || !ls(l).is_valid())
+ || !ls(l).is_valid() || ls(l).is_hidden())
continue;
unsigned tl, tr, bl, br;
@@ -136,11 +135,10 @@ namespace scribo
std::set<unsigned> labels;
labels.insert(tl);
- labels.insert(tl);
+ labels.insert(tr);
labels.insert(bl);
labels.insert(br);
- bool chosen = true;
for (std::set<unsigned>::const_iterator it = labels.begin();
it != labels.end();
++it)
@@ -150,38 +148,24 @@ namespace scribo
bool inverse_video_tested = (*it > ls1_size);
- const scribo::line_info<L>& l_tested =
+ if (inverse_video_tested == inverse_video)
+ break;
+
+ scribo::line_info<L>& l_tested =
(inverse_video_tested ? ls2(*it - ls1_size + 1) : ls1(*it));
if (!scribo::text::internal::looks_like_a_text_line(l_tested)
- || !l_tested.is_valid())
+ || !l_tested.is_valid() || l_tested.is_hidden())
continue;
- chosen = choose(ls(l), l_tested);
- /*
- if (inverse_video != inverse_video_tested)
- {
- if (inverse_video_tested)
- mln::draw::box(input,
- l_tested.bbox(),
- mln::literal::blue);
- else
- mln::draw::box(input,
- l_tested.bbox(),
- mln::literal::green);
-
- if (inverse_video)
- mln::draw::box(input,
- ls(l).bbox(),
- mln::literal::blue);
- else
- mln::draw::box(input,
- ls(l).bbox(),
- mln::literal::green);
- }*/
+ choose(ls(l), l_tested);
+
+ if (ls(l).is_hidden())
+ break;
}
- scribo::text::internal::draw_box(billboard, b, v[i]);
+ if (!ls(l).is_hidden())
+ scribo::text::internal::draw_box(billboard, b, v[i]);
}
mln::trace::exiting("scribo::inverse_video::handle_collisions");
--
1.5.6.5