aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h
new file mode 100644
index 0000000..d744b6e
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderTGA.h
@@ -0,0 +1,82 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_IMAGE_LOADER_TGA_H_INCLUDED__
6#define __C_IMAGE_LOADER_TGA_H_INCLUDED__
7
8#include "IrrCompileConfig.h"
9
10#include "IImageLoader.h"
11
12
13namespace irr
14{
15namespace video
16{
17
18#if defined(_IRR_COMPILE_WITH_TGA_LOADER_) || defined(_IRR_COMPILE_WITH_TGA_WRITER_)
19
20// byte-align structures
21#include "irrpack.h"
22
23 // these structs are also used in the TGA writer
24 struct STGAHeader{
25 u8 IdLength;
26 u8 ColorMapType;
27 u8 ImageType;
28 u8 FirstEntryIndex[2];
29 u16 ColorMapLength;
30 u8 ColorMapEntrySize;
31 u8 XOrigin[2];
32 u8 YOrigin[2];
33 u16 ImageWidth;
34 u16 ImageHeight;
35 u8 PixelDepth;
36 u8 ImageDescriptor;
37 } PACK_STRUCT;
38
39 struct STGAFooter
40 {
41 u32 ExtensionOffset;
42 u32 DeveloperOffset;
43 c8 Signature[18];
44 } PACK_STRUCT;
45
46// Default alignment
47#include "irrunpack.h"
48
49#endif // compiled with loader or reader
50
51#ifdef _IRR_COMPILE_WITH_TGA_LOADER_
52
53/*!
54 Surface Loader for targa images
55*/
56class CImageLoaderTGA : public IImageLoader
57{
58public:
59
60 //! returns true if the file maybe is able to be loaded by this class
61 //! based on the file extension (e.g. ".tga")
62 virtual bool isALoadableFileExtension(const io::path& filename) const;
63
64 //! returns true if the file maybe is able to be loaded by this class
65 virtual bool isALoadableFileFormat(io::IReadFile* file) const;
66
67 //! creates a surface from the file
68 virtual IImage* loadImage(io::IReadFile* file) const;
69
70private:
71
72 //! loads a compressed tga. Was written and sent in by Jon Pry, thank you very much!
73 u8* loadCompressedImage(io::IReadFile *file, const STGAHeader& header) const;
74};
75
76#endif // compiled with loader
77
78} // end namespace video
79} // end namespace irr
80
81#endif
82