30 #ifndef MLN_CONVERT_TO_QIMAGE_NOCOPY_HH
31 # define MLN_CONVERT_TO_QIMAGE_NOCOPY_HH
33 # include <QtGui/QImage>
35 # include <mln/core/concept/image.hh>
36 # include <mln/geom/nrows.hh>
37 # include <mln/geom/ncols.hh>
38 # include <mln/border/resize.hh>
41 # include <mln/value/qt/rgb32.hh>
42 # include <mln/value/rgb8.hh>
44 # if QT_VERSION < 0x040000
45 # error "Your version of Qt is too old and is not supported."
64 const I& ima =
exact(ima_);
65 mln_precondition(ima.is_valid());
71 typedef mln_value(I) V;
72 QImage qima((uchar *)(&ima(ima.domain().pmin())),
ncols,
nrows,
73 (ncols + 2 * ima.border()) *
sizeof(V),
74 QImage::Format_RGB32);
80 # if QT_VERSION >= 0x040400
84 QImage to_qimage_nocopy_rgb8(
const Image<I>& ima_)
86 const I& ima =
exact(ima_);
87 mln_precondition(ima.is_valid());
93 typedef mln_value(I) V;
94 QImage qima((uchar *)(&ima(ima.domain().pmin())),
ncols, nrows,
95 (ncols + 2 * ima.
border()) * sizeof(V),
96 QImage::Format_RGB888);
114 template <
typename I>
123 # if QT_VERSION >= 0x040400
125 template <
typename I>
127 QImage to_qimage_nocopy_dispatch(
const Image<I>& ima,
130 return impl::to_qimage_nocopy_rgb8(ima);
136 template <
typename I,
typename V>
141 mlc_abort(I)::check();
146 template <
typename I>
150 typedef mln_value(I) V;
160 template <
typename I>
164 mln_trace(
"convert::to_qimage_nocopy");
166 const I& ima =
exact(ima_);
167 mln_precondition(ima.is_valid());
179 #endif // ! MLN_CONVERT_TO_QIMAGE_NOCOPY_HH