URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-11 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Update resize.
* border/resize.hh: Update for image_if and sub_image.
* core/image1d.hh,
* core/image3d.hh: (swap_) Update.
* core/translate_image.hh,
* display/show.hh: Update.
---
border/resize.hh | 26 ++++++++++++++++++--------
core/image1d.hh | 24 +++---------------------
core/image3d.hh | 26 +++-----------------------
core/translate_image.hh | 13 +++++++++++--
display/show.hh | 4 +++-
5 files changed, 38 insertions(+), 55 deletions(-)
Index: trunk/milena/mln/core/translate_image.hh
===================================================================
--- trunk/milena/mln/core/translate_image.hh (revision 1313)
+++ trunk/milena/mln/core/translate_image.hh (revision 1314)
@@ -76,9 +76,18 @@
typedef trait::image::category::domain_morpher category;
- typedef mln_trait_image_io_from_(I) io;
+// typedef mln_trait_image_access_from(I) access;
+// typedef mln_trait_image_space_from(I) space;
+// typedef mln_trait_image_size_from(I) size;
+// typedef mln_trait_image_support_from(I) support;
+
+// typedef mln_trait_image_border_from(I) border;
+ typedef mln_trait_image_data_from(I) data;
+ typedef mln_trait_image_io_from(I) io;
+// typedef mln_trait_image_speed_from(I) speed;
- typedef mln_trait_image_data_from_(I) data;
+// typedef mln_trait_image_io_from_(I) io;
+// typedef mln_trait_image_data_from_(I) data;
};
Index: trunk/milena/mln/core/image1d.hh
===================================================================
--- trunk/milena/mln/core/image1d.hh (revision 1313)
+++ trunk/milena/mln/core/image1d.hh (revision 1314)
@@ -295,27 +295,9 @@
data_< image1d<T> >::swap_(data_< image1d<T> >& other_)
{
- T* sw_buffer_ = this->buffer_;
- this->buffer_ = other_.buffer_;
- other_.buffer_ = sw_buffer_;
-
- T* sw_array_ = this->array_;
- this->array_ = other_.array_;
- other_.array_ = sw_array_;
-
- unsigned sw_bdr_ = this->bdr_;
- this->bdr_ = other_.bdr_;
- other_.bdr_ = sw_bdr_;
-
- /// box1d vb_ virtual box, i.e., box including the virtual border
- box1d sw_vb_ = this->vb_;
- this->vb_ = other_.vb_;
- other_.vb_ = sw_vb_;
-
- /// box1d b_ theoretical box
- box1d sw_b_ = this->b_;
- this->b_ = other_.b_;
- other_.b_ = sw_b_;
+ data_< image1d<T> > self_ = *this;
+ *this = other_;
+ other_ = self_;
}
Index: trunk/milena/mln/core/image3d.hh
===================================================================
--- trunk/milena/mln/core/image3d.hh (revision 1313)
+++ trunk/milena/mln/core/image3d.hh (revision 1314)
@@ -334,29 +334,9 @@
void
data_< image3d<T> >::swap_(data_< image3d<T> >& other_)
{
-
- T* sw_buffer_ = this->buffer_;
- this->buffer_ = other_.buffer_;
- other_.buffer_ = sw_buffer_;
-
- T*** sw_array_ = this->array_;
- this->array_ = other_.array_;
- other_.array_ = sw_array_;
-
- unsigned sw_bdr_ = this->bdr_;
- this->bdr_ = other_.bdr_;
- other_.bdr_ = sw_bdr_;
-
- /// box3d vb_ virtual box, i.e., box including the virtual border
- box3d sw_vb_ = this->vb_;
- this->vb_ = other_.vb_;
- other_.vb_ = sw_vb_;
-
- /// box3d b_ theoretical box
- box3d sw_b_ = this->b_;
- this->b_ = other_.b_;
- other_.b_ = sw_b_;
-
+ data_< image3d<T> > self_ = *this;
+ *this = other_;
+ other_ = self_;
}
template <typename T>
Index: trunk/milena/mln/border/resize.hh
===================================================================
--- trunk/milena/mln/border/resize.hh (revision 1313)
+++ trunk/milena/mln/border/resize.hh (revision 1314)
@@ -36,10 +36,10 @@
# include <cstring>
# include <mln/core/concept/image.hh>
-# include <mln/core/image2d.hh>
# include <mln/core/clone.hh>
# include <mln/level/fill.hh>
-
+# include <mln/metal/is_not.hh>
+# include <mln/border/get.hh>
namespace mln
{
@@ -69,15 +69,25 @@
namespace impl
{
template <typename I>
- void resize_(const Image<I>& ima_, unsigned new_border)
+ void resize_(const I& ima_, trait::image::category::morpher,
+ unsigned new_border)
{
- I& ima = const_cast<I&> (exact(ima_));
+ return resize ( *ima_.delegatee_(), new_border);
+ }
+
+
+ template <typename I>
+ void resize_(const I& ima_, trait::image::category::primary,
+ unsigned new_border)
+ {
+ I& ima = const_cast<I&> (ima_);
I src = clone(ima);
ima.resize_(new_border);
level::fill(ima, src);
}
+
} // end of namespace mln::border::resize
/// Facade.
@@ -85,13 +95,13 @@
template <typename I>
void resize(const Image<I>& ima_, unsigned thickness)
{
- mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
+ mlc_is(mln_trait_image_border(I), trait::image::border::some)::check();
const I& ima = exact(ima_);
mln_precondition(ima.has_data());
- if (ima.border() >= thickness)
+ if (border::get(ima) >= thickness)
return;
- impl::resize_(ima, thickness);
- mln_postcondition(ima.border() >= thickness);
+ impl::resize_(ima, mln_trait_image_category(I)(), thickness);
+ mln_postcondition(border::get(ima) >= thickness);
return;
}
Index: trunk/milena/mln/display/show.hh
===================================================================
--- trunk/milena/mln/display/show.hh (revision 1313)
+++ trunk/milena/mln/display/show.hh (revision 1314)
@@ -77,7 +77,9 @@
std::string path_tmp = tmp;
io::ppm::save(out, path_tmp);
- std::string s = cmd + " " + path_tmp;
+
+
+ std::string s = cmd + " " + path_tmp + " &";
system (s.c_str ());
}