CBitmapHandler.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __CBITMAPHANDLER_H__
  2. #define __CBITMAPHANDLER_H__
  3. #include "../global.h"
  4. struct SDL_Surface;
  5. class CLodHandler;
  6. /*
  7. * CBitmapHandler.h, part of VCMI engine
  8. *
  9. * Authors: listed in file AUTHORS in main folder
  10. *
  11. * License: GNU General Public License v2.0 or later
  12. * Full text of license available in license.txt file, in main folder
  13. *
  14. */
  15. enum Epcxformat {PCX8B, PCX24B};
  16. struct BMPPalette
  17. {
  18. unsigned char R,G,B,F;
  19. };
  20. class CPCXConv
  21. {
  22. public:
  23. unsigned char * pcx, *bmp;
  24. int pcxs, bmps;
  25. void fromFile(std::string path);
  26. void saveBMP(std::string path) const;
  27. void openPCX(char * PCX, int len);
  28. SDL_Surface * getSurface() const; //for standard H3 PCX
  29. //SDL_Surface * getSurfaceZ(); //for ZSoft PCX
  30. CPCXConv() //c-tor
  31. : pcx(NULL), bmp(NULL), pcxs(0), bmps(0)
  32. {}
  33. ~CPCXConv() //d-tor
  34. {
  35. if (pcxs) delete[] pcx;
  36. if (bmps) delete[] bmp;
  37. }
  38. };
  39. namespace BitmapHandler
  40. {
  41. SDL_Surface * loadBitmap(std::string fname, bool setKey=true);
  42. };
  43. #endif // __CBITMAPHANDLER_H__