00001 #ifndef __CBaseImage__ 00002 #define __CBaseImage__ 00003 00004 #include "IImage.hpp" 00005 using Exponent::GUI::Graphics::IImage; 00006 00007 // =========================================================================== 00008 00009 namespace Exponent 00010 { 00011 namespace GUI 00012 { 00013 namespace Graphics 00014 { 00032 class CBaseImage : public IImage 00033 { 00034 00035 // =========================================================================== 00036 00037 public: 00038 00039 // =========================================================================== 00040 00044 CBaseImage(); 00045 00049 virtual ~CBaseImage(); 00050 00051 // =========================================================================== 00052 00057 virtual const CDimension &getImageSize() const { return m_dimension; } 00058 00063 virtual const CRect &getNormalisedImageSize() const { return m_size; } 00064 00069 virtual const CSystemString &getFileName() const { return m_filename; } 00070 00071 // =========================================================================== 00072 00079 virtual bool loadFromFile(const CSystemString &filename) { return false; } 00080 00084 virtual void unloadImage(); 00085 00086 // =========================================================================== 00087 00092 virtual bool imageHasAlpha() const { return m_hasAlpha; } 00093 00098 virtual bool hasImageLoaded() const { return m_imageLoaded; } 00099 00104 const CString &getLastError() const { return m_lastError; } 00105 00106 // =========================================================================== 00107 00108 #ifdef WIN32 00109 00113 virtual HBITMAP getImageHandle() const { return m_theBitmap; } 00114 #else 00115 00119 virtual CGImageRef getImageHandle() const { return m_theBitmap; } 00120 #endif 00121 00122 // =========================================================================== 00123 00129 virtual void getObjectDescription(char *string, const long size) const; 00130 00134 virtual void referenced(); 00135 00139 virtual void dereference(); 00140 00145 virtual long getReferenceCount() const; 00146 00147 // =========================================================================== 00148 00149 protected: 00150 00151 // =========================================================================== 00152 00153 bool m_hasAlpha; 00154 long m_referenceCount; 00155 bool m_imageLoaded; 00156 CDimension m_dimension; 00157 CRect m_size; 00158 CSystemString m_filename; 00160 CString m_lastError; 00162 #ifdef WIN32 00163 HBITMAP m_theBitmap; 00164 #else 00165 CGImageRef m_theBitmap; 00166 #endif 00167 00168 }; 00169 } 00170 } 00171 } 00172 #endif // End of CBaseImage.hpp