![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /proc/self/root/usr/include/boost/gil/extension/toolbox/color_spaces/ |
Upload File : |
// // Copyright 2012 Andreas Pokorny // // 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_COLOR_SPACES_GRAY_ALPHA_HPP #define BOOST_GIL_EXTENSION_TOOLBOX_COLOR_SPACES_GRAY_ALPHA_HPP #include <boost/gil/color_convert.hpp> #include <boost/gil/gray.hpp> #include <boost/gil/typedefs.hpp> #include <boost/mpl/contains.hpp> #include <boost/mpl/vector.hpp> namespace boost{ namespace gil { using gray_alpha_t = mpl::vector2<gray_color_t,alpha_t>; using gray_alpha_layout_t = layout<gray_alpha_t>; using alpha_gray_layout_t = layout<gray_alpha_layout_t, mpl::vector2_c<int,1,0>>; GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, alpha_gray) GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, alpha_gray) GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, gray_alpha) GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, gray_alpha) /// \ingroup ColorConvert /// \brief Gray Alpha to RGBA template <> struct default_color_converter_impl<gray_alpha_t,rgba_t> { template <typename P1, typename P2> void operator()(const P1& src, P2& dst) const { get_color(dst,red_t()) = channel_convert<typename color_element_type<P2, red_t>::type>(get_color(src,gray_color_t())); get_color(dst,green_t())= channel_convert<typename color_element_type<P2, green_t>::type>(get_color(src,gray_color_t())); get_color(dst,blue_t()) = channel_convert<typename color_element_type<P2, blue_t>::type>(get_color(src,gray_color_t())); get_color(dst,alpha_t()) = channel_convert<typename color_element_type<P2, alpha_t>::type>(get_color(src,alpha_t())); } }; /// \brief Gray Alpha to RGB template <> struct default_color_converter_impl<gray_alpha_t,rgb_t> { template <typename P1, typename P2> void operator()(const P1& src, P2& dst) const { get_color(dst,red_t()) = channel_convert<typename color_element_type<P2, red_t>::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); get_color(dst,green_t()) = channel_convert<typename color_element_type<P2, green_t>::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); get_color(dst,blue_t()) = channel_convert<typename color_element_type<P2, blue_t>::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); } }; /// \brief Gray Alpha to Gray template <> struct default_color_converter_impl<gray_alpha_t,gray_t> { template <typename P1, typename P2> void operator()(const P1& src, P2& dst) const { get_color(dst,gray_color_t()) = channel_convert<typename color_element_type<P2, gray_color_t>::type>( channel_multiply(get_color(src,gray_color_t()),get_color(src,alpha_t()) ) ); } }; } // namespace gil } // namespace boost #endif