#ifndef __C_IMAGE_LOADER_BMP_H_INCLUDED__
#define __C_IMAGE_LOADER_BMP_H_INCLUDED__
#include "IrrCompileConfig.h"
#include "IImageLoader.h"
namespace irr
{
namespace video
{
#if defined(_IRR_COMPILE_WITH_BMP_LOADER_) || defined(_IRR_COMPILE_WITH_BMP_WRITER_)
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
struct SBMPHeader
{
u16 Id;
u32 FileSize;
u32 Reserved;
u32 BitmapDataOffset;
u32 BitmapHeaderSize;
u32 Width;
u32 Height;
u16 Planes;
u16 BPP;
u32 Compression;
u32 BitmapDataSize;
u32 PixelPerMeterX;
u32 PixelPerMeterY;
u32 Colors;
u32 ImportantColors;
} PACK_STRUCT;
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#endif
#ifdef _IRR_COMPILE_WITH_BMP_LOADER_
class CImageLoaderBMP : public IImageLoader
{
public:
CImageLoaderBMP();
virtual bool isALoadableFileExtension(const io::path& filename) const;
virtual bool isALoadableFileFormat(io::IReadFile* file) const;
virtual IImage* loadImage(io::IReadFile* file) const;
private:
void decompress8BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
void decompress4BitRLE(u8*& BmpData, s32 size, s32 width, s32 height, s32 pitch) const;
};
#endif
}
}
#endif