00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef BMP_H
00015 #define BMP_H
00016 
00017 #include "il_internal.h"
00018 
00019 #ifdef _WIN32
00020         #pragma pack(push, bmp_struct, 1)
00021 #endif
00022 typedef struct BMPHEAD {
00023         ILushort        bfType;
00024         ILint           bfSize;
00025         ILuint          bfReserved;
00026         ILint           bfDataOff;
00027         ILint           biSize;
00028         ILint           biWidth;
00029         ILint           biHeight;
00030         ILshort         biPlanes;
00031         ILshort         biBitCount;
00032         ILint           biCompression;
00033         ILint           biSizeImage;
00034         ILint           biXPelsPerMeter;
00035         ILint           biYPelsPerMeter;
00036         ILint           biClrUsed;
00037         ILint           biClrImportant;
00038 } IL_PACKSTRUCT BMPHEAD;
00039 
00040 typedef struct OS2_HEAD
00041 {
00042         
00043         ILushort        bfType;
00044         ILuint          biSize;
00045         ILshort         xHotspot;
00046         ILshort         yHotspot;
00047         ILuint          DataOff;
00048 
00049         
00050         ILuint          cbFix;
00051         
00052         ILushort                cx;
00053         ILushort                cy;
00054         ILushort        cPlanes;
00055         ILushort        cBitCount;
00056 } IL_PACKSTRUCT OS2_HEAD;
00057 #ifdef _WIN32
00058         #pragma pack(pop, bmp_struct)
00059 #endif
00060 
00061 
00062 ILboolean       iGetBmpHead(BMPHEAD * const Header);
00063 ILboolean       iGetOS2Head(OS2_HEAD * const Header);
00064 ILboolean       iIsValidBmp();
00065 ILboolean       iCheckBmp(const BMPHEAD *CONST_RESTRICT Header);
00066 ILboolean       iCheckOS2(const OS2_HEAD *CONST_RESTRICT Header);
00067 ILboolean       iLoadBitmapInternal();
00068 ILboolean       iSaveBitmapInternal();
00069 ILboolean       ilReadUncompBmp(BMPHEAD *Info);
00070 ILboolean       ilReadRLE8Bmp(BMPHEAD *Info);
00071 ILboolean       ilReadRLE4Bmp(BMPHEAD *Info);
00072 ILboolean       iGetOS2Bmp(OS2_HEAD *Header);
00073 
00074 #ifdef IL_BMP_C
00075 #undef NOINLINE
00076 #undef INLINE
00077 #define INLINE
00078 #endif
00079 
00080 #ifndef NOINLINE
00081 INLINE void GetShiftFromMask(const ILuint Mask, ILuint * CONST_RESTRICT ShiftLeft, ILuint * CONST_RESTRICT ShiftRight) {
00082         ILuint Temp, i;
00083 
00084         if( Mask == 0 ) {
00085                 *ShiftLeft = *ShiftRight = 0;
00086                 return;
00087         }
00088 
00089         Temp = Mask;
00090         for( i = 0; i < 32; i++, Temp >>= 1 ) {
00091                 if( Temp & 1 )
00092                         break;
00093         }
00094         *ShiftRight = i;
00095 
00096         
00097         for( i = 0; i < 8; i++, Temp >>= 1 ) {
00098                 if( !(Temp & 1) )
00099                         break;
00100         }
00101         *ShiftLeft = 8 - i;
00102 
00103         return;
00104 }
00105 #endif
00106 
00107 #endif//BMP_H