Skip to content

Conversation

@geeksunny
Copy link
Contributor

Hello again! While using this driver in a project of my own, I needed the ability to change the rotation/orientation of draws to the LED matrix. These changes add that ability.

Rotation can be set globally on the LedMatrix using ledMatrix.setRotation(int) with the int being an integer representing the amount of 90 degree rotations. Some constants are available to make things easy.

  • LedMatrix.ROTATE_NONE for zero rotations.
  • .ROTATE_CW1, .ROTATE_CW2, .ROTATE_CW3 for clockwise rotations.
  • .ROTATE_CCW1, .ROTATE_CCW2, .ROTATE_CCW3 for counter-clockwise rotations.

Additional overloads of the drawing methods are also available with the ability to pass a rotation value for that specific draw operation. ie ledMatrix.draw(Bitmap, int)

I've also added the ability to draw a specific region of a bitmap using bounds. This is useful in the case of rendering scrolling text. The demo app's TextScrollDemo was creating new Bitmap objects for each frame rendered during the scroll. Using draw bounds we are able to use a single Bitmap and just draw a portion at a time.

This includes updates to the demo app to show off the added feature. I renamed the TextScrollDemo to LedDrawingDemo. The text scrolling has been updated to use the draw bounds and there is now a rotating green & blue Android sprite shown between text scrolls.

Let me know if you'd like me to make any changes to formatting. Its been a few months since I wrote a lot of this code and I'm open to suggestions for improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant