From: Lubomir Bourdev (lbourdev_at_[hidden])
Date: 2006-10-18 18:14:23
Tim Shead wrote:
> Another question / observation on the GIL API. When
> interfacing with external code, particularly "C" libraries,
> it's often necessary to pass a pointer to the memory managed
> by an image
> (gdk_pixbuf_create_from_raw_data() in my case). So far, I've
> been using
> to get a pointer to memory, but that's pretty ugly, and I'm
> thinking it might not work for all cases. Is there a better
> way to do it? If not, I'd suggest adding an "image::data()"
> method that would provide canonical access to memory. The
> choice of name is for consistency with std::basic_string::data().
The problem of course is that the image view may not at all be
memory-based, like the Mandelbrot set.
Even for memory-based image views, and for images, they may be planar,
so in this case you really need to get pointers to each color plane.
If the image is interleaved you can just do what you would do with
rgba8_image_t img(100, 100);
If the image is planar, you can get the pointers to each plane like
rgb8_planar_image_t planar_img(100, 100);
Useful MPL predicates:
// plain memory-based views/images with no dereference adaptors
I am open to adding an interface like data() but I am not sure how best
to do this to accommodate these variations.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk