mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
All assets generation (large spellbook, terrain animations, etc) are now done in memory and used as it, without saving to disk. This should slightly improve load times since there is no encode png / decode png, and should help with avoiding strange bug when vcmi fails to load recently saved assets. If needed, such assets can be force-dumped on disk using already existing console command
44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
/*
|
|
* CanvasImage.h, part of VCMI engine
|
|
*
|
|
* Authors: listed in file AUTHORS in main folder
|
|
*
|
|
* License: GNU General Public License v2.0 or later
|
|
* Full text of license available in license.txt file, in main folder
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include "IImage.h"
|
|
#include "Canvas.h"
|
|
|
|
class CanvasImage : public IImage
|
|
{
|
|
public:
|
|
CanvasImage(const Point & size, CanvasScalingPolicy scalingPolicy);
|
|
|
|
Canvas getCanvas();
|
|
|
|
void draw(SDL_Surface * where, const Point & pos, const Rect * src, int scalingFactor) const override;
|
|
void scaleTo(const Point & size, EScalingAlgorithm algorithm) override;
|
|
void exportBitmap(const boost::filesystem::path & path) const override;
|
|
Rect contentRect() const override;
|
|
Point dimensions() const override;
|
|
|
|
//no-op methods
|
|
|
|
bool isTransparent(const Point & coords) const override{ return false;};
|
|
void setAlpha(uint8_t value) override{};
|
|
void playerColored(const PlayerColor & player) override{};
|
|
void setOverlayColor(const ColorRGBA & color) override{};
|
|
void shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove) override{};
|
|
void adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask) override{};
|
|
|
|
std::shared_ptr<ISharedImage> toSharedImage();
|
|
|
|
private:
|
|
SDL_Surface * surface;
|
|
CanvasScalingPolicy scalingPolicy;
|
|
};
|
|
|