From 7570bee178217b673e675b7a74097aba1b76c011 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Mon, 10 Apr 2017 19:52:40 +0800 Subject: [PATCH] Add Surface::savePNG, powered by IMG_SavePNG. --- MiniEngine.cpp | 5 +++++ MiniEngine.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 783067f..a9b235a 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -150,6 +150,11 @@ namespace MiniEngine 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() { updateInfo(); diff --git a/MiniEngine.h b/MiniEngine.h index 6cb3d2e..96db246 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -85,7 +85,6 @@ namespace MiniEngine std::shared_ptr op; }; - enum class BlendMode { None = SDL_BLENDMODE_NONE, @@ -98,6 +97,7 @@ namespace MiniEngine { public: ~Surface() = default; + int savePNG(const std::string& filename); protected: Surface() = default; private: