| 607 | } // namespace |
| 608 | |
| 609 | std::optional<dec::Targa::Image> dec::Targa::loadTgaFromFile(std::string filename) |
| 610 | { |
| 611 | std::ifstream tgaFile(filename, std::ios::binary); |
| 612 | |
| 613 | auto header = readHeader(tgaFile); |
| 614 | if (!header) |
| 615 | return {}; |
| 616 | |
| 617 | try |
| 618 | { |
| 619 | auto image = readImage(tgaFile, *header); |
| 620 | postProcessImage(image, *header); |
| 621 | return image; |
| 622 | } |
| 623 | catch (const std::exception &e) |
| 624 | { |
| 625 | std::cerr << e.what() << '\n'; |
| 626 | } |
| 627 | |
| 628 | return {}; |
| 629 | } |
nothing calls this directly
no test coverage detected