gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
ui::Polygon Struct Reference

A basic 2D polygon. More...

#include <polygon.hpp>

Inheritance diagram for ui::Polygon:
ui::Shape ui::Renderable ui::Rectangle ui::RegularPolygon

Public Member Functions

 Polygon (color_t color, const std::initializer_list< Coords > &&points, bool fill=false)
 Construct polygon from a set list of points.
 
 Polygon (color_t color, bool fill=false)
 Construct a polygon without any points.
 
void renderAt (const Coords &coords, const shader_t &shader) const override
 Display the renderable directly onto the screen.
 
Size getSize () const override
 Get the size of the renderable.
 

Public Attributes

bool fill
 Whether the shape is filled or just an outline.
 
color_t color
 The color of the polygon.
 
std::vector< Coordspoints
 The polygon vertices.
 

Detailed Description

A basic 2D polygon.

Note
Setting fill to true on self-intersecting polygons may yield unexpected results.

Constructor & Destructor Documentation

◆ Polygon() [1/2]

ui::Polygon::Polygon ( color_t  color,
const std::initializer_list< Coords > &&  points,
bool  fill = false 
)

Construct polygon from a set list of points.

Parameters
colorThe polygon color.
pointsA list of points.
fillWhether to fill the polygon or just draw an outline.

◆ Polygon() [2/2]

ui::Polygon::Polygon ( color_t  color,
bool  fill = false 
)

Construct a polygon without any points.

Parameters
colorThe polygon color.
fillWhether to fill the polygon or just draw an outline.

Member Function Documentation

◆ getSize()

Size ui::Polygon::getSize ( ) const
overridevirtual

Get the size of the renderable.

Returns
The size of the renderable in pixels.

Implements ui::Renderable.

◆ renderAt()

void ui::Polygon::renderAt ( const Coords coords,
const shader_t shader 
) const
overridevirtual

Display the renderable directly onto the screen.

Parameters
coordsThe coordinates to render the first pixel [0,0] of the renderable.
shaderAn optional pixel shader to apply to each pixel of the renderable.

Implements ui::Renderable.


The documentation for this struct was generated from the following file: