---
scribo/ChangeLog | 4 ++
.../util/{color_to_hex.hh => box_is_included.hh} | 46 +++++++++-----------
2 files changed, 25 insertions(+), 25 deletions(-)
copy scribo/scribo/util/{color_to_hex.hh => box_is_included.hh} (64%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 3d28a54..6403a35 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,9 @@
2011-06-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * scribo/util/box_is_included.hh: New.
+
+2011-06-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Fix Page XML output.
* scribo/io/xml/internal/print_image_coords.hh,
diff --git a/scribo/scribo/util/color_to_hex.hh b/scribo/scribo/util/box_is_included.hh
similarity index 64%
copy from scribo/scribo/util/color_to_hex.hh
copy to scribo/scribo/util/box_is_included.hh
index e0ee33f..dc3f791 100644
--- a/scribo/scribo/util/color_to_hex.hh
+++ b/scribo/scribo/util/box_is_included.hh
@@ -23,18 +23,15 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef SCRIBO_UTIL_COLOR_TO_HEX_HH
-# define SCRIBO_UTIL_COLOR_TO_HEX_HH
+#ifndef SCRIBO_UTIL_BOX_IS_INCLUDED_HH
+# define SCRIBO_UTIL_BOX_IS_INCLUDED_HH
/// \file
///
-/// Convert hexadecimal encoded colors to value::rgb8.
+/// Check whether a box is included in another one.
-#include <cstdio>
-#include <iostream>
-#include <string.h>
-#include <mln/value/rgb8.hh>
+#include <mln/core/site_set/box.hh>
namespace scribo
{
@@ -43,30 +40,29 @@ namespace scribo
{
using namespace mln;
- std::string color_to_hex(const value::rgb8& v);
+ /// \brief Check whether a box is included in another one.
+ ///
+ /// \return true if \p lhs is included in \p rhs.
+ //
+ template <typename P>
+ bool
+ box_is_included(const box<P>& lhs, const box<P>& rhs);
# ifndef MLN_INCLUDE_ONLY
- std::string color_to_hex(const value::rgb8& v)
+ template <typename P>
+ bool
+ box_is_included(const box<P>& lhs, const box<P>& rhs)
{
- std::string result = "#";
+ trace::entering("scribo::util::box_is_included");
- char buf[3];
+ for (unsigned i = 0; i < P::dim; ++i)
+ if (!(lhs.pmin()[i] >= rhs.pmin()[i] && lhs.pmax()[i] <= rhs.pmax()[i]))
+ return false;
- int c = v.red();
- sprintf(buf, "%.2X", c);
- result.append(buf);
-
- c = v.green();
- sprintf(buf, "%.2X", c);
- result.append(buf);
-
- c = v.blue();
- sprintf(buf, "%.2X", c);
- result.append(buf);
-
- return result;
+ trace::exiting("scribo::util::box_is_included");
+ return true;
}
# endif // ! MLN_INCLUDE_ONLY
@@ -75,4 +71,4 @@ namespace scribo
} // end of namespace scribo
-#endif // ! SCRIBO_UTIL_COLOR_TO_HEX_HH
+#endif // ! SCRIBO_UTIL_BOX_IS_INCLUDED_HH
--
1.5.6.5