diff options
| author | Ray <[email protected]> | 2021-05-20 20:37:46 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-05-20 20:37:46 +0200 |
| commit | 4a099c3658f13224e923843abbdb1e718ed3a22b (patch) | |
| tree | 9d626b62c5ea4ebbfc888f0e743216b1ed419a64 | |
| parent | 23a08a483e17d8c8e8b4774527027bb14ec6b933 (diff) | |
| download | raylib-4a099c3658f13224e923843abbdb1e718ed3a22b.tar.gz raylib-4a099c3658f13224e923843abbdb1e718ed3a22b.zip | |
Review ExportImage() to use SaveFileData() #1779
| -rw-r--r-- | src/textures.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/textures.c b/src/textures.c index de0d76ba..db562bd9 100644 --- a/src/textures.c +++ b/src/textures.c @@ -416,7 +416,13 @@ bool ExportImage(Image image, const char *fileName) } #if defined(SUPPORT_FILEFORMAT_PNG) - if (IsFileExtension(fileName, ".png")) success = stbi_write_png(fileName, image.width, image.height, channels, imgData, image.width*channels); + if (IsFileExtension(fileName, ".png")) + { + int dataSize = 0; + unsigned char *fileData = stbi_write_png_to_mem((const unsigned char *)imgData, image.width*channels, image.width, image.height, channels, &dataSize); + success = SaveFileData(fileName, fileData, dataSize); + RL_FREE(fileData); + } #else if (false) {} #endif |
