You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code to rotate a pixel from the virtual, rotated coordinate to physical screen coordinates is repeated many times.
int16_t t;
switch (rotation) {
case1:
t = x;
x = WIDTH - 1 - y;
y = t;
break;
case2:
x = WIDTH - 1 - x;
y = HEIGHT - 1 - y;
break;
case3:
t = x;
x = y;
y = HEIGHT - 1 - t;
break;
}
I think there should be a function applyRotation(x, y) that goes from virtual, rotated coordinates to physical screen coordinates. I think there should also be a function that does the inverse. Something like undoRotation(x, y) that goes from physical screen coordinates to virtual, rotated coordinates. This is useful when using touch screens, so you can transform the touch event's coordinates into the virtual coordinates.
Would you accept a pull request generalizing all of the places this code is repeated into a single function and adding the inverse function?
The text was updated successfully, but these errors were encountered:
This code to rotate a pixel from the virtual, rotated coordinate to physical screen coordinates is repeated many times.
I think there should be a function
applyRotation(x, y)
that goes from virtual, rotated coordinates to physical screen coordinates. I think there should also be a function that does the inverse. Something likeundoRotation(x, y)
that goes from physical screen coordinates to virtual, rotated coordinates. This is useful when using touch screens, so you can transform the touch event's coordinates into the virtual coordinates.Would you accept a pull request generalizing all of the places this code is repeated into a single function and adding the inverse function?
The text was updated successfully, but these errors were encountered: