Add regular polygon shapes to display component (#3551)

This commit is contained in:
mathieu-mp 2024-03-01 04:49:29 +01:00 committed by GitHub
parent 3d9616b5eb
commit 4d279427e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -101,6 +101,13 @@ and circles:
// and a filled triangle !
it.filled_triangle(125, 5, 105, 25, 150, 50);
// Regular Polygons? Let's draw the outline of a pointy-topped hexagon inscribed in a circle
// centered on [x1=100,y1=100] with a radius of 50
it.regular_polygon(100, 100, 50, EDGES_HEXAGON);
// and a filled flat-topped octagon!
it.filled_regular_polygon(200, 200, 50, EDGES_OCTAGON, VARIATION_FLAT_TOP);
// Need to rotate the polygon, or retrieve the coordinates of its vertices? Check the API!
All the above methods can optionally also be called with an argument at the end which specifies in which
color to draw. For monochrome displays, only ``COLOR_ON`` (the default if color is not given) and ``COLOR_OFF`` are supported.