Add Bitmap::SaveSurfaceToFile

This commit is contained in:
scawful
2023-08-18 10:27:50 -04:00
parent b0df91b7d5
commit 26f6531c9d
2 changed files with 6 additions and 1 deletions

View File

@@ -137,6 +137,10 @@ void Bitmap::UpdateTexture(std::shared_ptr<SDL_Renderer> renderer) {
SDL_Texture_Deleter{}};
}
void Bitmap::SaveSurfaceToFile(std::string_view filename) {
SDL_SaveBMP(surface_.get(), filename.data());
}
void Bitmap::SetSurface(SDL_Surface *surface) {
surface_ = std::unique_ptr<SDL_Surface, SDL_Surface_Deleter>(
surface, SDL_Surface_Deleter());

View File

@@ -28,7 +28,7 @@ class Bitmap {
void Create(int width, int height, int depth, int data_size);
void Create(int width, int height, int depth, uchar *data, int data_size);
void Create(int width, int height, int depth, Bytes data);
void CreateFromSurface(SDL_Surface *surface);
void Apply(Bytes data);
@@ -36,6 +36,7 @@ class Bitmap {
void CreateTexture(std::shared_ptr<SDL_Renderer> renderer);
void UpdateTexture(std::shared_ptr<SDL_Renderer> renderer);
void SaveSurfaceToFile(std::string_view filename);
void SetSurface(SDL_Surface *surface);
void ApplyPalette(const SNESPalette &palette);