]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CImageLoaderTGA.h
Drop obsolete configuration macros
[irrlicht.git] / source / Irrlicht / CImageLoaderTGA.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __C_IMAGE_LOADER_TGA_H_INCLUDED__\r
6 #define __C_IMAGE_LOADER_TGA_H_INCLUDED__\r
7 \r
8 #include "IrrCompileConfig.h"\r
9 \r
10 #include "IImageLoader.h"\r
11 \r
12 \r
13 namespace irr\r
14 {\r
15 namespace video\r
16 {\r
17 \r
18 // byte-align structures\r
19 #include "irrpack.h"\r
20 \r
21         // these structs are also used in the TGA writer\r
22         struct STGAHeader{\r
23                 u8 IdLength;\r
24                 u8 ColorMapType;\r
25                 u8 ImageType;\r
26                 u8 FirstEntryIndex[2];\r
27                 u16 ColorMapLength;\r
28                 u8 ColorMapEntrySize;\r
29                 u8 XOrigin[2];\r
30                 u8 YOrigin[2];\r
31                 u16 ImageWidth;\r
32                 u16 ImageHeight;\r
33                 u8 PixelDepth;\r
34                 u8 ImageDescriptor;\r
35         } PACK_STRUCT;\r
36 \r
37         struct STGAFooter\r
38         {\r
39                 u32 ExtensionOffset;\r
40                 u32 DeveloperOffset;\r
41                 c8  Signature[18];\r
42         } PACK_STRUCT;\r
43 \r
44 // Default alignment\r
45 #include "irrunpack.h"\r
46 \r
47 /*!\r
48         Surface Loader for targa images\r
49 */\r
50 class CImageLoaderTGA : public IImageLoader\r
51 {\r
52 public:\r
53 \r
54         //! returns true if the file maybe is able to be loaded by this class\r
55         //! based on the file extension (e.g. ".tga")\r
56         bool isALoadableFileExtension(const io::path& filename) const override;\r
57 \r
58         //! returns true if the file maybe is able to be loaded by this class\r
59         bool isALoadableFileFormat(io::IReadFile* file) const override;\r
60 \r
61         //! creates a surface from the file\r
62         IImage* loadImage(io::IReadFile* file) const override;\r
63 \r
64 private:\r
65 \r
66         //! loads a compressed tga. Was written and sent in by Jon Pry, thank you very much!\r
67         u8* loadCompressedImage(io::IReadFile *file, const STGAHeader& header) const;\r
68 };\r
69 \r
70 } // end namespace video\r
71 } // end namespace irr\r
72 \r
73 #endif\r