| 417 | } |
| 418 | |
| 419 | bool RenderTexture::saveToFile(std::string_view filename, bool isRGBA, SaveFileCallbackType callback) |
| 420 | { |
| 421 | std::string basename(filename); |
| 422 | std::transform(basename.begin(), basename.end(), basename.begin(), ::tolower); |
| 423 | |
| 424 | if (basename.find(".png") != std::string::npos) |
| 425 | { |
| 426 | return saveToFile(filename, Image::Format::PNG, isRGBA, std::move(callback)); |
| 427 | } |
| 428 | else if (basename.find(".jpg") != std::string::npos) |
| 429 | { |
| 430 | if (isRGBA) |
| 431 | AXLOGD("RGBA is not supported for JPG format."); |
| 432 | return saveToFile(filename, Image::Format::JPG, false, std::move(callback)); |
| 433 | } |
| 434 | else |
| 435 | { |
| 436 | AXLOGD("Only PNG and JPG format are supported now!"); |
| 437 | } |
| 438 | |
| 439 | return saveToFile(filename, Image::Format::JPG, false, std::move(callback)); |
| 440 | } |
| 441 | |
| 442 | bool RenderTexture::saveToFileAsNonPMA(std::string_view fileName, |
| 443 | Image::Format format, |
no test coverage detected