This commit is contained in:
Isuru Samarathunga
2025-10-18 14:41:28 +05:30
parent fb66a2d09d
commit d4e93b047c

View File

@ -94,7 +94,7 @@ namespace ia::iae
Handle Engine::CreateImageFromFile(IN CONST String &name, IN CONST String &path, IN INT32 resizeToWidth, Handle Engine::CreateImageFromFile(IN CONST String &name, IN CONST String &path, IN INT32 resizeToWidth,
IN INT32 resizeToHeight) IN INT32 resizeToHeight)
{ {
const auto data = File::ReadToVector(path.c_str()); const auto data = ReadBinaryAsset(path);
const auto handle = CreateImage(name, data.data(), data.size()); const auto handle = CreateImage(name, data.data(), data.size());
const auto extent = GetImageExtent(handle); const auto extent = GetImageExtent(handle);
return (resizeToWidth && resizeToHeight) ? RescaleImage(handle, {(FLOAT32)resizeToWidth/(FLOAT32)extent.x, (FLOAT32)resizeToHeight/(FLOAT32)extent.y}) : handle; return (resizeToWidth && resizeToHeight) ? RescaleImage(handle, {(FLOAT32)resizeToWidth/(FLOAT32)extent.x, (FLOAT32)resizeToHeight/(FLOAT32)extent.y}) : handle;