CCanvas.h 914 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * CCanvas.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. struct SDL_Surface;
  12. struct Point;
  13. class IImage;
  14. /// Class that represents surface for drawing on
  15. class CCanvas
  16. {
  17. SDL_Surface * surface;
  18. public:
  19. // constructs canvas using existing surface. Caller maintains ownership on the surface
  20. CCanvas(SDL_Surface * surface);
  21. CCanvas(const Point & size);
  22. ~CCanvas();
  23. // renders image onto this canvas
  24. void draw(std::shared_ptr<IImage> image, const Point & pos);
  25. // renders another canvas onto this canvas
  26. void draw(std::shared_ptr<CCanvas> image, const Point & pos);
  27. // for compatibility, copies content of this canvas onto SDL_Surface
  28. void copyTo(SDL_Surface * to, const Point & pos);
  29. };