27 #ifndef MLN_DATA_SPLIT_HH
28 # define MLN_DATA_SPLIT_HH
30 # include <mln/core/concept/image.hh>
31 # include <mln/value/rgb8.hh>
49 template <
typename I,
typename J>
51 split(
const Image<I>& input, Image<J>& r, Image<J>& g, Image<J>& b);
54 # ifndef MLN_INCLUDE_ONLY
57 template <
typename I,
typename J>
59 split(
const Image<I>& input_, Image<J>& r_, Image<J>& g_, Image<J>& b_)
61 mln_trace(
"mln::data::split");
63 const I& input =
exact(input_);
68 mln_assertion(input.is_valid());
69 mlc_is(mln_value(I), value::rgb8)::check();
71 mlc_is(mln_trait_image_value_storage(I),
72 trait::image::value_storage::one_block)::check();
78 typedef const mln_value(I)* in_ptr_t;
79 typedef mln_value(J)* out_ptr_t;
81 in_ptr_t in_ptr = input.buffer();
87 for (
unsigned n = 0; n < input.nelements(); ++n, ++in_ptr)
89 *r_ptr++ = in_ptr->red();
90 *g_ptr++ = in_ptr->green();
91 *b_ptr++ = in_ptr->blue();
97 # endif // ! MLN_INCLUDE_ONLY
103 #endif // ! MLN_DATA_SPLIT_HH