/* Copyright 2007-2008 Andreas Pokorny 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_GRAY_ALPHA_HPP_INCLUDED #define BOOST_GIL_GRAY_ALPHA_HPP_INCLUDED //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief /// \author Andreas Pokorny \n /// /// \date 2007-2008 \n /// //////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include namespace boost { namespace gil { typedef mpl::vector2 gray_alpha_t; typedef layout gray_alpha_layout_t; typedef layout > alpha_gray_layout_t; GIL_DEFINE_BASE_TYPEDEFS(8, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(8s, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(16, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(16s,alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32 ,alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32s,alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32f,alpha_gray) GIL_DEFINE_ALL_TYPEDEFS(8, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(8s, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(16, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(16s,gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32 ,gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32s,gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32f,gray_alpha) /// \ingroup ColorConvert /// \brief Gray Alpha to RGBA template <> struct default_color_converter_impl { template void operator()(const P1& src, P2& dst) const { get_color(dst,red_t()) = channel_convert::type>(get_color(src,gray_color_t())); get_color(dst,green_t())= channel_convert::type>(get_color(src,gray_color_t())); get_color(dst,blue_t()) = channel_convert::type>(get_color(src,gray_color_t())); get_color(dst,alpha_t()) = channel_convert::type>(get_color(src,alpha_t())); } }; template <> struct default_color_converter_impl { template void operator()(const P1& src, P2& dst) const { get_color(dst,red_t()) = channel_convert::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); get_color(dst,green_t()) = channel_convert::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); get_color(dst,blue_t()) = channel_convert::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); } }; template <> struct default_color_converter_impl { template void operator()(const P1& src, P2& dst) const { get_color(dst,gray_color_t()) = channel_convert::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); } }; } // gil } // boost #endif // BOOST_GIL_GRAY_ALPHA_HPP_INCLUDED