| 648 | } |
| 649 | |
| 650 | bool Image::initWithImageFile(std::string_view path) |
| 651 | { |
| 652 | bool ret = false; |
| 653 | _filePath = FileUtils::getInstance()->fullPathForFilename(path); |
| 654 | |
| 655 | Data data = FileUtils::getInstance()->getDataFromFile(_filePath); |
| 656 | |
| 657 | if (!data.isNull()) |
| 658 | { |
| 659 | ssize_t n = 0; |
| 660 | auto buf = data.takeBuffer(&n); |
| 661 | ret = initWithImageData(buf, n, true); |
| 662 | } |
| 663 | |
| 664 | return ret; |
| 665 | } |
| 666 | |
| 667 | bool Image::initWithImageFileThreadSafe(std::string_view fullpath) |
| 668 | { |