29 #ifndef _NANO_CANVAS_H_ 30 #define _NANO_CANVAS_H_ 38 CANVAS_TEXT_WRAP = 0x01,
39 CANVAS_MODE_TRANSPARENT = 0x02,
40 CANVAS_TEXT_WRAP_LOCAL = 0x04,
57 void setPoint(lcdint_t px, lcdint_t py) { x=px; y=py; };
109 return {
static_cast<lcdint_t
>(x - p.
x),
110 static_cast<lcdint_t>(y - p.
y) };
119 return {
static_cast<lcdint_t
>(x + p.
x),
120 static_cast<lcdint_t>(y + p.
y) };
129 return {
static_cast<lcdint_t
>(x >> bits),
130 static_cast<lcdint_t>(y >> bits) };
139 return {
static_cast<lcdint_t
>(x << bits),
140 static_cast<lcdint_t>(y << bits) };
161 void move(lcdint_t dx, lcdint_t dy)
163 p1.
x += dx; p2.
x += dx;
164 p1.
y += dy; p2.
y += dy;
173 p1.
x += dx; p2.
x += dx;
193 void setRect(lcdint_t l, lcdint_t t, lcdint_t r, lcdint_t b)
235 return { {
static_cast<lcdint_t
>(p1.
x - p.
x), static_cast<lcdint_t>(p1.
y - p.
y) },
236 {
static_cast<lcdint_t
>(p2.
x - p.
x), static_cast<lcdint_t>(p2.
y - p.
y) } };
245 return { {
static_cast<lcdint_t
>(p1.
x + p.
x), static_cast<lcdint_t>(p1.
y + p.
y) },
246 {
static_cast<lcdint_t
>(p2.
x + p.
x), static_cast<lcdint_t>(p2.
y + p.
y) } };
268 template <u
int8_t BPP>
273 static const uint8_t BITS_PER_PIXEL = BPP;
312 void begin(lcdint_t w, lcdint_t h, uint8_t *bytes);
319 void setOffset(lcdint_t ox, lcdint_t oy) { offset.
x = ox; offset.
y = oy; };
327 void putPixel(lcdint_t
x, lcdint_t
y);
343 void drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2);
352 void drawHLine(lcdint_t x1, lcdint_t y1, lcdint_t x2);
362 void drawLine(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
369 void drawLine(
const NanoRect &rect);
379 void drawRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
386 void drawRect(
const NanoRect &rect);
396 void fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2);
403 void fillRect(
const NanoRect &rect);
419 void drawBitmap1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h,
const uint8_t *bitmap);
430 void drawBitmap8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h,
const uint8_t *bitmap);
441 size_t write(uint8_t c)
override;
447 void printChar(uint8_t c);
458 void printFixed(lcdint_t xpos, lcdint_t y,
const char *ch);
469 void printFixedPgm(lcdint_t xpos, lcdint_t y,
const char *ch);
476 void setMode(uint8_t modeFlags) { m_textMode = modeFlags; };
482 void setColor(uint16_t color) { m_color = color; };
498 template <u
int8_t BPP>
509 virtual void blt(lcdint_t
x, lcdint_t
y) = 0;
514 virtual void blt() = 0;
537 using NanoCanvasBase::NanoCanvasBase;
544 void blt(lcdint_t
x, lcdint_t
y)
override;
560 using NanoCanvasBase::NanoCanvasBase;
567 void blt(lcdint_t
x, lcdint_t
y)
override;
589 using NanoCanvasBase::NanoCanvasBase;
596 void blt(lcdint_t
x, lcdint_t
y)
override;
618 using NanoCanvasBase::NanoCanvasBase;
625 void blt(lcdint_t
x, lcdint_t
y)
override;
bool below(const NanoPoint &p) const
bool collisionX(lcdint_t x) const
_NanoPoint operator-(const _NanoPoint &p)
struct _NanoPoint NanoPoint
_NanoRect operator-(const _NanoPoint &p)
_NanoRect operator+(const _NanoPoint &p)
void setPoint(lcdint_t px, lcdint_t py)
_NanoPoint operator+(const _NanoPoint &p)
_NanoPoint operator>>(const uint8_t bits)
lcdint_t m_cursorX
current X cursor position for text output
_NanoPoint & operator<<=(const uint8_t bits)
lcduint_t m_p
number of bits, used by width value: 3 equals to 8 pixels width
_NanoPoint & operator>>=(const uint8_t bits)
NanoCanvasOps(lcdint_t w, lcdint_t h, uint8_t *bytes)
bool collisionY(lcdint_t y) const
void setColor(uint16_t color)
_NanoPoint & operator+=(const _NanoPoint &p)
uint8_t * m_buf
Canvas data.
lcdint_t m_cursorY
current Y cursor position for text output
struct _NanoRect NanoRect
void setRect(lcdint_t l, lcdint_t t, lcdint_t r, lcdint_t b)
_NanoRect & operator+=(const _NanoPoint &p)
_NanoPoint & operator-=(const _NanoPoint &p)
void setOffset(lcdint_t ox, lcdint_t oy)
void move(lcdint_t dx, lcdint_t dy)
bool collision(const NanoPoint &p) const
void setMode(uint8_t modeFlags)
Sets canvas drawing mode Sets canvas drawing mode. The set flags define transparency of output images...
bool above(const NanoPoint &p) const
uint16_t m_color
current color for monochrome operations
_NanoPoint operator<<(const uint8_t bits)
lcduint_t m_h
height of NanoCanvas area in pixels
uint8_t m_textMode
Flags for current NanoCanvas mode.