mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Added love.math.compress(data, format [, level]) and love.math.decompress(compresseddata) / love.math.decompress(compressedstring, format).
Renamed the love.image CompressedData type to CompressedImageData. love.math.compress returns a love.math CompressedData object which holds the newly compressed data. Currently supported formats are "lz4" and "zlib". Note that the formats are not file formats and don't compress filesystem hierarchies.
This commit is contained in:
@@ -70,13 +70,13 @@ int w_newCompressedData(lua_State *L)
|
||||
{
|
||||
love::filesystem::FileData *data = love::filesystem::luax_getfiledata(L, 1);
|
||||
|
||||
CompressedData *t = nullptr;
|
||||
CompressedImageData *t = nullptr;
|
||||
luax_catchexcept(L,
|
||||
[&]() { t = instance()->newCompressedData(data); },
|
||||
[&]() { data->release(); }
|
||||
);
|
||||
|
||||
luax_pushtype(L, IMAGE_COMPRESSED_DATA_ID, t);
|
||||
luax_pushtype(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ static const luaL_Reg functions[] =
|
||||
static const lua_CFunction types[] =
|
||||
{
|
||||
luaopen_imagedata,
|
||||
luaopen_compresseddata,
|
||||
luaopen_compressedimagedata,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user