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
5 #ifndef __C_IMAGE_LOADER_BMP_H_INCLUDED__
\r
6 #define __C_IMAGE_LOADER_BMP_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
10 #include "IImageLoader.h"
\r
18 // byte-align structures
\r
19 #include "irrpack.h"
\r
23 u16 Id; // BM - Windows 3.1x, 95, NT, 98, 2000, ME, XP
\r
24 // BA - OS/2 Bitmap Array
\r
25 // CI - OS/2 Color Icon
\r
26 // CP - OS/2 Color Pointer
\r
28 // PT - OS/2 Pointer
\r
31 u32 BitmapDataOffset;
\r
32 u32 BitmapHeaderSize; // should be 28h for windows bitmaps or
\r
33 // 0Ch for OS/2 1.x or F0h for OS/2 2.x
\r
37 u16 BPP; // 1: Monochrome bitmap
\r
38 // 4: 16 color bitmap
\r
39 // 8: 256 color bitmap
\r
40 // 16: 16bit (high color) bitmap
\r
41 // 24: 24bit (true color) bitmap
\r
42 // 32: 32bit (true color) bitmap
\r
44 u32 Compression; // 0: none (Also identified by BI_RGB)
\r
45 // 1: RLE 8-bit / pixel (Also identified by BI_RLE4)
\r
46 // 2: RLE 4-bit / pixel (Also identified by BI_RLE8)
\r
47 // 3: Bitfields (Also identified by BI_BITFIELDS)
\r
49 u32 BitmapDataSize; // Size of the bitmap data in bytes. This number must be rounded to the next 4 byte boundary.
\r
53 u32 ImportantColors;
\r
56 // Default alignment
\r
57 #include "irrunpack.h"
\r
60 Surface Loader for Windows bitmaps
\r
62 class CImageLoaderBMP : public IImageLoader
\r
69 //! returns true if the file maybe is able to be loaded by this class
\r
70 //! based on the file extension (e.g. ".tga")
\r
71 bool isALoadableFileExtension(const io::path& filename) const override;
\r
73 //! returns true if the file maybe is able to be loaded by this class
\r
74 bool isALoadableFileFormat(io::IReadFile* file) const override;
\r
76 //! creates a surface from the file
\r
77 IImage* loadImage(io::IReadFile* file) const override;
\r
81 void decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
\r
83 void decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
\r
87 } // end namespace video
\r
88 } // end namespace irr
\r