| 289 | } |
| 290 | |
| 291 | static Image ReadFromStream(std::istream& istream, ImageFormat format) |
| 292 | { |
| 293 | switch (format) |
| 294 | { |
| 295 | case ImageFormat::png: |
| 296 | return ReadPng(istream, false); |
| 297 | case ImageFormat::png32: |
| 298 | return ReadPng(istream, true); |
| 299 | case ImageFormat::automatic: |
| 300 | throw std::invalid_argument("format can not be automatic."); |
| 301 | default: |
| 302 | { |
| 303 | auto impl = GetReader(format); |
| 304 | if (impl) |
| 305 | { |
| 306 | return impl(istream, format); |
| 307 | } |
| 308 | throw std::runtime_error(kExceptionImageFormatUnknown); |
| 309 | } |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | Image ReadFromFile(std::string_view path, ImageFormat format) |
| 314 | { |
no test coverage detected