MCPcopy Create free account
hub / github.com/RenderKit/ospray / writeImg

Method writeImg

apps/ospTestSuite/test_tools.cpp:59–84  ·  view source on GitHub ↗

helper function to write the rendered image

Source from the content-addressed store, hash-verified

57
58// helper function to write the rendered image
59OsprayStatus OSPImageTools::writeImg(std::string fileName, const void *pixel)
60{
61 OsprayStatus writeErr = OsprayStatus::Error;
62 fileName += GetFileFormat();
63 if (GetFileFormat() == ".ppm") {
64 rkcommon::utility::writePPM(
65 fileName, size.x, size.y, (const uint32_t *)pixel);
66 writeErr = OsprayStatus::Ok;
67 } else if (GetFileFormat() == ".png") {
68 writeErr = writePNG(fileName, (const uint32_t *)pixel);
69 } else if (GetFileFormat() == ".hdr") {
70 writeErr = writeHDR(fileName, (const float *)pixel);
71 } else if (GetFileFormat() == ".pfm") {
72 try {
73 rkcommon::utility::writePFM(fileName, size.x, size.y, (const vec4f *)pixel);
74 writeErr = OsprayStatus::Ok;
75 } catch (...) {
76 writeErr = OsprayStatus::Fail;
77 }
78 } else {
79 std::cerr << "Unsupported file format" << std::endl;
80 writeErr = OsprayStatus::Error;
81 }
82
83 return writeErr;
84}
85
86OsprayStatus OSPImageTools::verifyBaselineImage(const int sizeX,
87 const int sizeY,

Callers

nothing calls this directly

Calls 1

writePPMFunction · 0.50

Tested by

no test coverage detected