00001
00002
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
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
00030 return NULL;
00031 }
00032
00034 image::image_t*
00035 image::load( std::istream& stream )
00036 {
00037
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
00045 return NULL;
00046 }