27 #ifndef MLN_CORE_INTERNAL_PIXEL_IMPL_HH
28 # define MLN_CORE_INTERNAL_PIXEL_IMPL_HH
37 # include <mln/core/concept/image.hh>
38 # include <mln/core/internal/force_exact.hh>
39 # include <mln/util/pix.hh>
54 template <
bool is_fastest,
typename I,
typename E>
58 template <
typename I,
typename E>
61 typedef mlc_if(mlc_is_const(I),
const mln_value(I), mln_value(I)) value_ptr_t;
79 template <
typename I,
typename E>
82 typedef mlc_if(mlc_is_const(I),
const mln_value(I), mln_value(I)) value_ptr_t;
83 typedef mlc_unconst(I) unconst_image_t;
91 unsigned offset()
const
93 return value_ptr_ - image_.buffer();
117 template <
typename I,
typename E>
120 :
public pixel_impl_base_< mlc_is(mln_trait_image_speed(I),
121 trait::image::speed::fastest)::value,
124 typedef pixel_impl_base_< mlc_is(mln_trait_image_speed(I),
125 trait::image::speed::fastest)::
value,
169 bool is_valid_() const;
178 template <typename I, typename E>
182 trait::image::speed::fastest)::value,
186 trait::image::speed::fastest)::
value,
195 typedef mln_value(I) value;
198 typedef mln_rvalue(I) rvalue;
206 const I&
ima() const;
216 using super_::image_;
219 using super_::value_ptr_;
225 bool is_valid_() const;
229 #ifndef MLN_INCLUDE_ONLY
233 template <
typename I,
typename E>
238 return this->value_ptr_ != 0 && internal::force_exact<E>(*this).is_valid();
241 template <
typename I,
typename E>
248 template <
typename I,
typename E>
251 pixel_impl_<I, E>::val()
253 mln_precondition(is_valid_());
254 return *this->value_ptr_;
257 template <
typename I,
typename E>
260 pixel_impl_<I, E>::val()
const
262 mln_precondition(is_valid_());
263 return *this->value_ptr_;
266 template <
typename I,
typename E>
272 return const_cast<I&
>(this->image_);
275 template <
typename I,
typename E>
280 return (value**)(& this->value_ptr_);
286 template <
typename I,
typename E>
289 pixel_impl_<const I, E>::is_valid_()
const
291 return this->value_ptr_ != 0 && internal::force_exact<E>(*this).is_valid();
294 template <
typename I,
typename E>
301 template <
typename I,
typename E>
304 pixel_impl_<const I, E>::val()
const
306 mln_precondition(is_valid_());
307 return *this->value_ptr_;
310 template <
typename I,
typename E>
318 template <
typename I,
typename E>
320 const mln_value(I) **
323 return (
const value**)(& this->value_ptr_);
326 #endif // ! MLN_INCLUDE_ONLY
333 #endif // ! MLN_CORE_INTERNAL_PIXEL_IMPL_HH