Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

image_loader.cpp

00001 //FILE:         image_loader.cpp
00002 //AUTHOR:       Nathan Cournia <nathan@cournia.com>
00003 
00004 #include "config.h"
00005 #include "image_loader.h"
00006 #include "ppm_image.h"
00007 #include "tga_image.h"
00008 
00009 #ifdef HAVE_SDL_IMAGE
00010 #include "sdl_image.h"
00011 #endif
00012 
00014 image::image_t*
00015 image::load( const std::string& filename )
00016 {
00017         //see if each know image reader can load this file
00018         if( ppm::can_load( filename ) ) {
00019                 return ppm::load( filename );
00020         } else if( tga::can_load( filename ) ) {
00021                 return tga::load( filename );
00022         } 
00023 #ifdef HAVE_SDL_IMAGE
00024         else {
00025                 return sdl::load( filename );
00026         }
00027 #endif
00028 
00029         //unknown image type
00030         return NULL;
00031 }
00032 
00034 image::image_t*
00035 image::load( std::istream& stream )
00036 {
00037         //see if each know image reader can load this file
00038         if( ppm::can_load( stream ) ) {
00039                 return ppm::load( stream );
00040         } else if( tga::can_load( stream ) ) {
00041                 return tga::load( stream );
00042         }
00043 
00044         //unknown image type
00045         return NULL;
00046 }

Generated on Tue Feb 11 18:49:41 2003 for uber by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002