コード例 #1
0
OSG_BEGIN_NAMESPACE

/*! \class PNGImageFileType 

  Image File Type to read/write and store/restore Image objects as
  PNG data.
  
  To be able to load PNG images you need the PNG library, 
  (check the Prerequisites page on www.opensg.org). 
  The lib comes with all Linux distributions.
  
  You have to --enable-png in the configure line to enable
  the singleton object.
  
*/

#ifdef OSG_WITH_PNG

static void isReadFunc(png_structp png_ptr, png_bytep data, png_size_t length)
{
    std::istream *is = 
        reinterpret_cast<std::istream*>(png_get_io_ptr(png_ptr));

    is->read(reinterpret_cast<char*>(data), length);

    if(png_size_t(is->gcount()) != length)
        png_error(png_ptr, "Cannot read from input stream");
}
コード例 #2
0
static void isReadFunc(png_structp png_ptr, png_bytep data, png_size_t length)
{
    std::istream *is = 
        reinterpret_cast<std::istream*>(png_get_io_ptr(png_ptr));

    is->read(reinterpret_cast<char*>(data), length);

    if(png_size_t(is->gcount()) != length)
        png_error(png_ptr, "Cannot read from input stream");
}