00001 #ifndef __NYTRO_Image_H 00002 #define __NYTRO_Image_H 00003 00004 //***************************************************************************** 00005 // Nytro GameEngine 00006 // 00007 // © Copyright 7thFACTOR Entertainment 00008 // All rights reserved 00009 //***************************************************************************** 00010 00011 #include "system/nyCommon.h" 00012 #include "system/nyTable.h" 00013 00014 namespace Nytro 00015 { 00016 namespace Graphics 00017 { 00018 //TODO: Support only DDS 00019 00020 typedef Core::Table<uint8> ImageData8; 00021 typedef Core::Table<uint16> ImageData16; 00022 typedef Core::Table<uint32> ImageData32; 00023 typedef Core::Table<uint64> ImageData64; 00024 00026 class NYTRO_API Image 00027 { 00028 public: 00029 00031 enum EImageFormat 00032 { 00033 eImageFormat_Grayscale, 00034 eImageFormat_RGBA, 00035 eImageFormat_ARGB, 00036 eImageFormat_BGRA, 00037 eImageFormat_RGB 00038 }; 00039 00041 enum EImageType 00042 { 00043 eImageType_2D, 00044 eImageType_Cubemap, 00045 eImageType_Volume 00046 }; 00047 00048 Image(); 00050 Image( const char* pFile ); 00051 ~Image(); 00052 00054 ImageData32& getLayerData( uint32 aLayer = 0 ); 00056 uint32 getWidth( uint32 aLayer = 0 ); 00058 uint32 getHeight( uint32 aLayer = 0 ); 00060 uint32 getBpp(); 00062 EImageFormat getFormat(); 00064 string& getFileName(); 00066 uint32 getLayerCount(); 00068 EImageType getType(); 00069 00071 void setBpp( uint32 aValue ); 00073 void setFormat( EImageFormat aValue ); 00075 EResult load( const char* pFile ); 00077 EResult save( const char* pFile ); 00079 void resize( uint32 aWidth, uint32 aHeight ); 00081 void free(); 00082 00083 protected: 00084 00086 vector<ImageData32> m_layerData; 00088 uint32 m_bpp; 00090 EImageFormat m_format; 00092 string m_fileName; 00094 EImageType m_type; 00095 }; 00096 }; 00097 }; 00098 00099 #endif