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必須已經提供等同的東西,如果我能找到它... )