Ticket #3041: gil.patch
File gil.patch, 10.7 KB (added by , 13 years ago) |
---|
-
boost/gil/bit_aligned_pixel_reference.hpp
145 145 146 146 // Construct from another compatible pixel type 147 147 bit_aligned_pixel_reference(const bit_aligned_pixel_reference& p) : _bit_range(p._bit_range) {} 148 template <typename BF, typename CR> bit_aligned_pixel_reference(packed_pixel<BF,CR,Layout>& p) : _bit_range(static_cast<data_ptr_t>(& at_c<0>(p)),at_c<0>(p).first_bit()) {148 template <typename BF, typename CR> bit_aligned_pixel_reference(packed_pixel<BF,CR,Layout>& p) : _bit_range(static_cast<data_ptr_t>(&gil::at_c<0>(p)), gil::at_c<0>(p).first_bit()) { 149 149 check_compatible<packed_pixel<BF,CR,Layout> >(); 150 150 } 151 151 -
boost/gil/color_base.hpp
155 155 homogeneous_color_base(Element v0, Element v1, Element v2) : _v0(v0), _v1(v1), _v2(v2) {} 156 156 157 157 template <typename E2, typename L2> homogeneous_color_base(const homogeneous_color_base<E2,L2,3>& c) : 158 _v0( at_c<mapping_transform<Layout,L2,0>::value>(c)),159 _v1( at_c<mapping_transform<Layout,L2,1>::value>(c)),160 _v2( at_c<mapping_transform<Layout,L2,2>::value>(c)) {}158 _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)), 159 _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)), 160 _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {} 161 161 162 162 // Support for l-value reference proxy copy construction 163 163 template <typename E2, typename L2> homogeneous_color_base( homogeneous_color_base<E2,L2,3>& c) : 164 _v0( at_c<mapping_transform<Layout,L2,0>::value>(c)),165 _v1( at_c<mapping_transform<Layout,L2,1>::value>(c)),166 _v2( at_c<mapping_transform<Layout,L2,2>::value>(c)) {}164 _v0(gil::at_c<mapping_transform<Layout,L2,0>::value>(c)), 165 _v1(gil::at_c<mapping_transform<Layout,L2,1>::value>(c)), 166 _v2(gil::at_c<mapping_transform<Layout,L2,2>::value>(c)) {} 167 167 168 168 // Support for planar_pixel_iterator construction and dereferencing 169 169 template <typename P> homogeneous_color_base(P* p,bool) : -
boost/gil/color_base_algorithm.hpp
101 101 template <typename ColorBase, int K> struct kth_semantic_element_reference_type { 102 102 BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c<typename ColorBase::layout_t::channel_mapping_t,K>::type::value)); 103 103 typedef typename kth_element_reference_type<ColorBase,semantic_index>::type type; 104 static type get(ColorBase& cb) { return at_c<semantic_index>(cb); }104 static type get(ColorBase& cb) { return gil::at_c<semantic_index>(cb); } 105 105 }; 106 106 107 107 /// \brief Specifies the return type of the constant semantic_at_c<K>(color_base); … … 109 109 template <typename ColorBase, int K> struct kth_semantic_element_const_reference_type { 110 110 BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c<typename ColorBase::layout_t::channel_mapping_t,K>::type::value)); 111 111 typedef typename kth_element_const_reference_type<ColorBase,semantic_index>::type type; 112 static type get(const ColorBase& cb) { return at_c<semantic_index>(cb); }112 static type get(const ColorBase& cb) { return gil::at_c<semantic_index>(cb); } 113 113 }; 114 114 115 115 /// \brief A mutable accessor to the K-th semantic element of a color base -
boost/gil/image_view_factory.hpp
102 102 BOOST_STATIC_ASSERT((!is_planar<HomogeneousView>::value && view_is_basic<HomogeneousView>::value)); 103 103 BOOST_STATIC_ASSERT((boost::is_pointer<typename HomogeneousView::x_iterator>::value)); 104 104 105 return & at_c<0>(view(0,0));105 return &gil::at_c<0>(view(0,0)); 106 106 } 107 107 108 108 /// \ingroup ImageViewConstructors … … 430 430 typedef typename type::xy_locator locator_t; 431 431 typedef typename type::x_iterator x_iterator_t; 432 432 typedef typename iterator_adaptor_get_base<x_iterator_t>::type x_iterator_base_t; 433 x_iterator_t sit(x_iterator_base_t(& at_c<K>(src(0,0))),src.pixels().pixel_size());433 x_iterator_t sit(x_iterator_base_t(&gil::at_c<K>(src(0,0))),src.pixels().pixel_size()); 434 434 return type(src.dimensions(),locator_t(sit, src.pixels().row_size())); 435 435 } 436 436 }; … … 444 444 typedef typename view_type<channel_t, gray_layout_t, false, false, view_is_mutable<View>::value>::type type; 445 445 static type make(const View& src) { 446 446 typedef typename type::x_iterator x_iterator_t; 447 return interleaved_view(src.width(),src.height(),(x_iterator_t)& at_c<K>(src(0,0)), src.pixels().row_size());447 return interleaved_view(src.width(),src.height(),(x_iterator_t)&gil::at_c<K>(src(0,0)), src.pixels().row_size()); 448 448 } 449 449 }; 450 450 … … 494 494 template <typename P> kth_channel_deref_fn(const kth_channel_deref_fn<K,P>&) {} 495 495 496 496 result_type operator()(argument_type srcP) const { 497 return result_type( at_c<K>(srcP));497 return result_type(gil::at_c<K>(srcP)); 498 498 } 499 499 }; 500 500 -
boost/gil/packed_pixel.hpp
81 81 } 82 82 packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) { 83 83 BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==3)); 84 at_c<0>(*this)=chan0; at_c<1>(*this)=chan1;at_c<2>(*this)=chan2;84 gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; gil::at_c<2>(*this)=chan2; 85 85 } 86 86 packed_pixel(int chan0, int chan1, int chan2, int chan3) : _bitfield(0) { 87 87 BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==4)); -
boost/gil/pixel.hpp
143 143 144 144 private: 145 145 static void check_gray() { BOOST_STATIC_ASSERT((is_same<typename Layout::color_space_t, gray_t>::value)); } 146 template <typename Channel> void assign(const Channel& chan, mpl::false_) { check_gray(); at_c<0>(*this)=chan; }147 template <typename Channel> bool equal (const Channel& chan, mpl::false_) const { check_gray(); return at_c<0>(*this)==chan; }146 template <typename Channel> void assign(const Channel& chan, mpl::false_) { check_gray(); gil::at_c<0>(*this)=chan; } 147 template <typename Channel> bool equal (const Channel& chan, mpl::false_) const { check_gray(); return gil::at_c<0>(*this)==chan; } 148 148 public: 149 pixel& operator= (channel_t chan) { check_gray(); at_c<0>(*this)=chan; return *this; }150 bool operator==(channel_t chan) const { check_gray(); return at_c<0>(*this)==chan; }149 pixel& operator= (channel_t chan) { check_gray(); gil::at_c<0>(*this)=chan; return *this; } 150 bool operator==(channel_t chan) const { check_gray(); return gil::at_c<0>(*this)==chan; } 151 151 }; 152 152 153 153 ///////////////////////////// -
boost/gil/planar_pixel_iterator.hpp
109 109 reference operator->() const { return **this; } 110 110 111 111 // PERFORMANCE_CHECK: Remove? 112 bool operator< (const planar_pixel_iterator& ptr) const { return at_c<0>(*this)<at_c<0>(ptr); }113 bool operator!=(const planar_pixel_iterator& ptr) const { return at_c<0>(*this)!=at_c<0>(ptr); }112 bool operator< (const planar_pixel_iterator& ptr) const { return gil::at_c<0>(*this)< gil::at_c<0>(ptr); } 113 bool operator!=(const planar_pixel_iterator& ptr) const { return gil::at_c<0>(*this)!=gil::at_c<0>(ptr); } 114 114 private: 115 115 friend class boost::iterator_core_access; 116 116 … … 119 119 void advance(ptrdiff_t d) { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric<ChannelPtr,ptrdiff_t>(),d)); } 120 120 reference dereference() const { return this->template deref<reference>(); } 121 121 122 ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return at_c<0>(it)-at_c<0>(*this); }123 bool equal(const planar_pixel_iterator& it) const { return at_c<0>(*this)==at_c<0>(it); }122 ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return gil::at_c<0>(it)-gil::at_c<0>(*this); } 123 bool equal(const planar_pixel_iterator& it) const { return gil::at_c<0>(*this)==gil::at_c<0>(it); } 124 124 }; 125 125 126 126 namespace detail { -
libs/gil/test/pixel.cpp
34 34 // Testing pixel references and values, pixel operations, color conversion 35 35 36 36 using namespace boost::gil; 37 using namespace std;37 using std::swap; 38 38 using namespace boost; 39 39 40 void error_if(bool condition); 40 41 41 42 struct increment { … … 63 64 64 65 // test homogeneous algorithms - fill, max, min 65 66 static const int num_chan = num_channels<typename C2::pixel_t>::value; 66 static_fill(C2::_pixel, at_c<0>(C1::_pixel)+1);67 error_if( at_c<0>(C2::_pixel) !=at_c<num_chan-1>(C2::_pixel));67 static_fill(C2::_pixel, gil::at_c<0>(C1::_pixel)+1); 68 error_if(gil::at_c<0>(C2::_pixel) != gil::at_c<num_chan-1>(C2::_pixel)); 68 69 69 70 C2::_pixel = C1::_pixel; 70 71 error_if(static_max(C2::_pixel) != static_max(C1::_pixel)); … … 107 108 error_if(C1::_pixel!=C2::_pixel); 108 109 109 110 static_generate(C2::_pixel, set_to_one()); 110 error_if( at_c<0>(C2::_pixel) != 1);111 error_if(gil::at_c<0>(C2::_pixel) != 1); 111 112 112 113 // Test swap if both are mutable and if their value type is the same 113 114 // (We know the second one is mutable) … … 313 314 bgr8_pixel_t bgr8(rgb8); 314 315 error_if(bgr8[0] == rgb8[0]); 315 316 error_if(dynamic_at_c(bgr8,0) == dynamic_at_c(rgb8,0)); 316 error_if( at_c<0>(bgr8) ==at_c<0>(rgb8));317 error_if(gil::at_c<0>(bgr8) == gil::at_c<0>(rgb8)); 317 318 error_if(semantic_at_c<0>(bgr8) != semantic_at_c<0>(rgb8)); 318 319 error_if(get_color(bgr8,blue_t()) != get_color(rgb8,blue_t())); 319 320