11 #ifndef TCMENU_DRAWING_PRIMITIVES_H
12 #define TCMENU_DRAWING_PRIMITIVES_H
14 #include <PlatformDetermination.h>
21 #define DRAW_NO_MASK 0xff
24 #ifdef NEED_32BIT_COLOR_T_ALPHA
31 #define RGB(r, g, b) (uint32_t)( 0xff000000UL | ((r)<<16UL) | ((g)<<8UL) | (b) )
39 #define RGB(r, g, b) (uint16_t)( (((r)>>3)<<11) | (((g)>>2)<<5) | ((b)>>3) )
47 const uint8_t fontMag;
49 MenuFontDef(
const void* data, uint8_t mag) : fontData(data), fontMag(mag) { }
62 MenuPadding(
int top_,
int right_,
int bottom_,
int left_) {
70 top = bottom = right = left = equalAll;
84 padding.right = right;
85 padding.bottom = bottom;
101 top = left = bottom = right = equalSides;
104 MenuBorder(uint8_t top_, uint8_t right_, uint8_t bottom_, uint8_t left_) {
111 bool areAllBordersEqual()
const {
112 return (top == left) && (left == right) && (right == bottom);
115 bool isBorderOff()
const {
116 return areAllBordersEqual() && top == 0;
120 #ifndef TC_COORD_DEFINED
121 #define TC_COORD_DEFINED
140 Coord& operator = (
const Coord& other) =
default;
181 const uint8_t *normalIcon;
182 const uint8_t *selectedIcon;
189 normalIcon(nullptr), selectedIcon(nullptr), palette(nullptr) {}
206 const uint8_t *selected =
nullptr)
207 : menuId(id), dimensions(size), iconType(ty), location(
STORED_IN_ROM), normalIcon(normal),
208 selectedIcon(selected), palette(nullptr) {}
219 const uint8_t *selected =
nullptr)
220 : menuId(id), dimensions(size), iconType(ty), location(
STORED_IN_ROM), normalIcon(normal),
221 selectedIcon(selected), palette(paletteEntries) {}
229 return (selected && selectedIcon !=
nullptr) ? selectedIcon : normalIcon;
254 uint16_t getKey()
const {
258 void setFromValues(
const Coord &size,
IconType ty,
const uint8_t *normal,
const uint8_t *selected =
nullptr) {
259 this->dimensions = size;
261 this->normalIcon = normal;
262 this->selectedIcon = selected;
uint32_t color_t
Definition: DrawingPrimitives.h:29
void makePadding(MenuPadding &padding, int top, int right, int bottom, int left)
Definition: DrawingPrimitives.h:82
Definition: DrawingPrimitives.h:152
const uint8_t * getIcon(bool selected) const
Definition: DrawingPrimitives.h:228
DrawableIcon(uint16_t id, const Coord &size, IconType ty, const uint8_t *normal, const uint8_t *selected=nullptr)
Definition: DrawingPrimitives.h:205
MemoryLocation
Definition: DrawingPrimitives.h:168
@ STORED_IN_RAM
Definition: DrawingPrimitives.h:172
@ STORED_IN_ROM
Definition: DrawingPrimitives.h:170
@ LOAD_FROM_STORAGE
Definition: DrawingPrimitives.h:174
Coord getDimensions() const
Definition: DrawingPrimitives.h:243
const color_t * getPalette() const
Definition: DrawingPrimitives.h:236
DrawableIcon(const DrawableIcon &other)=default
DrawableIcon(uint16_t id, const Coord &size, IconType ty, const color_t *paletteEntries, const uint8_t *normal, const uint8_t *selected=nullptr)
Definition: DrawingPrimitives.h:218
DrawableIcon()
Definition: DrawingPrimitives.h:188
IconType getIconType() const
Definition: DrawingPrimitives.h:250
IconType
Definition: DrawingPrimitives.h:154
@ ICON_NATIVE
Definition: DrawingPrimitives.h:166
@ ICON_XBITMAP
Definition: DrawingPrimitives.h:156
@ ICON_MONO
Definition: DrawingPrimitives.h:158
@ ICON_PALLETE_2BPP
Definition: DrawingPrimitives.h:161
@ ICON_PALLETE_4BPP
Definition: DrawingPrimitives.h:164
Definition: DrawingPrimitives.h:123
Coord()
Definition: DrawingPrimitives.h:125
Coord(int x, int y)
Definition: DrawingPrimitives.h:134