MCPcopy Create free account
hub / github.com/RenderKit/embree / loadImageFromDisk

Function loadImageFromDisk

tutorials/common/image/image.cpp:39–53  ·  view source on GitHub ↗

! loads an image from a file with auto-detection of format */

Source from the content-addressed store, hash-verified

37
38 /*! loads an image from a file with auto-detection of format */
39 Ref<Image> loadImageFromDisk(const FileName& fileName)
40 {
41 std::string ext = toLowerCase(fileName.ext());
42
43 if (ext == "bmp" ) return loadSTB(fileName);
44 if (ext == "png" ) return loadSTB(fileName);
45 if (ext == "jpg" ) return loadSTB(fileName);
46
47 if (ext == "exr" ) return loadEXR(fileName);
48
49 if (ext == "pfm" ) return loadPFM(fileName);
50 if (ext == "ppm" ) return loadPPM(fileName);
51 if (ext == "tga" ) return loadTGA(fileName);
52 THROW_RUNTIME_ERROR("image format " + ext + " not supported");
53 }
54
55 static std::map<std::string,Ref<Image> > image_cache;
56

Callers 1

loadImageFunction · 0.85

Calls 7

toLowerCaseFunction · 0.85
loadSTBFunction · 0.85
loadEXRFunction · 0.85
loadPFMFunction · 0.85
loadPPMFunction · 0.85
loadTGAFunction · 0.85
extMethod · 0.80

Tested by

no test coverage detected