Definition of a rounded rectangle shape. More...
#include <canvas_private.hpp>
Public Member Functions | |
round_rectangle_shape (const config &cfg) | |
Constructor. More... | |
void | draw (surface &canvas, SDL_Renderer *renderer, const SDL_Rect &viewport, wfl::map_formula_callable &variables) override |
Draws the canvas. More... | |
![]() | |
shape (const config &cfg) | |
virtual | ~shape () |
bool | immutable () const |
Private Attributes | |
typed_formula< int > | r_ |
The radius of the corners. More... | |
int | border_thickness_ |
Border thickness. More... | |
typed_formula< color_t > | border_color_ |
The border color of the rounded rectangle. More... | |
typed_formula< color_t > | fill_color_ |
The border color of the rounded rectangle. More... | |
Additional Inherited Members | |
![]() | |
rect_bounded_shape (const config &cfg) | |
Constructor. More... | |
calculated_rects | calculate_rects (const SDL_Rect &view_bounds, wfl::map_formula_callable &variables) const |
Definition of a rounded rectangle shape.
When drawing a rounded rectangle it doesn't get blended on the surface but replaces the pixels instead. A blitting flag might be added later if needed.
Key | Type | Default | Description |
---|---|---|---|
corner_radius | f_unsigned | 0 | The radius of the rectangle's corners. |
border_thickness | unsigned | 0 | The thickness of the border; if the thickness is zero it's not drawn. |
border_color | color | "" | The color of the border; if empty it's not drawn. |
fill_color | color | "" | The color of the interior; if omitted it's not drawn. |
debug | string | "" | Debug message to show upon creation; this message is not stored. |
Definition at line 234 of file canvas_private.hpp.
|
explicit |
Constructor.
cfg | The config object to define the round rectangle. |
Definition at line 361 of file canvas.cpp.
References border_color_, border_thickness_, DBG_GUI_P, debug, and gui2::typed_formula< T >::has_formula().
|
overridevirtual |
Draws the canvas.
canvas | The resulting image will be blitted upon this canvas. |
renderer | The SDL_Renderer to use. |
view_bounds | Part of the shape to render - this is the location of canvas within the coordinates of the shape. |
variables | The canvas can have formulas in it's definition, this parameter contains the values for these formulas. |
Implements gui2::canvas::shape.
Definition at line 379 of file canvas.cpp.
References border_color_, border_thickness_, gui2::rect_bounded_shape::calculate_rects(), DBG_GUI_D, fill_color_, h, i, color_t::null(), r_, and w.
|
private |
The border color of the rounded rectangle.
If the color is fully transparent the border isn't drawn.
Definition at line 263 of file canvas_private.hpp.
Referenced by draw(), and round_rectangle_shape().
|
private |
Border thickness.
If 0 the fill color is used for the entire widget.
Definition at line 256 of file canvas_private.hpp.
Referenced by draw(), and round_rectangle_shape().
|
private |
The border color of the rounded rectangle.
If the color is fully transparent the rounded rectangle won't be filled.
Definition at line 270 of file canvas_private.hpp.
Referenced by draw().
|
private |