CBitmapHandler.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 which stands for a simple rgba palette
  17. struct BMPPalette
  18. {
  19. unsigned char R,G,B,F;
  20. };
  21. /// Class which converts pcx to bmp images
  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) const;
  29. void openPCX(char * PCX, int len);
  30. SDL_Surface * getSurface() const; //for standard H3 PCX
  31. //SDL_Surface * getSurfaceZ(); //for ZSoft PCX
  32. CPCXConv() //c-tor
  33. : pcx(NULL), bmp(NULL), pcxs(0), bmps(0)
  34. {}
  35. ~CPCXConv() //d-tor
  36. {
  37. if (pcxs) delete[] pcx;
  38. if (bmps) delete[] bmp;
  39. }
  40. };
  41. namespace BitmapHandler
  42. {
  43. SDL_Surface * loadBitmap(std::string fname, bool setKey=true);
  44. };
  45. #endif // __CBITMAPHANDLER_H__