CBitmapHandler.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef CBITMAPHANDLER_H
  2. #define CBITMAPHANDLER_H
  3. #ifdef _MSC_VER
  4. #pragma once
  5. #endif
  6. #include "../global.h"
  7. struct SDL_Surface;
  8. class CLodHandler;
  9. enum Epcxformat {PCX8B, PCX24B};
  10. struct BMPPalette
  11. {
  12. unsigned char R,G,B,F;
  13. };
  14. struct BMPHeader
  15. {
  16. int fullSize, _h1, _h2, _h3, _c1, _c2, _c3, _c4, x, y,
  17. dataSize1, dataSize2; //DataSize=X*Y+2*Y
  18. unsigned char _c5[8];
  19. void print(std::ostream & out);
  20. BMPHeader(){_h1=_h2=0;for(int i=0;i<8;i++)_c5[i]=0;};
  21. };
  22. class CPCXConv
  23. {
  24. public:
  25. unsigned char * pcx, *bmp;
  26. int pcxs, bmps;
  27. void fromFile(std::string path);
  28. void saveBMP(std::string path);
  29. void openPCX(char * PCX, int len);
  30. void openPCX();
  31. void convert();
  32. SDL_Surface * getSurface(); //for standard H3 PCX
  33. //SDL_Surface * getSurfaceZ(); //for ZSoft PCX
  34. CPCXConv(){pcx=bmp=NULL;pcxs=bmps=0;};
  35. ~CPCXConv(){if (pcxs) delete[] pcx; if(bmps) delete[] bmp;}
  36. };
  37. namespace BitmapHandler
  38. {
  39. extern CLodHandler *bitmaph;
  40. SDL_Surface * loadBitmap(std::string fname, bool setKey=false);
  41. };
  42. #endif //CBITMAPHANDLER_H