BuGUI
BUtton Grid User Interface
Loading...
Searching...
No Matches
bugui::painter Struct Referencefinal

Adds 2D information on top of a base_painter. The painter is used in user defined paint funcions to draw on the device. Meant to traverse the entire widget tree, each widget temporarly applies a coordinate offset to the painter, reflecting their relative position in the scene. More...

#include <painter.hpp>

Inheritance diagram for bugui::painter:
bugui::base_painter bugui::rectangle

Public Member Functions

 painter (int width, int height)
void set (int x, int y)
 Explicitly set displacement values.
void ofset (int x, int y)
 Increment current displacement values by the given coordinates.
void reset ()
 Nullifies anny previous call to set and ofset.
bool bound_at_offset (rectangle *bounds)
 Set the size of the underlying rectangle. after aplying the coordinate offset to the bounds argument, the size is calculated to lie within the phisical dimentions of the device's grid, even .
void draw_cell (int x, int y)
 Paint the cell at the given coordinates with the currently set color.
void draw_line (int x1, int y1, int x2, int y2)
 Paint a linear succesion of cells with the currently set color, from [x1, y1] to [x2, y2].
void set_paint_over (bool value)
 Set whereter the next painted cells can be painted over or not.
color read_clear (int x, int y)
 Retrives the color of the cell at the given coordinates and set it to to black.
Public Member Functions inherited from bugui::base_painter
void set_color (uint8_t &&r=0, uint8_t &&g=0, uint8_t &&b=0, uint8_t &&a=255)
 Sets the primary colour along with the constant state.
void set_blink (uint8_t &&red, uint8_t &&green, uint8_t &&blue, uint8_t &&alpha=255)
 Sets primary and secondary colour along with the blinking state.
void set_pulse (uint8_t &&red, uint8_t &&green, uint8_t &&blue, uint8_t &&alpha=255)
 Sets primary and secondary colour along with the pulsing state.
Public Member Functions inherited from bugui::rectangle
int get_x () const
int get_y () const
void set_x (int new_x)
void set_y (int new_y)
int get_width () const
int get_height () const
void set_width (int new_width)
void set_height (int new_height)
void set_size (int new_size)
void set (int new_x, int new_y)
void set (int new_x, int new_y, int new_width, int new_height)
const pointget_top_left () const
const pointget_bottom_right () const
void set_top_left (point &&new_top_left)
void set_bottom_right (point &&new_bottom_right)

Additional Inherited Members

Protected Member Functions inherited from bugui::rectangle
virtual bool overlap (rectangle &other) const
 Checks whether this rectangle overlaps with another. This funciton is the bassis for handling inputs on the grid. The presser object also inherits from rectangle, and this function is called to check if a press event overlaps with a widget. If so, we can determine that this particular widget is pressed. Custom widgets can override this funciton for a more fine grained handling of presses.
Protected Attributes inherited from bugui::base_painter
color current_color

Detailed Description

Adds 2D information on top of a base_painter. The painter is used in user defined paint funcions to draw on the device. Meant to traverse the entire widget tree, each widget temporarly applies a coordinate offset to the painter, reflecting their relative position in the scene.

Member Function Documentation

◆ bound_at_offset()

bool bugui::painter::bound_at_offset ( rectangle * bounds)

Set the size of the underlying rectangle. after aplying the coordinate offset to the bounds argument, the size is calculated to lie within the phisical dimentions of the device's grid, even .

Returns
true if the resulting rectangle has a positive with and height, false otherwise.

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