MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / ReadFromStream

Function ReadFromStream

src/openrct2/core/Imaging.cpp:291–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 2

ReadFromFileFunction · 0.85
ReadFromBufferFunction · 0.85

Calls 2

ReadPngFunction · 0.85
GetReaderFunction · 0.85

Tested by

no test coverage detected