From 4cd137a6398292ed7b02a4339060eaf72f9c6118 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 7 Oct 2021 19:10:27 -0300 Subject: [PATCH] [lua] Add Image.rowStride property now that Image.bytes is available We need to know the specific rowStride to be able to set a proper Image.bytes (bytes size = Image.height * Image.rowStride). --- src/app/script/image_class.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/script/image_class.cpp b/src/app/script/image_class.cpp index 857e44e95..785237852 100644 --- a/src/app/script/image_class.cpp +++ b/src/app/script/image_class.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2018-2020 Igara Studio S.A. +// Copyright (C) 2018-2021 Igara Studio S.A. // Copyright (C) 2015-2018 David Capello // // This program is distributed under the terms of @@ -484,6 +484,13 @@ int Image_resize(lua_State* L) return 0; } +int Image_get_rowStride(lua_State* L) +{ + const auto obj = get_obj(L, 1); + lua_pushinteger(L, obj->image(L)->getRowStrideSize()); + return 1; +} + int Image_get_bytes(lua_State* L) { const auto img = get_obj(L, 1)->image(L); @@ -562,6 +569,7 @@ const luaL_Reg Image_methods[] = { }; const Property Image_properties[] = { + { "rowStride", Image_get_rowStride, nullptr }, { "bytes", Image_get_bytes, Image_set_bytes }, { "width", Image_get_width, nullptr }, { "height", Image_get_height, nullptr },