last-svn-commit-6-gf08ca6b Add A new routine to draw plain boxes.

* milena/mln/draw/all.hh: Include new file. * milena/mln/draw/box.hh: Add a fixme. * milena/mln/draw/box_plain.hh: New. --- milena/ChangeLog | 10 +++++++ milena/mln/draw/all.hh | 1 + milena/mln/draw/box.hh | 5 +++- milena/mln/draw/{box.hh => box_plain.hh} | 40 ++++++++++++----------------- 4 files changed, 32 insertions(+), 24 deletions(-) copy milena/mln/draw/{box.hh => box_plain.hh} (72%) diff --git a/milena/ChangeLog b/milena/ChangeLog index e5c034c..b0cc268 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,15 @@ 2010-02-16 Guillaume Lazzara <z@lrde.epita.fr> + Add A new routine to draw plain boxes. + + * mln/draw/all.hh: Include new file. + + * mln/draw/box.hh: Add a fixme. + + * mln/draw/box_plain.hh: New. + +2010-02-16 Guillaume Lazzara <z@lrde.epita.fr> + Add more implementations for box specializations. * mln/core/internal/box_impl.hh: Add width, height and depth. diff --git a/milena/mln/draw/all.hh b/milena/mln/draw/all.hh index 847d560..60bcca0 100644 --- a/milena/mln/draw/all.hh +++ b/milena/mln/draw/all.hh @@ -41,6 +41,7 @@ namespace mln # include <mln/draw/box.hh> +# include <mln/draw/box_plain.hh> # include <mln/draw/line.hh> # include <mln/draw/plot.hh> diff --git a/milena/mln/draw/box.hh b/milena/mln/draw/box.hh index d7236a8..8032172 100644 --- a/milena/mln/draw/box.hh +++ b/milena/mln/draw/box.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -29,6 +30,8 @@ /*! \file * * \brief Draw a box in an image. + * + * \fixme Rename as box_frame.hh */ # include <mln/core/concept/image.hh> diff --git a/milena/mln/draw/box.hh b/milena/mln/draw/box_plain.hh similarity index 72% copy from milena/mln/draw/box.hh copy to milena/mln/draw/box_plain.hh index d7236a8..ec5b865 100644 --- a/milena/mln/draw/box.hh +++ b/milena/mln/draw/box_plain.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,17 +23,19 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_DRAW_BOX_HH -# define MLN_DRAW_BOX_HH +#ifndef MLN_DRAW_BOX_PLAIN_HH +# define MLN_DRAW_BOX_PLAIN_HH /*! \file * - * \brief Draw a box in an image. + * \brief Draw a plain box in an image. + * + * \fixme Rename as box.hh */ # include <mln/core/concept/image.hh> # include <mln/core/alias/box2d.hh> -# include <mln/data/paste.hh> +# include <mln/data/fill.hh> # include <mln/draw/line.hh> # include <mln/pw/image.hh> # include <mln/pw/cst.hh> @@ -45,10 +47,10 @@ namespace mln namespace draw { - /*! Draw a box at value \p v in image \p ima + /*! Draw a plain box at value \p v in image \p ima * * \param[in,out] ima The image to be drawn. - * \param[in] b the boxto draw. + * \param[in] b the box to draw. * \param[in] v The value to assign to all drawn pixels. * * \pre \p ima has to be initialized. @@ -57,18 +59,18 @@ namespace mln * */ template <typename I, typename B> - void box(Image<I>& ima, - const Box<B>& b, - const mln_value(I)& v); + void box_plain(Image<I>& ima, + const Box<B>& b, + const mln_value(I)& v); # ifndef MLN_INCLUDE_ONLY template <typename I, typename B> inline - void box(Image<I>& ima, - const Box<B>& b, - const mln_value(I)& v) + void box_plain(Image<I>& ima, + const Box<B>& b, + const mln_value(I)& v) { mln_precondition(exact(ima).is_valid()); @@ -77,15 +79,7 @@ namespace mln mln_precondition(exact(ima).has(pmin) && exact(ima).has(pmax)); - mln_psite(I) p1 (pmin[0], pmin[1]); - mln_psite(I) p2 (pmax[0], pmin[1]); - mln_psite(I) p3 (pmin[0], pmax[1]); - mln_psite(I) p4 (pmax[0], pmax[1]); - - draw::line (ima, p1, p2, v); - draw::line (ima, p2, p4, v); - draw::line (ima, p4, p3, v); - draw::line (ima, p3, p1, v); + data::fill((ima | b).rw(), v); } # endif // ! MLN_INCLUDE_ONLY @@ -95,4 +89,4 @@ namespace mln } // end of namespace mln -#endif // ! MLN_DRAW_BOX_HH +#endif // ! MLN_DRAW_BOX_PLAIN_HH -- 1.5.6.5
participants (1)
-
Guillaume Lazzara