Example #1
0
				SPROUT_CONSTEXPR result_type
				operator()(Unit const& u, Unit const& v) const {
					return calc(
						(u - offset_u_ + scale_ / 2) / scale_ * texture_.get().width(),
						(-(v - offset_v_) + scale_ / 2) / scale_ * texture_.get().height()
						);
				}
Example #2
0
				SPROUT_CONSTEXPR result_type
				get_color(unit_type const& x, unit_type const& y) const {
					return is_tile()
						? texture_.get()(
							x < 0
								? texture_.get().width() - 1 - static_cast<std::size_t>(-x) % texture_.get().width()
								: static_cast<std::size_t>(x) % texture_.get().width()
								,
							y < 0
								? texture_.get().height() - 1 - static_cast<std::size_t>(-y) % texture_.get().height()
								: static_cast<std::size_t>(y) % texture_.get().height()
							)
						: x < 0 || x >= texture_.get().width()
							|| y < 0 || y >= texture_.get().height()
							? default_color_
							: texture_.get()(static_cast<std::size_t>(x), static_cast<std::size_t>(y))
						;
				}
Example #3
0
 SPROUT_CONSTEXPR reference operator*() const {
     return count_ != 0
            ? holder_.get()
            : (throw std::out_of_range("value_iterator<>: dereference at out of range"), holder_.get())
            ;
 }
Example #4
0
 operator value_iterator<const_type>() const {
     return value_iterator<const_type>(holder_.get(), count_);
 }
Example #5
0
 SPROUT_CONSTEXPR reference operator[](difference_type n) const {
     return holder_.get();
 }