CanvasImage.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 setEffectColor(const ColorRGBA & color) override{};
  30. void shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove) override{};
  31. void adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask) override{};
  32. std::shared_ptr<ISharedImage> toSharedImage();
  33. private:
  34. SDL_Surface * surface;
  35. CanvasScalingPolicy scalingPolicy;
  36. };