// Default to color converters provided by GIL
template<typename TSrcColorSpace, typename TDstColorSpace>
struct ConvertRGBA_impl
: public default_color_converter_impl<TSrcColorSpace, TDstColorSpace> {};
// Override GIL's from-RGBA color converter. GIL's from-RGBA color converter assumes premultiplied alpha, which we do not
// use.
template<typename TDstColorSpace>
struct ConvertRGBA_impl<rgba_t, TDstColorSpace>
{
template<typename TSrcPixel, typename TDstPixel>
void operator () (const TSrcPixel& srcPixel, TDstPixel& dstPixel) const;
};
struct ConvertRGBA
{
template<typename TSrcPixel, typename TDstPixel>
void operator () (const TSrcPixel& srcPixel, TDstPixel& dstPixel) const;
};
template<typename TDstColorSpace>
template<typename TSrcPixel, typename TDstPixel>
void ConvertRGBA_impl<rgba_t, TDstColorSpace>::operator () (const TSrcPixel& srcPixel, TDstPixel& dstPixel) const
{
default_color_converter_impl<rgb_t, TDstColorSpace>()
(
pixel<typename channel_type<TSrcPixel>::type, rgb_layout_t>
(
get_color(srcPixel, red_t()),
get_color(srcPixel, green_t()),
get_color(srcPixel, blue_t())
),
dstPixel
);
}
template<typename TSrcPixel, typename TDstPixel>
void ConvertRGBA::operator () (const TSrcPixel& srcPixel, TDstPixel& dstPixel) const
{
typedef typename color_space_type<TSrcPixel>::type TSrcColorSpace;
typedef typename color_space_type<TDstPixel>::type TDstColorSpace;
ConvertRGBA_impl<TSrcColorSpace, TDstColorSpace>()(srcPixel, dstPixel);
}
Labels: coding
July 2009 August 2009 September 2009 October 2009 November 2009 December 2009 January 2010 September 2010 December 2010 January 2011 February 2011 April 2011 June 2011 August 2011 February 2012 June 2012 July 2012 August 2012 October 2012 November 2012 January 2014 April 2014 June 2014 August 2014 September 2014 October 2014 January 2015 March 2015 April 2015 June 2015 November 2015 December 2015 January 2016 June 2016 August 2016 January 2017 March 2017 April 2018 April 2019 June 2019 January 2020
Subscribe to Posts [Atom]
Post a Comment