diff options
Diffstat (limited to 'boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp')
-rw-r--r-- | boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp b/boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp new file mode 100644 index 0000000000..dc0876c1ae --- /dev/null +++ b/boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp @@ -0,0 +1,46 @@ +/* + Copyright 2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev + Use, modification and distribution are subject to 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 + +//////////////////////////////////////////////////////////////////////////////////////// +/// \file get_pixel_type.hpp +/// \brief get_pixel_type metafunction. +/// \author Christian Henning, Andreas Pokorny, Lubomir Bourdev \n +/// +/// \date 2012 \n +/// +//////////////////////////////////////////////////////////////////////////////////////// + +#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 > > +{ + typedef any_image_pixel_t type; +}; + +} // namespace gil +} // namespace boost + +#endif // BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_PIXEL_TYPE_HPP |