mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
Add new Lua function to query size of an image
This commit is contained in:
Submodule ext/ghoul updated: 50315734cb...90240b2d5b
@@ -1738,6 +1738,7 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
|
||||
codegen::lua::RemoveTag,
|
||||
codegen::lua::DownloadFile,
|
||||
codegen::lua::CreateSingleColorImage,
|
||||
codegen::lua::ImageSize,
|
||||
codegen::lua::SaveBase64File,
|
||||
codegen::lua::IsMaster,
|
||||
codegen::lua::Version,
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <ghoul/filesystem/cachemanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/io/texture/texturewriter.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/lua/lua_helper.h>
|
||||
@@ -209,6 +210,16 @@ namespace {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns the size in pixels of an image file.
|
||||
*
|
||||
* \param path The location of the image file for which the pixel size will be returned
|
||||
* \return The size of the image in pixels
|
||||
*/
|
||||
[[codegen::luawrap]] glm::ivec2 imageSize(std::filesystem::path path) {
|
||||
return ghoul::io::TextureReader::ref().imageSize(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function takes a base64 encoded data string, decodes it and saves the resulting
|
||||
* data to the provided filepath.
|
||||
|
||||
Reference in New Issue
Block a user