(); static_copy(p,*this); } packed_pixel(int chan0, int chan1) : _bitfield(0) { BOOST_STATIC_ASSERT((num_channels::value==2)); at_c<0>(*this)=chan0; at_c<1>(*this)=chan1; } packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) { BOOST_STATIC_ASSERT((num_channels::value==3)); at_c<0>(*this)=chan0; at_c<1>(*this)=chan1; at_c<2>(*this)=chan2; } packed_pixel(int chan0, int chan1, int chan2, int chan3) : _bitfield(0) { BOOST_STATIC_ASSERT((num_channels::value==4)); at_c<0>(*this)=chan0; at_c<1>(*this)=chan1; at_c<2>(*this)=chan2; at_c<2>(*this)=chan3; } packed_pixel(int chan0, int chan1, int chan2, int chan3, int chan4) : _bitfield(0) { BOOST_STATIC_ASSERT((num_channels::value==5)); at_c<0>(*this)=chan0; at_c<1>(*this)=chan1; at_c<2>(*this)=chan2; at_c<2>(*this)=chan3; at_c<3>(*this)=chan4; } packed_pixel& operator=(const packed_pixel& p) { _bitfield=p._bitfield; return *this; } template packed_pixel& operator=(const P& p) { assign(p, mpl::bool_::value>()); return *this; } template bool operator==(const P& p) const { return equal(p, mpl::bool_::value>()); } template bool operator!=(const P& p) const { return !(*this==p); } private: template static void check_compatible() { gil_function_requires >(); } template void assign(const Pixel& p, mpl::true_) { check_compatible(); static_copy(p,*this); } template bool equal(const Pixel& p, mpl::true_) const { check_compatible(); return static_equal(*this,p); } // Support for assignment/equality comparison of a channel with a grayscale pixel static void check_gray() { BOOST_STATIC_ASSERT((is_same::value)); } template void assign(const Channel& chan, mpl::false_) { check_gray(); at_c<0>(*this)=chan; } template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return at_c<0>(*this)==chan; } public: packed_pixel& operator= (int chan) { check_gray(); at_c<0>(*this)=chan; return *this; } bool operator==(int chan) const { check_gray(); return at_c<0>(*this)==chan; } }; ///////////////////////////// // ColorBasedConcept ///////////////////////////// template struct kth_element_type,K> : public mpl::at_c {}; template struct kth_element_reference_type,K> : public mpl::at_c {}; template struct kth_element_const_reference_type,K> { typedef typename channel_traits::type>::const_reference type; }; template inline typename kth_element_reference_type, K>::type at_c(packed_pixel& p) { return typename kth_element_reference_type, K>::type(&p._bitfield); } template inline typename kth_element_const_reference_type, K>::type at_c(const packed_pixel& p) { return typename kth_element_const_reference_type, K>::type(&p._bitfield); } ///////////////////////////// // PixelConcept ///////////////////////////// // Metafunction predicate that flags packed_pixel as a model of PixelConcept. Required by PixelConcept template struct is_pixel > : public mpl::true_{}; ///////////////////////////// // PixelBasedConcept ///////////////////////////// template struct color_space_type > { typedef typename Layout::color_space_t type; }; template struct channel_mapping_type > { typedef typename Layout::channel_mapping_t type; }; template struct is_planar > : mpl::false_ {}; //////////////////////////////////////////////////////////////////////////////// /// /// Support for interleaved iterators over packed pixel /// //////////////////////////////////////////////////////////////////////////////// /// \defgroup PixelIteratorModelPackedInterleavedPtr Pointer to packed_pixel /// \ingroup PixelIteratorModel /// \brief Iterators over interleaved pixels. /// The pointer packed_pixel* is used as an iterator over interleaved pixels of packed format. Models PixelIteratorConcept, HasDynamicXStepTypeConcept, MemoryBasedIteratorConcept template struct iterator_is_mutable*> : public mpl::bool_::is_mutable> {}; template struct iterator_is_mutable*> : public mpl::false_ {}; } } // namespace boost::gil namespace boost { template struct has_trivial_constructor > : public has_trivial_constructor {}; } #endif
& p) { return typename kth_element_reference_type, K>::type(&p._bitfield); } template inline typename kth_element_const_reference_type, K>::type at_c(const packed_pixel& p) { return typename kth_element_const_reference_type, K>::type(&p._bitfield); } ///////////////////////////// // PixelConcept ///////////////////////////// // Metafunction predicate that flags packed_pixel as a model of PixelConcept. Required by PixelConcept template struct is_pixel > : public mpl::true_{}; ///////////////////////////// // PixelBasedConcept ///////////////////////////// template struct color_space_type > { typedef typename Layout::color_space_t type; }; template struct channel_mapping_type > { typedef typename Layout::channel_mapping_t type; }; template struct is_planar > : mpl::false_ {}; //////////////////////////////////////////////////////////////////////////////// /// /// Support for interleaved iterators over packed pixel /// //////////////////////////////////////////////////////////////////////////////// /// \defgroup PixelIteratorModelPackedInterleavedPtr Pointer to packed_pixel /// \ingroup PixelIteratorModel /// \brief Iterators over interleaved pixels. /// The pointer packed_pixel* is used as an iterator over interleaved pixels of packed format. Models PixelIteratorConcept, HasDynamicXStepTypeConcept, MemoryBasedIteratorConcept template struct iterator_is_mutable*> : public mpl::bool_::is_mutable> {}; template struct iterator_is_mutable*> : public mpl::false_ {}; } } // namespace boost::gil namespace boost { template struct has_trivial_constructor > : public has_trivial_constructor {}; } #endif
& p) { return typename kth_element_const_reference_type, K>::type(&p._bitfield); } ///////////////////////////// // PixelConcept ///////////////////////////// // Metafunction predicate that flags packed_pixel as a model of PixelConcept. Required by PixelConcept template struct is_pixel > : public mpl::true_{}; ///////////////////////////// // PixelBasedConcept ///////////////////////////// template struct color_space_type > { typedef typename Layout::color_space_t type; }; template struct channel_mapping_type > { typedef typename Layout::channel_mapping_t type; }; template struct is_planar > : mpl::false_ {}; //////////////////////////////////////////////////////////////////////////////// /// /// Support for interleaved iterators over packed pixel /// //////////////////////////////////////////////////////////////////////////////// /// \defgroup PixelIteratorModelPackedInterleavedPtr Pointer to packed_pixel /// \ingroup PixelIteratorModel /// \brief Iterators over interleaved pixels. /// The pointer packed_pixel* is used as an iterator over interleaved pixels of packed format. Models PixelIteratorConcept, HasDynamicXStepTypeConcept, MemoryBasedIteratorConcept template struct iterator_is_mutable*> : public mpl::bool_::is_mutable> {}; template struct iterator_is_mutable*> : public mpl::false_ {}; } } // namespace boost::gil namespace boost { template struct has_trivial_constructor > : public has_trivial_constructor {}; } #endif
/// \ingroup PixelIteratorModel /// \brief Iterators over interleaved pixels. /// The pointer packed_pixel
* is used as an iterator over interleaved pixels of packed format. Models PixelIteratorConcept, HasDynamicXStepTypeConcept, MemoryBasedIteratorConcept template struct iterator_is_mutable*> : public mpl::bool_::is_mutable> {}; template struct iterator_is_mutable*> : public mpl::false_ {}; } } // namespace boost::gil namespace boost { template struct has_trivial_constructor > : public has_trivial_constructor {}; } #endif
{}; } #endif