CPicture.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "CIntObject.h"
  3. struct SDL_Surface;
  4. struct SRect;
  5. /*
  6. * CPicture.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  14. // Image class
  15. class CPicture : public CIntObject
  16. {
  17. public:
  18. SDL_Surface * bg;
  19. SRect * srcRect; //if NULL then whole surface will be used
  20. bool freeSurf; //whether surface will be freed upon CPicture destruction
  21. bool needRefresh;//Surface needs to be displayed each frame
  22. operator SDL_Surface*()
  23. {
  24. return bg;
  25. }
  26. CPicture(const SRect & r, const SDL_Color & color, bool screenFormat = false); //rect filled with given color
  27. CPicture(const SRect & r, ui32 color, bool screenFormat = false); //rect filled with given color
  28. CPicture(SDL_Surface * BG, int x = 0, int y=0, bool Free = true); //wrap existing SDL_Surface
  29. CPicture(const std::string &bmpname, int x=0, int y=0);
  30. CPicture(SDL_Surface *BG, const SRect &SrcRext, int x = 0, int y = 0, bool free = false); //wrap subrect of given surface
  31. ~CPicture();
  32. void init();
  33. void createSimpleRect(const SRect &r, bool screenFormat, ui32 color);
  34. void show(SDL_Surface * to);
  35. void showAll(SDL_Surface * to);
  36. void convertToScreenBPP();
  37. void colorizeAndConvert(int player);
  38. void colorize(int player);
  39. };