::type max_(const P& p) { return mutable_max(min_max_recur::max_(p),semantic_at_c(p)); } template static typename element_reference_type::type max_( P& p) { return mutable_max(min_max_recur::max_(p),semantic_at_c(p)); } template static typename element_const_reference_type::type min_(const P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } template static typename element_reference_type::type min_( P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } }; // termination condition of the compile-time recursion for min/max element template <> struct min_max_recur<1> { template static typename element_const_reference_type::type max_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type max_( P& p) { return mutable_max(min_max_recur::max_(p),semantic_at_c(p)); } template static typename element_const_reference_type::type min_(const P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } template static typename element_reference_type::type min_( P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } }; // termination condition of the compile-time recursion for min/max element template <> struct min_max_recur<1> { template static typename element_const_reference_type::type max_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type min_(const P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } template static typename element_reference_type::type min_( P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } }; // termination condition of the compile-time recursion for min/max element template <> struct min_max_recur<1> { template static typename element_const_reference_type::type max_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type min_( P& p) { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } }; // termination condition of the compile-time recursion for min/max element template <> struct min_max_recur<1> { template static typename element_const_reference_type::type max_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type max_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type max_( P& p) { return semantic_at_c<0>(p); } template static typename element_const_reference_type::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type min_(const P& p) { return semantic_at_c<0>(p); } template static typename element_reference_type::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type min_( P& p) { return semantic_at_c<0>(p); } }; } // namespace detail /** \defgroup ColorBaseAlgorithmMinMax static_min, static_max \ingroup ColorBaseAlgorithm \brief Equivalents to std::min_element and std::max_element for homogeneous color bases Example: \code rgb8_pixel_t pixel(10,20,30); assert(pixel[2] == 30); static_max(pixel) = static_min(pixel); assert(pixel[2] == 10); \endcode \{ */ template GIL_FORCEINLINE typename element_const_reference_type::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template GIL_FORCEINLINE typename element_const_reference_type::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template GIL_FORCEINLINE typename element_reference_type::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template
::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} /** \defgroup ColorBaseAlgorithmEqual static_equal \ingroup ColorBaseAlgorithm \brief Equivalent to std::equal. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red(0,0,255); assert(rgb_red[0]==255 && bgr_red[0]==0); assert(static_equal(rgb_red,bgr_red)); assert(rgb_red==bgr_red); // operator== invokes static_equal \endcode \{ */ template GIL_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} /** \defgroup ColorBaseAlgorithmCopy static_copy \ingroup ColorBaseAlgorithm \brief Equivalent to std::copy. Pairs the elements semantically Example: \code rgb8_pixel_t rgb_red(255,0,0); bgr8_pixel_t bgr_red; static_copy(rgb_red, bgr_red); // same as bgr_red = rgb_red assert(rgb_red[0] == 255 && bgr_red[0] == 0); assert(rgb_red == bgr_red); \endcode \{ */ template GIL_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} /** \defgroup ColorBaseAlgorithmFill static_fill \ingroup ColorBaseAlgorithm \brief Equivalent to std::fill. Example: \code rgb8_pixel_t p; static_fill(p, 10); assert(p == rgb8_pixel_t(10,10,10)); \endcode \{ */ template GIL_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} /** \defgroup ColorBaseAlgorithmGenerate static_generate \ingroup ColorBaseAlgorithm \brief Equivalent to std::generate. Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer. \code struct consecutive_fn { int& _current; consecutive_fn(int& start) : _current(start) {} int operator()() { return _current++; } }; rgb8_pixel_t p; int start=0; static_generate(p, consecutive_fn(start)); assert(p == rgb8_pixel_t(0,1,2)); \endcode \{ */ template GIL_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} /** \defgroup ColorBaseAlgorithmTransform static_transform \ingroup ColorBaseAlgorithm \brief Equivalent to std::transform. Pairs the elements semantically Example: Write a generic function that adds two pixels into a homogeneous result pixel. \code template struct my_plus { template Result operator()(T1 f1, T2 f2) const { return f1+f2; } }; template void sum_channels(const Pixel1& p1, const Pixel2& p2, Pixel3& result) { typedef typename channel_type::type result_channel_t; static_transform(p1,p2,result,my_plus()); } rgb8_pixel_t p1(1,2,3); bgr8_pixel_t p2(3,2,1); rgb8_pixel_t result; sum_channels(p1,p2,result); assert(result == rgb8_pixel_t(2,4,6)); \endcode \{ */ //static_transform with one source template GIL_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template GIL_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template GIL_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template GIL_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} /** \defgroup ColorBaseAlgorithmForEach static_for_each \ingroup ColorBaseAlgorithm \brief Equivalent to std::for_each. Pairs the elements semantically Example: Use static_for_each to increment a planar pixel iterator \code struct increment { template void operator()(Incrementable& x) const { ++x; } }; template void increment_elements(ColorBase& cb) { static_for_each(cb, increment()); } bits8 red[2], green[2], blue[2]; rgb8c_planar_ptr_t p1(red,green,blue); rgb8c_planar_ptr_t p2=p1; increment_elements(p1); ++p2; assert(p1 == p2); \endcode \{ */ //static_for_each with one source template GIL_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template