diff --git a/src/RaZ/Script/LuaData.cpp b/src/RaZ/Script/LuaData.cpp index 7ce0bac5..b1d83ec2 100644 --- a/src/RaZ/Script/LuaData.cpp +++ b/src/RaZ/Script/LuaData.cpp @@ -106,8 +106,24 @@ void LuaWrapper::registerDataTypes() { image["isEmpty"] = &Image::isEmpty; image["recoverByteValue"] = &Image::recoverByteValue; image["recoverFloatValue"] = &Image::recoverFloatValue; + image["recoverBytePixel"] = PickOverload(&Image::recoverPixel); + image["recoverFloatPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec2bPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec3bPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec4bPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec2fPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec3fPixel"] = PickOverload(&Image::recoverPixel); + image["recoverVec4fPixel"] = PickOverload(&Image::recoverPixel); image["setByteValue"] = &Image::setByteValue; image["setFloatValue"] = &Image::setFloatValue; + image["setBytePixel"] = PickOverload(&Image::setPixel); + image["setFloatPixel"] = PickOverload(&Image::setPixel); + image["setVec2bPixel"] = PickOverload(&Image::setPixel); + image["setVec3bPixel"] = PickOverload(&Image::setPixel); + image["setVec4bPixel"] = PickOverload(&Image::setPixel); + image["setVec2fPixel"] = PickOverload(&Image::setPixel); + image["setVec3fPixel"] = PickOverload(&Image::setPixel); + image["setVec4fPixel"] = PickOverload(&Image::setPixel); state.new_enum("ImageColorspace", { { "GRAY", ImageColorspace::GRAY }, diff --git a/tests/src/RaZ/Script/LuaData.cpp b/tests/src/RaZ/Script/LuaData.cpp index 04b8b15a..549778a8 100644 --- a/tests/src/RaZ/Script/LuaData.cpp +++ b/tests/src/RaZ/Script/LuaData.cpp @@ -89,11 +89,15 @@ TEST_CASE("LuaData Image") { assert(not img:isEmpty()) img:setFloatValue(0, 0, 0, 3.0) assert(img:recoverFloatValue(0, 0, 0) == 3.0) + img:setVec4fPixel(0, 0, Vec4f.new(1, 2, 3, 4)) + assert(img:recoverVec4fPixel(0, 0) == Vec4f.new(1, 2, 3, 4)) img = Image.new(1, 1, ImageColorspace.SRGB, ImageDataType.BYTE) assert(img:getChannelCount() == 3) img:setByteValue(0, 0, 0, 127) assert(img:recoverByteValue(0, 0, 0) == 127) + img:setVec3bPixel(0, 0, Vec3b.new(1, 2, 3)) + assert(img:recoverVec3bPixel(0, 0) == Vec3b.new(1, 2, 3)) local pngPath = FilePath.new(RAZ_TESTS_ROOT .. "assets/images/dëfàùltTêst.png") local tgaPath = FilePath.new(RAZ_TESTS_ROOT .. "assets/images/dëfàùltTêst.tga")