Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ResImagePack Class Reference

Inheritance diagram for ResImagePack:

Inheritance graph
[legend]
Collaboration diagram for ResImagePack:

Collaboration graph
[legend]

Detailed Description

Image resources and image loading.

Definition at line 13 of file ResImagePack.h.

Public Member Functions

virtual const char * getName () const
void addImage (const std::string &name, const Path &file)
 Store image from file.

Static Public Member Functions

static SDL_Surface * loadImage (const Path &file)
 Load unshared image from file and convert image to diplayformat.

Protected Member Functions

virtual void unloadRes (SDL_Surface *res)


Member Function Documentation

void ResImagePack::addImage const std::string &  name,
const Path file
 

Store image from file.

Exceptions:
ImgException when image cannot be loaded
SDLException when image cannot be converted

Definition at line 52 of file ResImagePack.cpp.

00053 {
00054     SDL_Surface *surface = loadImage(file);
00055     addRes(name, surface);
00056 }

virtual const char* ResImagePack::getName  )  const [inline, virtual]
 

Implements INamed.

Definition at line 17 of file ResImagePack.h.

00017 { return "image_pack"; }

SDL_Surface * ResImagePack::loadImage const Path file  )  [static]
 

Load unshared image from file and convert image to diplayformat.

Returns:
loaded surface
Exceptions:
ImgException when image cannot be loaded
SDLException when image cannot be converted

Definition at line 27 of file ResImagePack.cpp.

00028 {
00029     SDL_Surface *raw_image = IMG_Load(file.getNative().c_str());
00030     if (NULL == raw_image) {
00031         throw ImgException(ExInfo("Load")
00032                 .addInfo("file", file.getNative()));
00033     }
00034 
00035     SDL_Surface *surface = SDL_DisplayFormatAlpha(raw_image);
00036     if (NULL == surface) {
00037         throw SDLException(ExInfo("DisplayFormat")
00038                 .addInfo("file", file.getNative()));
00039     }
00040     SDL_FreeSurface(raw_image);
00041 
00042     return surface;
00043 }

void ResImagePack::unloadRes SDL_Surface *  res  )  [protected, virtual]
 

Implements ResourcePack< SDL_Surface * >.

Definition at line 59 of file ResImagePack.cpp.

00060 {
00061     SDL_FreeSurface(res);
00062 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:56:26 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2