00001 #ifndef __CS123IMAGE_H__ 00002 #define __CS123IMAGE_H__ 00003 00004 #include <CS123Common.h> 00005 00006 //! Lightweight wrapper for loading arbitrary image data from external files 00007 //! png, gif, jpg, jpeg, tiff should all be supported (and possibly others) 00008 class CS123Image { 00009 00010 public: 00011 //! Loads the image data from the given filename and initializes this CS123Image 00012 CS123Image(const char *filename); 00013 virtual ~CS123Image(); 00014 00015 //! Returns the dimensions of the CS123Image 00016 int getWidth() const; 00017 int getHeight() const; 00018 00019 //! Returns the number of bytes allocated for the data of this image 00020 //! (equals sizeof(CS123Color) * getWidth() * getHeight()) 00021 int getDataSize() const; 00022 00023 //! Returns an array of CS123Color structs, representing this image in memory 00024 //! Note: if getData returns NULL, image failed to load during construction 00025 CS123Color *getData() const; 00026 00027 protected: 00028 CS123Color *m_data; 00029 int m_width, m_height; 00030 }; 00031 00032 #endif // __CS123IMAGE_H__ 00033
1.5.6