Beispiel #1
0
bool
TherionBitmap::ReadImage( const char * filename )
{
  if ( filename == NULL ) return false;
  size_t len = strlen( filename );
  if ( strcmp( filename+len-3, "png" ) == 0 ) return ReadPNGImage( filename );
  if ( strcmp( filename+len-3, "jpg" ) == 0 ) return ReadJPEGImage( filename );
  if ( strcmp( filename+len-4, "jpeg" ) == 0 ) return ReadJPEGImage( filename );
  LOGW("Unsupported file type \"%s\"\n", filename );
  return false;
}
Beispiel #2
0
SbBool
SoTexture2::readImage(const SbString& fname, int &w, int &h, int &nc, 
		      unsigned char *&bytes)
//
////////////////////////////////////////////////////////////////////////
{
    w = h = nc = 0;
    bytes = NULL;
    
    // Empty file means an empty image...
    if (fname.getString()[0] == '\0')
	return TRUE;

    SoInput in;
    if (!in.openFile(fname.getString(), TRUE)) {
	return FALSE;
    }

#ifdef DEBUG
    SoDebugError::postInfo("SoTexture2::readImage",
			   "Reading texture image %s",
			   fname.getString());
#endif

    if (ReadSGIImage(in, w, h, nc, bytes))
	return TRUE;

    // fiopen() closes the file even if it can't read the data, so 
    // reopen it
    in.closeFile();
    if (!in.openFile(fname.getString(), TRUE))
	return FALSE;

    if (ReadGIFImage(in, w, h, nc, bytes))
	return TRUE;

    if (ReadJPEGImage(in, w, h, nc, bytes))
	return TRUE;

    return FALSE;
}
Beispiel #3
0
void JPEGInstance::ReadImage( UInt32Image& img )
{
   ReadJPEGImage( img, m_reader, m_readCount );
}
Beispiel #4
0
void JPEGReader::ReadImage( UInt32Image& img )
{
   ReadJPEGImage( img, *this, fileData );
}
Beispiel #5
0
void JPEGReader::ReadImage( DImage& img )
{
   ReadJPEGImage( img, *this, fileData );
   NORMALIZE( DImage )
}
Beispiel #6
0
void JPEGInstance::ReadImage( UInt16Image& img )
{
   ReadJPEGImage( img, reader, readCount );
}