| 111 | } |
| 112 | |
| 113 | void ImageExport::SavePNG(const char *file_path, unsigned char *data, unsigned long width, unsigned long height, unsigned short levels) { |
| 114 | std::vector<unsigned char> scaled_data; |
| 115 | ImageExport::ScaleImageUp(data, levels, &width, &height, &scaled_data); |
| 116 | CreateParentDirs(file_path); |
| 117 | #ifdef _WIN32 |
| 118 | createfile(file_path); |
| 119 | std::string short_path(file_path); |
| 120 | ShortenWindowsPath(short_path); |
| 121 | if (!stbi_write_png(short_path.c_str(), width, height, 3, scaled_data.data(), width * 4)) { |
| 122 | DisplayError("Error", "Problem exporting .png file"); |
| 123 | } |
| 124 | #else |
| 125 | if (!stbi_write_png(file_path, width, height, 3, scaled_data.data(), width * 4)) { |
| 126 | DisplayError("Error", "Problem exporting .png file"); |
| 127 | } |
| 128 | #endif |
| 129 | } |
| 130 | |
| 131 | void ImageExport::SavePNGTransparent(const char *file_path, unsigned char *data, unsigned long width, unsigned long height, unsigned short levels) { |
| 132 | std::vector<unsigned char> scaled_data; |
nothing calls this directly
no test coverage detected