home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / ImageLoader.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-12-18  |  1.3 KB  |  36 lines

  1. #ifndef __ImageLoader_h__
  2. #define __ImageLoader_h__
  3.  
  4. /*!
  5. \file imageloader.h
  6. \author Karsten Schwenk
  7.  
  8. \brief This file contains the #image_s struct and the function #loadImage(), which are used to load various image formats.
  9.  
  10. The following image formats are supported: BMP, PNM (PPM/PGM/PBM), XPM, LBM, PCX, GIF, JPEG, PNG, TGA, TIFF and RGB/RGBA (SGI). RGB is supported through my own loader in rgbloader.h, all other formats are loaded by SDL_image routines (see imageloader.h).
  11.  
  12. Color depth is scaled to one byte per component for all images (e.g. for rgb three bytes per pixel).
  13. */
  14.  
  15. //! This struct represents an image in memory
  16. typedef struct image_s{
  17.     int width;        //!< width of the image
  18.     int height;        //!< height of the image
  19.     int numChannels;    //!< number channels the image has (3=rgb, 4=rgba, ...)
  20.     unsigned char* data;    //!< the image data as an array of bytes (size=width*height*numChannels)
  21. }image_t;
  22.  
  23. class ImageLoader{
  24. public:
  25.     //! loads an image and returns a corresponding #image_s struct
  26.     static image_t* loadImage(const char* filename);
  27.  
  28.     //! changes the gamma value of an image
  29.     static void gammaShift(image_t* image, float factor);
  30. protected:
  31.     static void swap(unsigned char& a, unsigned char& b);
  32. };
  33.  
  34.  
  35. #endif    /* __Imageloader_h__ */
  36.