11 #ifndef TCLIBRARYDEV_DEVICEDRAWABLEHELPER_H
12 #define TCLIBRARYDEV_DEVICEDRAWABLEHELPER_H
14 #include <PlatformDetermination.h>
15 #include <tcUnicodeHelper.h>
16 #include "GfxMenuConfig.h"
17 #include "DeviceDrawable.h"
29 NativeFontDesc(
const void *ptr, uint8_t mag) : ptr(ptr), mag(mag) {}
33 uint8_t getMag()
const {
return mag; }
34 const void* getPtr()
const {
return ptr; }
42 ADAFRUIT_FONT, TCUNICODE_FONT, NATIVE_FONT, NO_FONT_SEL
51 const GFXfont *adaFont;
52 const UnicodeFont *uniFont;
83 mode = TCUNICODE_FONT;
92 nativeFont = nativeFontDesc;
95 bool isTcUnicode() {
return mode == TCUNICODE_FONT || mode == ADAFRUIT_FONT; }
97 void setFontTcUnicode(UnicodeFontHandler* handler) {
98 if(mode == ADAFRUIT_FONT) {
99 handler->setFont(adaFont);
100 }
else if(mode == TCUNICODE_FONT){
101 handler->setFont(uniFont);
105 const NativeFontDesc& getNativeDesc()
const {
122 bool isSubDevice =
false;
144 void reConfigure(
color_t *palette, uint8_t paletteSize,
const Coord &startPosition,
const Coord &size);
160 return isSubDevice ?
Coord(source.x - startPos.x, source.y - startPos.y) : source;
180 drawable = rootDrawable;
DeviceFontMode
Definition: DeviceDrawableHelper.h:41
uint32_t color_t
Definition: DrawingPrimitives.h:29
Definition: DeviceDrawableHelper.h:116
DeviceDrawable * getDrawable()
Definition: DeviceDrawableHelper.h:151
void endDraw()
Definition: DeviceDrawableHelper.h:177
Coord offsetLocation(const Coord &source) const
Definition: DeviceDrawableHelper.h:159
Coord textExtents(const char *text, int *bl)
Definition: DeviceDrawableHelper.cpp:37
void setFont(const DeviceFontDrawingMode &font)
Definition: DeviceDrawableHelper.h:188
void setFontFromParameters(const void *font, uint8_t mag)
Definition: DeviceDrawableHelper.cpp:78
void drawText(const Coord &where, color_t color, const char *text)
Definition: DeviceDrawableHelper.cpp:52
DeviceDrawableHelper(DeviceDrawable *root, color_t *palette, uint8_t paletteSize, const Coord &startPosition, const Coord &size)
Definition: DeviceDrawableHelper.cpp:6
Definition: DeviceDrawable.h:34
void endDraw(bool needsDrawing=true)
Definition: DeviceDrawable.h:194
Definition: DeviceDrawableHelper.h:48
DeviceFontDrawingMode(const NativeFontDesc &nativeFontDesc)
Definition: DeviceDrawableHelper.h:90
DeviceFontDrawingMode(const GFXfont *adaTc)
Definition: DeviceDrawableHelper.h:73
DeviceFontDrawingMode(const UnicodeFont *adaTc)
Definition: DeviceDrawableHelper.h:82
DeviceFontDrawingMode()
Definition: DeviceDrawableHelper.h:61
Definition: DeviceDrawableHelper.h:23
Definition: DrawingPrimitives.h:123