/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "ImageLoaderPng.hpp" #include #include #include namespace OpenVulkano::Image { std::unique_ptr ImageLoaderPng::loadFromFile(const std::string& filePath) { std::ifstream file(filePath, std::ios::binary); if (!file) { throw std::runtime_error("Could not open file: " + filePath); } std::vector buffer((std::istreambuf_iterator(file)), std::istreambuf_iterator()); return loadData(buffer.data(), static_cast(buffer.size())); } std::unique_ptr ImageLoaderPng::loadFromMemory(const std::vector& buffer) { return loadData(buffer.data(), static_cast(buffer.size())); } }