2
我有一个模板<PIXEL>
,假设是boost::gil
的像素类型之一(目前,只有gray8_pixel_t
或gray16_pixel_t
,我只希望支持同质像素类型,例如rgb8_pixel_t
将来)之一。如何从boost :: gil同类像素类型中提取通道POD类型?
该类需要根据像素类型获得unsigned char
或unsigned short
;我认为这是像素类掩埋somehwere,但没有PIXEL::value_type
,PIXEL::channel_type
或PIXEL::channel_type::value type
似乎是我想要的。
诀窍是什么?
(我可能会通过某些模板的专业帮手结构过程中使用的类型,间接得到这个信息:
template <typename PIXEL> struct types_for
{};
template <> struct types_for<boost::gil::gray8_pixel_t>
{typedef unsigned char channel_type;};
template <> struct types_for<boost::gil::gray16_pixel_t>
{typedef unsigned short channel_type;};
,但肯定GIL必须已经提供等同的东西,如果我能找到它... )