26 #ifndef MLN_DATA_SPLIT_HH
27 # define MLN_DATA_SPLIT_HH
29 # include <mln/core/concept/image.hh>
30 # include <mln/value/rgb8.hh>
44 template <
typename I,
typename J>
46 split(
const Image<I>& input_, Image<J>& r_, Image<J>& g_, Image<J>& b_);
49 # ifndef MLN_INCLUDE_ONLY
52 template <
typename I,
typename J>
54 split(
const Image<I>& input_, Image<J>& r_, Image<J>& g_, Image<J>& b_)
56 trace::entering(
"mln::data::split");
58 const I& input = exact(input_);
63 mln_assertion(input.is_valid());
66 mlc_is(mln_trait_image_value_storage(I),
67 trait::image::value_storage::one_block)::check();
73 typedef const mln_value(I)* in_ptr_t;
74 typedef mln_value(J)* out_ptr_t;
76 in_ptr_t in_ptr = input.buffer();
82 for (
unsigned n = 0; n < input.nelements(); ++n, ++in_ptr)
84 *r_ptr++ = in_ptr->red();
85 *g_ptr++ = in_ptr->green();
86 *b_ptr++ = in_ptr->blue();
89 trace::exiting(
"mln::data::split");
93 # endif // ! MLN_INCLUDE_ONLY
99 #endif // ! MLN_DATA_SPLIT_HH