Skip to content

Conversation

@BillMerryman
Copy link
Contributor

These methods implement the ability to draw and fill rectangles rotated by a given angle in degrees.

@BillMerryman
Copy link
Contributor Author

@ladyada for review.

@ladyada ladyada requested a review from Copilot November 7, 2025 18:29
@ladyada
Copy link
Member

ladyada commented Nov 7, 2025

thanks! please also add some example to test this code, maybe displaying rotating rectangles - so we can easily verify functionality on platforms/displays :)

Copy link

Copilot AI left a 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 drawRotatedRectangle and fillRotatedRectangle methods for rendering rotated rectangles
  • Implements a rotatePoint helper 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.

@BillMerryman
Copy link
Contributor Author

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?

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.

2 participants