Tc Unicode Helper
Loading...
Searching...
No Matches
tcUnicodeU8G2.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3 * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4 */
5
12#ifndef TCMENU_UNICODE_U8G2_H
13#define TCMENU_UNICODE_U8G2_H
14
15#include "tcUnicodeHelper.h"
16#include <U8g2lib.h>
17
18namespace tcgfx {
19
20#define UNICODE_U8G2_AVAILABLE
21
23 private:
24 U8G2 *u8g2;
25 Coord cursor;
26 public:
27 explicit U8g2TextPlotPipeline(U8G2 *gfx) : u8g2(gfx) {}
28
29 ~U8g2TextPlotPipeline() = default;
30
31 void drawPixel(uint16_t x, uint16_t y, uint32_t color) override {
32 u8g2->setColorIndex(color);
33 u8g2->drawPixel(x, y);
34 }
35
36 Coord getDimensions() override { return Coord(u8g2->getWidth(), u8g2->getHeight()); }
37
38 void setCursor(const Coord &where) override { cursor = where; }
39
40 Coord getCursor() override { return cursor; }
41 };
42
49 inline U8g2TextPlotPipeline* newU8G2TextPipeline(U8G2 *graphics) {
50 return new U8g2TextPlotPipeline(graphics);
51 }
52}
53#endif //TCMENU_UNICODE_U8G2_H
Definition tcUnicodeHelper.h:74
Definition tcUnicodeU8G2.h:22
Coord getCursor() override
Definition tcUnicodeU8G2.h:40
Coord getDimensions() override
Definition tcUnicodeU8G2.h:36
void setCursor(const Coord &where) override
Definition tcUnicodeU8G2.h:38
void drawPixel(uint16_t x, uint16_t y, uint32_t color) override
Definition tcUnicodeU8G2.h:31
Definition tcUnicodeHelper.h:40
contains a Unicode handler that can process UTF-8 data and print it onto most display types.
U8g2TextPlotPipeline * newU8G2TextPipeline(U8G2 *graphics)
Definition tcUnicodeU8G2.h:49