/
usr
/
include
/
boost
/
gil
/
/usr/include/boost/gil
mkdir
upload
Name
Size
Mode
Actions
concepts/
-
0755
rm
detail/
-
0755
rm
extension/
-
0755
rm
image_processing/
-
0755
rm
io/
-
0755
rm
algorithm.hpp
41333
0644
edit
dl
rm
bit_aligned_pixel_iterator.hpp
9200
0644
edit
dl
rm
bit_aligned_pixel_reference.hpp
14096
0644
edit
dl
rm
channel.hpp
29913
0644
edit
dl
rm
channel_algorithm.hpp
23081
0644
edit
dl
rm
cmyk.hpp
1296
0644
edit
dl
rm
color_base.hpp
22010
0644
edit
dl
rm
color_base_algorithm.hpp
29889
0644
edit
dl
rm
color_convert.hpp
13851
0644
edit
dl
rm
concepts.hpp
897
0644
edit
dl
rm
deprecated.hpp
2477
0644
edit
dl
rm
device_n.hpp
3591
0644
edit
dl
rm
dynamic_step.hpp
893
0644
edit
dl
rm
gray.hpp
619
0644
edit
dl
rm
image.hpp
20452
0644
edit
dl
rm
image_view.hpp
14046
0644
edit
dl
rm
image_view_factory.hpp
24625
0644
edit
dl
rm
iterator_from_2d.hpp
6648
0644
edit
dl
rm
locator.hpp
18786
0644
edit
dl
rm
metafunctions.hpp
31186
0644
edit
dl
rm
packed_pixel.hpp
9214
0644
edit
dl
rm
pixel.hpp
9866
0644
edit
dl
rm
pixel_iterator.hpp
5307
0644
edit
dl
rm
pixel_iterator_adaptor.hpp
9071
0644
edit
dl
rm
planar_pixel_iterator.hpp
10059
0644
edit
dl
rm
planar_pixel_reference.hpp
9916
0644
edit
dl
rm
point.hpp
6899
0644
edit
dl
rm
position_iterator.hpp
5005
0644
edit
dl
rm
premultiply.hpp
3521
0644
edit
dl
rm
promote_integral.hpp
6185
0644
edit
dl
rm
rgb.hpp
1458
0644
edit
dl
rm
rgba.hpp
1674
0644
edit
dl
rm
step_iterator.hpp
14226
0644
edit
dl
rm
typedefs.hpp
13415
0644
edit
dl
rm
utilities.hpp
8161
0644
edit
dl
rm
virtual_locator.hpp
6288
0644
edit
dl
rm
Edit:
/usr/include/boost/gil/premultiply.hpp
(3521B)
// // Copyright 2014 Bill Gallafent // // 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_PREMULTIPLY_HPP #define BOOST_GIL_PREMULTIPLY_HPP #include <boost/gil/rgba.hpp> #include <boost/gil/detail/mp11.hpp> #include <boost/core/ignore_unused.hpp> #include <type_traits> namespace boost { namespace gil { template <typename SrcP, typename DstP> struct channel_premultiply { channel_premultiply(SrcP const & src, DstP & dst) : src_(src), dst_(dst) {} template <typename Channel> void operator()(Channel /* channel */) const { // TODO: Explain why 'channel' input paramater is not used, or used as tag only. // @todo: need to do a "channel_convert" too, in case the channel types aren't the same? get_color(dst_, Channel()) = channel_multiply(get_color(src_,Channel()), alpha_or_max(src_)); } SrcP const & src_; DstP & dst_; }; namespace detail { template <typename SrcP, typename DstP> void assign_alpha_if(std::true_type, SrcP const &src, DstP &dst) { get_color(dst,alpha_t()) = alpha_or_max(src); } template <typename SrcP, typename DstP> void assign_alpha_if(std::false_type, SrcP const& src, DstP& dst) { // nothing to do boost::ignore_unused(src); boost::ignore_unused(dst); } } struct premultiply { template <typename SrcP, typename DstP> void operator()(const SrcP& src, DstP& dst) const { using src_colour_space_t = typename color_space_type<SrcP>::type; using dst_colour_space_t = typename color_space_type<DstP>::type; using src_colour_channels = mp11::mp_remove<src_colour_space_t, alpha_t>; using has_alpha_t = std::integral_constant<bool, mp11::mp_contains<dst_colour_space_t, alpha_t>::value>; mp11::mp_for_each<src_colour_channels>(channel_premultiply<SrcP, DstP>(src, dst)); detail::assign_alpha_if(has_alpha_t(), src, dst); } }; template <typename SrcConstRefP, // const reference to the source pixel typename DstP> // Destination pixel value (models PixelValueConcept) class premultiply_deref_fn { public: using const_t = premultiply_deref_fn<SrcConstRefP, DstP>; using value_type = DstP; using reference = value_type; // read-only dereferencing using const_reference = const value_type &; using argument_type = SrcConstRefP; using result_type = reference; static constexpr bool is_mutable = false; result_type operator()(argument_type srcP) const { result_type dstP; premultiply()(srcP,dstP); return dstP; } }; template <typename SrcView, typename DstP> struct premultiplied_view_type { private: using src_pix_ref = typename SrcView::const_t::reference; // const reference to pixel in SrcView using deref_t = premultiply_deref_fn<src_pix_ref, DstP>; // the dereference adaptor that performs color conversion using add_ref_t = typename SrcView::template add_deref<deref_t>; public: using type = typename add_ref_t::type; // the color converted view type static type make(const SrcView& sv) { return add_ref_t::make(sv, deref_t()); } }; template <typename DstP, typename View> inline typename premultiplied_view_type<View,DstP>::type premultiply_view(const View& src) { return premultiplied_view_type<View,DstP>::make(src); } }} // namespace boost::gil #endif
Save
cmd:
run