-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add rotated rectangle draw and fill methods #489
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
base: master
Are you sure you want to change the base?
Add rotated rectangle draw and fill methods #489
Conversation
|
@ladyada for review. |
|
thanks! please also add some example to test this code, maybe displaying rotating rectangles - so we can easily verify functionality on platforms/displays :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for drawing rotated rectangles to the Adafruit GFX library. The implementation includes functions to draw outlined rotated rectangles, filled rotated rectangles, and a helper function to rotate points around an origin.
- Adds
drawRotatedRectangleandfillRotatedRectanglemethods for rendering rotated rectangles - Implements a
rotatePointhelper function for coordinate rotation - Uses trigonometric functions to rotate rectangle corners and existing drawing primitives (lines and triangles) for rendering
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Adafruit_GFX.h | Adds method declarations for the three new rotated rectangle functions |
| Adafruit_GFX.cpp | Implements the rotated rectangle drawing logic with supporting rotation math |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Wasn't sure where you wanted an example, so I placed one in the 'examples' directory in a directory called 'RotatedRectangleTest'. I only have kind of an oddball display to run this on (it is 128 x 128), and it's using the 'Adafruit_ST7735_and_ST7789_Library', so the example is failing the 'test platforms' check (works on my device...). Any suggestions? |
These methods implement the ability to draw and fill rectangles rotated by a given angle in degrees.