Add Surface::savePNG, powered by IMG_SavePNG.

This commit is contained in:
Kirigaya Kazuto 2017-04-10 19:52:40 +08:00
parent 01735059fc
commit 7570bee178
2 changed files with 6 additions and 1 deletions

View File

@ -150,6 +150,11 @@ namespace MiniEngine
op.reset(SDL_RWFromMem(mem,size),[](SDL_RWops* p){SDL_RWclose(p);}); op.reset(SDL_RWFromMem(mem,size),[](SDL_RWops* p){SDL_RWclose(p);});
} }
int Surface::savePNG(const std::string& filename)
{
return IMG_SavePNG(surf.get(),filename.c_str());
}
Texture::Texture() Texture::Texture()
{ {
updateInfo(); updateInfo();

View File

@ -85,7 +85,6 @@ namespace MiniEngine
std::shared_ptr<SDL_RWops> op; std::shared_ptr<SDL_RWops> op;
}; };
enum class BlendMode enum class BlendMode
{ {
None = SDL_BLENDMODE_NONE, None = SDL_BLENDMODE_NONE,
@ -98,6 +97,7 @@ namespace MiniEngine
{ {
public: public:
~Surface() = default; ~Surface() = default;
int savePNG(const std::string& filename);
protected: protected:
Surface() = default; Surface() = default;
private: private: