Boost logo

Boost Users :

Subject: [Boost-users] [GIL] GIL and FreeImage interaction sample code suggestions ?
From: Nicolas Lelong (rotoglup_at_[hidden])
Date: 2009-09-02 11:16:19


Hi,

FWIW I'm considering boost GIL to implement the few image algorithms I need,
and I need proper image I/O on top of that.

As I'm using FreeImage in my current codebase, I thought about exposing
FreeImage image memory layout to GIL. You can find the, quite simplistic,
source code here :

http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_io/image_io.hpp
http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_io/image_io.cpp

http://code.google.com/p/rotoglup-scratchpad/source/browse/trunk/rtgu/image_io/gil/borrowed_image.hpp

I created a 'borrowed_image' class that mimics the behaviour of gil::image :
it is not allocating memory itself, it takes an existing memory buffer and a
'deleter' (under the form of a boost::shared_ptr<void>) as input. This
allows to use directly the memory allocated by FreeImage, avoiding extra
copy, in case of file input.

Feel free to use the code as a starting point, if you have similar needs,
and I'd be glad to have comments about the concept of 'borrowed_image'
class, and about its interface, as I feel I'm missing something.

Cheers,

Nicolas.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net