MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / pf_image_load

Function pf_image_load

engine/PoseidonFormats/PoseidonFormats.cpp:407–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405// ── PAA/PAC Image ──────────────────────────────────────────────────────────
406
407PF_API PF_HANDLE pf_image_load(const char* path) {
408 ClearError();
409 if (!path) { SetError("null path"); return nullptr; }
410 try {
411 Poseidon::PAAInfo info;
412 if (!Poseidon::ReadPAAInfo(path, info)) {
413 SetError("Not a PAA/PAC file");
414 return nullptr;
415 }
416 auto decoded = Poseidon::DecodePAAFile(path);
417 if (!decoded.valid()) {
418 SetError("Failed to decode image");
419 return nullptr;
420 }
421 auto* wrapper = new PFImage();
422 wrapper->image = std::move(decoded);
423 wrapper->formatName = info.formatName ? info.formatName : "unknown";
424 return wrapper;
425 } catch (const std::exception& e) {
426 SetError(e.what());
427 return nullptr;
428 }
429}
430
431PF_API void pf_image_free(PF_HANDLE img) {
432 delete static_cast<PFImage*>(img);

Callers 1

Calls 5

ClearErrorFunction · 0.85
ReadPAAInfoFunction · 0.85
DecodePAAFileFunction · 0.85
SetErrorFunction · 0.70
validMethod · 0.45

Tested by

no test coverage detected