aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h
new file mode 100644
index 0000000..9321ecc
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CImageLoaderBMP.h
@@ -0,0 +1,100 @@
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_BMP_H_INCLUDED__
6#define __C_IMAGE_LOADER_BMP_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_BMP_LOADER_) || defined(_IRR_COMPILE_WITH_BMP_WRITER_)
19
20
21// byte-align structures
22#include "irrpack.h"
23
24 struct SBMPHeader
25 {
26 u16 Id; // BM - Windows 3.1x, 95, NT, 98, 2000, ME, XP
27 // BA - OS/2 Bitmap Array
28 // CI - OS/2 Color Icon
29 // CP - OS/2 Color Pointer
30 // IC - OS/2 Icon
31 // PT - OS/2 Pointer
32 u32 FileSize;
33 u32 Reserved;
34 u32 BitmapDataOffset;
35 u32 BitmapHeaderSize; // should be 28h for windows bitmaps or
36 // 0Ch for OS/2 1.x or F0h for OS/2 2.x
37 u32 Width;
38 u32 Height;
39 u16 Planes;
40 u16 BPP; // 1: Monochrome bitmap
41 // 4: 16 color bitmap
42 // 8: 256 color bitmap
43 // 16: 16bit (high color) bitmap
44 // 24: 24bit (true color) bitmap
45 // 32: 32bit (true color) bitmap
46
47 u32 Compression; // 0: none (Also identified by BI_RGB)
48 // 1: RLE 8-bit / pixel (Also identified by BI_RLE4)
49 // 2: RLE 4-bit / pixel (Also identified by BI_RLE8)
50 // 3: Bitfields (Also identified by BI_BITFIELDS)
51
52 u32 BitmapDataSize; // Size of the bitmap data in bytes. This number must be rounded to the next 4 byte boundary.
53 u32 PixelPerMeterX;
54 u32 PixelPerMeterY;
55 u32 Colors;
56 u32 ImportantColors;
57 } PACK_STRUCT;
58
59// Default alignment
60#include "irrunpack.h"
61
62#endif // defined with loader or writer
63
64#ifdef _IRR_COMPILE_WITH_BMP_LOADER_
65
66/*!
67 Surface Loader for Windows bitmaps
68*/
69class CImageLoaderBMP : public IImageLoader
70{
71public:
72
73 //! constructor
74 CImageLoaderBMP();
75
76 //! returns true if the file maybe is able to be loaded by this class
77 //! based on the file extension (e.g. ".tga")
78 virtual bool isALoadableFileExtension(const io::path& filename) const;
79
80 //! returns true if the file maybe is able to be loaded by this class
81 virtual bool isALoadableFileFormat(io::IReadFile* file) const;
82
83 //! creates a surface from the file
84 virtual IImage* loadImage(io::IReadFile* file) const;
85
86private:
87
88 void decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
89
90 void decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
91};
92
93
94#endif // compiled with loader
95
96} // end namespace video
97} // end namespace irr
98
99#endif
100