add boost on mac
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_CHANNEL_TYPE_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_CHANNEL_TYPE_HPP
|
||||
|
||||
#include <boost/gil/extension/toolbox/dynamic_images.hpp>
|
||||
#include <boost/gil/extension/toolbox/metafunctions/get_num_bits.hpp>
|
||||
#include <boost/gil/extension/toolbox/metafunctions/is_homogeneous.hpp>
|
||||
|
||||
#include <boost/gil/bit_aligned_pixel_reference.hpp>
|
||||
#include <boost/gil/channel.hpp>
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/utility/enable_if.hpp> // boost::lazy_enable_if
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// channel_type metafunction
|
||||
/// \brief Generates the channel type for
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct gen_chan_ref
|
||||
{
|
||||
using type = packed_dynamic_channel_reference
|
||||
<
|
||||
B,
|
||||
mpl::at_c<C, 0>::type::value,
|
||||
M
|
||||
>;
|
||||
};
|
||||
|
||||
//! This implementation works for bit_algined_pixel_reference
|
||||
//! with a homogeneous channel layout.
|
||||
//! The result type will be a packed_dynamic_channel_reference, since the
|
||||
//! offset info will be missing.
|
||||
|
||||
// bit_aligned_pixel_reference
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct channel_type< bit_aligned_pixel_reference<B,C,L,M> >
|
||||
: lazy_enable_if< is_homogeneous< bit_aligned_pixel_reference< B, C, L, M > >
|
||||
, gen_chan_ref< B, C, L, M >
|
||||
> {};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct channel_type<const bit_aligned_pixel_reference<B,C,L,M> >
|
||||
: lazy_enable_if< is_homogeneous< bit_aligned_pixel_reference< B, C, L, M > >
|
||||
, gen_chan_ref< B, C, L, M >
|
||||
> {};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct gen_chan_ref_p
|
||||
{
|
||||
using type = packed_dynamic_channel_reference
|
||||
<
|
||||
B,
|
||||
get_num_bits<typename mpl::at_c<C, 0>::type>::value,
|
||||
true
|
||||
>;
|
||||
};
|
||||
|
||||
// packed_pixel
|
||||
template < typename BitField
|
||||
, typename ChannelRefVec
|
||||
, typename Layout
|
||||
>
|
||||
struct channel_type< packed_pixel< BitField
|
||||
, ChannelRefVec
|
||||
, Layout
|
||||
>
|
||||
> : lazy_enable_if< is_homogeneous< packed_pixel< BitField
|
||||
, ChannelRefVec
|
||||
, Layout
|
||||
>
|
||||
>
|
||||
, gen_chan_ref_p< BitField
|
||||
, ChannelRefVec
|
||||
, Layout
|
||||
>
|
||||
> {};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct channel_type< const packed_pixel< B, C, L > >
|
||||
: lazy_enable_if< is_homogeneous<packed_pixel< B, C, L > >
|
||||
, gen_chan_ref_p< B, C, L >
|
||||
>
|
||||
{};
|
||||
|
||||
template<>
|
||||
struct channel_type< any_image_pixel_t >
|
||||
{
|
||||
using type = any_image_channel_t;
|
||||
};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// Copyright 2010 Fabien Castan, Christian Henning
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_CHANNEL_VIEW_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_CHANNEL_VIEW_HPP
|
||||
|
||||
#include <boost/gil/image_view_factory.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace gil {
|
||||
|
||||
template < typename Channel
|
||||
, typename View
|
||||
>
|
||||
struct channel_type_to_index
|
||||
{
|
||||
static const int value = detail::type_to_index< typename color_space_type< View >::type // color (mpl::vector)
|
||||
, Channel // channel type
|
||||
>::value; //< index of the channel in the color (mpl::vector)
|
||||
};
|
||||
|
||||
template< typename Channel
|
||||
, typename View
|
||||
>
|
||||
struct channel_view_type : public kth_channel_view_type< channel_type_to_index< Channel
|
||||
, View
|
||||
>::value
|
||||
, View
|
||||
>
|
||||
{
|
||||
static const int index = channel_type_to_index< Channel
|
||||
, View
|
||||
>::value;
|
||||
|
||||
using parent_t = kth_channel_view_type<index, View>;
|
||||
using type = typename parent_t::type;
|
||||
|
||||
static type make( const View& src )
|
||||
{
|
||||
return parent_t::make( src );
|
||||
}
|
||||
};
|
||||
|
||||
/// \ingroup ImageViewTransformationsKthChannel
|
||||
template< typename Channel
|
||||
, typename View
|
||||
>
|
||||
typename channel_view_type< Channel
|
||||
, View
|
||||
>::type channel_view( const View& src )
|
||||
{
|
||||
return channel_view_type< Channel
|
||||
, View
|
||||
>::make( src );
|
||||
}
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_NUM_BITS_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_NUM_BITS_HPP
|
||||
|
||||
#include <boost/gil/channel.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/size_t.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// get_num_bits metafunctions
|
||||
/// \brief Determines the numbers of bits for the given channel type.
|
||||
|
||||
template <typename T, class = void >
|
||||
struct get_num_bits;
|
||||
|
||||
template< typename B, int I, int S, bool M >
|
||||
struct get_num_bits< packed_channel_reference< B, I, S, M > > : mpl::int_< S >
|
||||
{};
|
||||
|
||||
template< typename B, int I, int S, bool M >
|
||||
struct get_num_bits< const packed_channel_reference< B, I, S, M > > : mpl::int_< S >
|
||||
{};
|
||||
|
||||
template<typename B, int I, bool M>
|
||||
struct get_num_bits< packed_dynamic_channel_reference< B, I, M > > : mpl::int_< I >
|
||||
{};
|
||||
|
||||
template<typename B, int I, bool M>
|
||||
struct get_num_bits< const packed_dynamic_channel_reference< B, I, M > > : mpl::int_< I >
|
||||
{};
|
||||
|
||||
template< int N >
|
||||
struct get_num_bits< packed_channel_value< N > > : mpl::int_< N >
|
||||
{};
|
||||
|
||||
template< int N >
|
||||
struct get_num_bits< const packed_channel_value< N > > : mpl::int_< N >
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct get_num_bits
|
||||
<
|
||||
T,
|
||||
typename std::enable_if
|
||||
<
|
||||
mpl::and_
|
||||
<
|
||||
is_integral<T>,
|
||||
mpl::not_<is_class<T>>
|
||||
>::value
|
||||
>::type
|
||||
> : mpl::size_t<sizeof(T) * 8>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_PIXEL_TYPE_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_PIXEL_TYPE_HPP
|
||||
|
||||
#include <boost/gil/extension/toolbox/dynamic_images.hpp>
|
||||
#include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// get_pixel_type metafunction
|
||||
/// \brief Depending on Image this function generates either
|
||||
/// the pixel type or the reference type in case
|
||||
/// the image is bit_aligned.
|
||||
template< typename View >
|
||||
struct get_pixel_type : mpl::if_< typename is_bit_aligned< typename View::value_type >::type
|
||||
, typename View::reference
|
||||
, typename View::value_type
|
||||
> {};
|
||||
|
||||
template< typename ImageViewTypes >
|
||||
struct get_pixel_type< any_image_view< ImageViewTypes > >
|
||||
{
|
||||
using type = any_image_pixel_t;
|
||||
};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_BIT_ALIGNED_TYPE_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_BIT_ALIGNED_TYPE_HPP
|
||||
|
||||
#include <boost/gil/bit_aligned_pixel_reference.hpp>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// is_bit_aligned metafunctions
|
||||
/// \brief Determines whether the given type is bit_aligned.
|
||||
|
||||
template< typename PixelRef >
|
||||
struct is_bit_aligned : mpl::false_{};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct is_bit_aligned<bit_aligned_pixel_reference<B,C,L,M> > : mpl::true_{};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct is_bit_aligned<const bit_aligned_pixel_reference<B,C,L,M> > : mpl::true_{};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct is_bit_aligned<packed_pixel<B,C,L> > : mpl::true_{};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct is_bit_aligned<const packed_pixel<B,C,L> > : mpl::true_{};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_HOMOGENEOUS_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_HOMOGENEOUS_HPP
|
||||
|
||||
#include <boost/gil/pixel.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// is_homogeneous metafunctions
|
||||
/// \brief Determines if a pixel types are homogeneous.
|
||||
|
||||
template<typename C,typename CMP, int Next, int Last> struct is_homogeneous_impl;
|
||||
|
||||
template<typename C,typename CMP, int Last>
|
||||
struct is_homogeneous_impl<C,CMP,Last,Last> : mpl::true_{};
|
||||
|
||||
template<typename C,typename CMP, int Next, int Last>
|
||||
struct is_homogeneous_impl : mpl::and_< is_homogeneous_impl< C, CMP,Next + 1, Last >
|
||||
, is_same< CMP, typename mpl::at_c<C,Next>::type
|
||||
> > {};
|
||||
|
||||
template < typename P > struct is_homogeneous : mpl::false_ {};
|
||||
|
||||
// pixel
|
||||
template < typename C, typename L > struct is_homogeneous< pixel<C,L> > : mpl::true_ {};
|
||||
template < typename C, typename L > struct is_homogeneous<const pixel<C,L> > : mpl::true_ {};
|
||||
template < typename C, typename L > struct is_homogeneous< pixel<C,L>& > : mpl::true_ {};
|
||||
template < typename C, typename L > struct is_homogeneous<const pixel<C,L>& > : mpl::true_ {};
|
||||
|
||||
// planar pixel reference
|
||||
template <typename Channel, typename ColorSpace>
|
||||
struct is_homogeneous< planar_pixel_reference< Channel, ColorSpace > > : mpl::true_ {};
|
||||
template <typename Channel, typename ColorSpace>
|
||||
struct is_homogeneous< const planar_pixel_reference< Channel, ColorSpace > > : mpl::true_ {};
|
||||
|
||||
template<typename C,typename CMP, int I,int Last>
|
||||
struct is_homogeneous_impl_p {};
|
||||
|
||||
// for packed_pixel
|
||||
template <typename B, typename C, typename L >
|
||||
struct is_homogeneous<packed_pixel< B, C, L > >
|
||||
: is_homogeneous_impl_p< C
|
||||
, typename mpl::at_c< C, 0 >::type
|
||||
, 1
|
||||
, mpl::size< C >::value
|
||||
> {};
|
||||
|
||||
template< typename B
|
||||
, typename C
|
||||
, typename L
|
||||
>
|
||||
struct is_homogeneous< const packed_pixel< B, C, L > >
|
||||
: is_homogeneous_impl_p< C
|
||||
, typename mpl::at_c<C,0>::type
|
||||
, 1
|
||||
, mpl::size< C >::value
|
||||
> {};
|
||||
|
||||
// for bit_aligned_pixel_reference
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct is_homogeneous<bit_aligned_pixel_reference<B,C,L,M> >
|
||||
: is_homogeneous_impl<C,typename mpl::at_c<C,0>::type,1,mpl::size<C>::value>
|
||||
{};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct is_homogeneous<const bit_aligned_pixel_reference<B,C,L,M> >
|
||||
: is_homogeneous_impl<C,typename mpl::at_c<C,0>::type,1,mpl::size<C>::value>
|
||||
{};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_SIMILAR_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_SIMILAR_HPP
|
||||
|
||||
#include <boost/gil/channel.hpp>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// is_similar metafunctions
|
||||
/// \brief Determines if two pixel types are similar.
|
||||
|
||||
template< typename A, typename B >
|
||||
struct is_similar : mpl::false_ {};
|
||||
|
||||
template<typename A>
|
||||
struct is_similar< A, A > : mpl::true_ {};
|
||||
|
||||
template<typename B,int I, int S, bool M, int I2>
|
||||
struct is_similar< packed_channel_reference< B, I, S, M >
|
||||
, packed_channel_reference< B, I2, S, M >
|
||||
> : mpl::true_ {};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_PIXEL_BIT_SIZE_HPP
|
||||
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_PIXEL_BIT_SIZE_HPP
|
||||
|
||||
#include <boost/gil/bit_aligned_pixel_reference.hpp>
|
||||
#include <boost/gil/packed_pixel.hpp>
|
||||
|
||||
#include <boost/mpl/accumulate.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
namespace boost{ namespace gil {
|
||||
|
||||
/// pixel_bit_size metafunctions
|
||||
/// \brief Accumulates the all channel size.
|
||||
///
|
||||
/// \code
|
||||
/// using image_t = bit_aligned_image5_type<16, 16, 16, 8, 8, devicen_layout_t<5>>::type;
|
||||
/// const int size = pixel_bit_size<image_t::view_t::reference>::value;
|
||||
/// \endcode
|
||||
template< typename PixelRef >
|
||||
struct pixel_bit_size : mpl::int_<0> {};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct pixel_bit_size<bit_aligned_pixel_reference<B,C,L,M> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
|
||||
|
||||
template <typename B, typename C, typename L, bool M>
|
||||
struct pixel_bit_size<const bit_aligned_pixel_reference<B,C,L,M> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct pixel_bit_size<packed_pixel<B,C,L> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
|
||||
|
||||
template <typename B, typename C, typename L>
|
||||
struct pixel_bit_size<const packed_pixel<B,C,L> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user