Boost.GIL に手を付けてみた
まあすぐに飽きる気がするけど。
とりあえず、
Naming convention for GIL concrete types
Concrete (non-generic) GIL types follow this naming convention:
ColorSpace + BitDepth + [f | s]+ [c] + [_planar] + [_step] + ClassType + _t
Where ColorSpace also indicates the ordering of components. Examples are rgb, bgr, cmyk, rgba. BitDepth indicates the bit depth of the color channel. Examples are 8,16,32. By default the type of channel is unsigned integral; using s indicates signed integral and f - a floating point type, which is always signed. c indicates object operating over immutable pixels. _planar indicates planar organization (as opposed to interleaved). _step indicates special image views, locators and iterators which traverse the data in non-trivial way (for example, backwards or every other pixel). ClassType is _image (image), _view (image view), _loc (pixel 2D locator) _ptr (pixel iterator), _ref (pixel reference), _pixel (pixel value).
bgr8_image_t a; // 8-bit interleaved BGR image cmyk16_pixel_t; b; // 16-bit CMYK pixel value; cmyk16c_planar_ref_t c(b); // const reference to a 16-bit planar CMYK pixel x. rgb32f_planar_step_ptr_t d; // step pointer to a 32-bit planar RGB pixel.Generic Image Library : Generic Image Library Tutorial
この説明を一番最初に持ってくるべきだと思った。
えっと、
ColorSpace | BitDepth | [f | s] | [c] | [_planar] | [_step] | ClassType | _t |
gray bgr argb abgr bgra rgb rgba cmyk |
8 16 32 |
ε s f |
ε c |
ε _planar |
ε _step |
_image _view _loc _ptr _ref _pixel |
_t |
あと ColorSpace には dev2n, dev3n, dev4n, dev5n なんてのがあるらしい。調べてないからまだよく分からない。
それから gray, bgr, argb, abgr, bgra には _planar は存在しない。rgb, rgba と同じ内容になってしまうので、必要がないようだ。
RGB565 の場合なんかだと、
using namespace boost::gil; typedef boost::mpl::vector3_c<unsigned int, 5, 6, 5> rgb565_vec_t; typedef packed_pixel_type<boost::uint16_t, rgb565_vec_t, rgb_layout_t>::type rgb565_pixel_t; typedef image<rgb565_pixel_t, false> rgb565_image_t; typedef rgb565_pixel_t* rgb565_ptr_t; typedef memory_based_2d_locator<memory_based_step_iterator<rgb565_ptr_t> > rgb565_loc_t; typedef image_view<rgb565_loc_t> rgb565_view_t;
こんな感じになるのかな?