MCPcopy Create free account
hub / github.com/cocos/cocos-engine / initWithImageFile

Method initWithImageFile

native/cocos/platform/Image.cpp:275–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275bool Image::initWithImageFile(const ccstd::string &path) {
276 bool ret = false;
277 //NOTE: fullPathForFilename isn't threadsafe. we should make sure the parameter is a full path.
278 // _filePath = FileUtils::getInstance()->fullPathForFilename(path);
279 _filePath = path;
280
281 const Data data = FileUtils::getInstance()->getDataFromFile(_filePath);
282
283 if (!data.isNull()) {
284 ret = initWithImageData(data.getBytes(), data.getSize());
285 }
286
287 return ret;
288}
289
290bool Image::initWithImageData(const unsigned char *data, uint32_t dataLen) { //NOLINT(misc-no-recursion)
291 bool ret = false;

Callers 4

loadTextureMethod · 0.80
jsb_global_load_imageFunction · 0.80
loadImageTrackingDataMethod · 0.80
asyncLoadAssetsImageMethod · 0.80

Calls 4

getDataFromFileMethod · 0.80
isNullMethod · 0.45
getBytesMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected