Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yboichuk/lua/draw image transformed #47

Merged
merged 6 commits into from
Mar 25, 2024

Conversation

black-ghost-off
Copy link
Collaborator

Add interface beetween cpp lilka::Transform class and lua api, add function to lualilka_display.cpp what can draw image with transform.

Copy link
Owner

@and3rson and3rson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Виглядає супер! Треба тільки деякі незначні зміни.

@@ -253,6 +254,72 @@ int lualilka_display_drawImage(lua_State* L) {
return 0;
};

int lualilka_display_drawImageTransformed(lua_State* L) {
// Args are image table, X & Y
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут 4 аргументи

lilka::Transform& transform = *reinterpret_cast<lilka::Transform*>(luaL_checkudata(L, 4, IMAGE_TRANSFORM));

// Calculate the coordinates of the four corners of the destination rectangle.
lilka::int_vector_t v1 = transform.transform(lilka::int_vector_t{-image->pivotX, -image->pivotY});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чи є якась причина дублювання цього коду? Він же вже є в lilka::Canvas, можна просто поміняти сигнатуру getDrawable, щоб вона повертала lilka::Canvas* замість Arduino_GFX*.

@and3rson
Copy link
Owner

Супер!

@and3rson and3rson merged commit 48c443d into main Mar 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants