2011/3/6 Christian Henning :
Hi Szymon, the new IO extension isn't yet part of boost. Are you
referring to my repository at good code?
Also there is no png_load_file() in the old version nor is there a
load_image() in the new IO. The test code reads and writes png's in
various formats. What is your format? A little code would be nice,
too. ;-)
Sorry for not checking for valid function names. I used this code:
http://gil-contributions.googlecode.com/files/boost_review.zip. A
little portion of my code then ;)
using namespace boost::gil;
typedef boost::mpl::vector image_types;
any_image image;
try
{
png_read_image(file, image);
//read_image(file, image, png_tag());
init();
if (image.current_type_is())
{
setData(view(image._dynamic_cast()));
}
else if (image.current_type_is())
{
setData(view(image._dynamic_cast()));
}
}
catch (const std::exception& e)
{
throw Exception(e.what()) << ". File: " << file;
}
this is a snippet from implementation of 2D OpenGL texture. setData()
is overloaded for various image formats so that valid constant is
passed to GL Api (rgb8_image_t image overload passes GL_RGB8 etc). I
didn't do anything but changing png_read_image() to read_image() and
after running app all images on screen were broken - most of images is
white.
On a side note: maybe new io could use boost::exception? Would be
great if read_image() used boost::errinfo_file_name() when file cannot
be opened as now it is not better than just returning error code.