1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added draw method to ISharedImage interface

This commit is contained in:
Ivan Savenko 2024-07-24 13:35:30 +00:00
parent 502f47c6b5
commit 2d12cecded
4 changed files with 6 additions and 3 deletions

View File

@ -21,6 +21,7 @@ class ColorRGBA;
VCMI_LIB_NAMESPACE_END
struct SDL_Surface;
struct SDL_Palette;
class ColorFilter;
/// Defines which blit method will be selected when image is used for rendering
@ -88,6 +89,7 @@ public:
virtual Point dimensions() const = 0;
virtual void exportBitmap(const boost::filesystem::path & path) const = 0;
virtual bool isTransparent(const Point & coords) const = 0;
virtual void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, uint8_t alpha, EImageBlitMode mode) const = 0;
virtual std::shared_ptr<IImage> createImageReference(EImageBlitMode mode) = 0;

View File

@ -28,7 +28,7 @@ int ImageSharedScaled::getScalingFactor() const
return 2;
}
void ImageSharedScaled::draw(SDL_Surface *where, const Point &dest, const Rect *src, uint8_t alpha, EImageBlitMode mode) const
void ImageSharedScaled::draw(SDL_Surface *where, SDL_Palette * palette, const Point &dest, const Rect *src, uint8_t alpha, EImageBlitMode mode) const
{
scaledImage->draw(where, nullptr, dest, src, alpha, mode);
}

View File

@ -10,6 +10,7 @@
#pragma once
#include "../render/IImage.h"
#include "../render/IRenderHandler.h"
struct SDL_Palette;
@ -24,7 +25,7 @@ class ImageSharedScaled final : public ISharedImage, public std::enable_shared_f
public:
ImageSharedScaled(std::shared_ptr<SDLImageShared> sourceImage);
void draw(SDL_Surface * where, const Point & dest, const Rect * src, uint8_t alpha, EImageBlitMode mode) const;
void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, uint8_t alpha, EImageBlitMode mode) const override;
void exportBitmap(const boost::filesystem::path & path) const override;
Point dimensions() const override;

View File

@ -47,7 +47,7 @@ public:
SDLImageShared(SDL_Surface * from);
~SDLImageShared();
void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, uint8_t alpha, EImageBlitMode mode) const;
void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, uint8_t alpha, EImageBlitMode mode) const override;
void exportBitmap(const boost::filesystem::path & path) const override;
Point dimensions() const override;