CanvasImage.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * CanvasImage.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. #include "IImage.h"
  12. #include "Canvas.h"
  13. class CanvasImage : public IImage
  14. {
  15. public:
  16. CanvasImage(const Point & size, CanvasScalingPolicy scalingPolicy);
  17. ~CanvasImage();
  18. Canvas getCanvas();
  19. void draw(SDL_Surface * where, const Point & pos, const Rect * src, int scalingFactor) const override;
  20. void scaleTo(const Point & size, EScalingAlgorithm algorithm) override;
  21. void exportBitmap(const boost::filesystem::path & path) const override;
  22. Rect contentRect() const override;
  23. Point dimensions() const override;
  24. //no-op methods
  25. bool isTransparent(const Point & coords) const override{ return false;};
  26. void setAlpha(uint8_t value) override{};
  27. void playerColored(const PlayerColor & player) override{};
  28. void setOverlayColor(const ColorRGBA & color) override{};
  29. void shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove) override{};
  30. void adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask) override{};
  31. std::shared_ptr<ISharedImage> toSharedImage();
  32. private:
  33. SDL_Surface * surface;
  34. CanvasScalingPolicy scalingPolicy;
  35. };