Boost logo

Boost :

From: Lubomir Bourdev (lbourdev_at_[hidden])
Date: 2006-10-13 14:14:40


Gordon Smith wrote:
> Looks like its this easy (not using any_image yet):
> using namespace gil;
>
> BITMAP bm;
>
> m_bmp.GetBitmap(&bm);
>
> if (bm.bmPlanes == 1 && bm.bmBitsPixel == 8)
>
> {
>
> rgb8c_view_t src = interleaved_view(bm.bmWidth,
> bm.bmHeight, (const rgb8_pixel_t*)bm.bmBits, bm.bmWidthBytes);
>
> }
>

Yes. And here is how to extend it with any_image_view:

typedef mpl::vector<gray8c_view_t, gray16c_view_t,
                    rgb8c_view_t, rgb16c_view_t> my_view_types;
typedef any_image_view<my_view_types> my_any_view_t;

my_any_view_t create_runtime_gil_view(int color_space, int bpp,
                       int w, int h, int row_bytes, void* pixels) {
    switch (color_space) {
       case kRGB: // your own enum
          switch (bpp) {
             case 8:
               return my_any_view_t(interleaved_view(w,h, (const
rgb8_pixel_t*)pixels, row_bytes));

          }
...
    }

}

I find this wrapper a nice way to get to GIL realm from your
application.
We have something similar for Photoshop, as Photoshop images are
typically specified at run time.

Lubomir


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk