Added support for rotated and ranged drawings with LED matrix #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_NONEfor zero rotations..ROTATE_CW1,.ROTATE_CW2,.ROTATE_CW3for clockwise rotations..ROTATE_CCW1,.ROTATE_CCW2,.ROTATE_CCW3for 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
TextScrollDemotoLedDrawingDemo. 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.