Kochol Game Engine  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Image.h
Go to the documentation of this file.
1 // File name: Image.h
2 // Des: This class is working with images.
3 // Date: 28/05/1388
4 // Programmers: Ali Akbar Mohammadi (Kochol)
5 
6 #ifndef KGE_GFXIMAGE_H
7 #define KGE_GFXIMAGE_H
8 
9 #include "../Resource.h"
10 #include "Texture.h"
11 
12 namespace kge
13 {
14 namespace gfx
15 {
18 {
24 
25 }; // ImageFormat
26 
27 class KGE_API Image: public Resource
28 {
29 public:
30 
32  Image(const u32 Handle, const char* FileName, const char* Name, void* ExtraParam);
33 
35  Image(const char* Name);
36 
38  ~Image();
39 
41  bool CreateImage(int Width, int Height, int Depth = 1, int BytesPerPixel = 4,
42  ImageFormat imgFormat = EIF_BGRA, void* Data = NULL);
43 
45  u8* GetData(u32 MipMapLevel = 0);
46 
48  u32 GetPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth,
49  ImageFormat imgFormat, u8* OutData, u32 MipMapLevel = 0);
50 
52  u32 SetData(u8* pData);
53 
55  void SetPixels(int XOff, int YOff, int ZOff, int Width, int Height, int Depth,
56  ImageFormat imgFormat, u8* OutData, u32 MipMapLevel = 0);
57 
59  u32 Scale(u32 Width, u32 Height, u32 Depth, u32 MipMapLevel = 0);
60 
62  u8 BuildMipMaps();
63 
65  bool BuildTileMipMap(int NumCols, int NumRows);
66 
68  int GetWidth() { return m_iWidth; }
69 
71  int GetHeight() { return m_iHeight; }
72 
74  u8* GetCompressData(CompressType ct, u32& Size);
75 
76  int GetBytePerPixel() {return m_iBpp;}
77  ImageFormat GetFormat() {return m_eFmt;}
78 
79 protected:
80 
81  u32 m_iImgID; // Devil Image ID
82  int m_iWidth, // Width
83  m_iHeight, // Height
84  m_ibpp, // bits per pixel
85  m_iBpp; // Bytes per pixel
87 
89  bool LoadImageFromFile();
90 
91  // Check for devil errors.
92  void CheckDevilErrors( const char* TextureName );
93 
94 }; // Image
95 
96 } // gfx
97 
98 } // kge
99 
100 #endif // KGE_GFXIMAGE_H