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,
110 static_cast<lcdint_t>(y - p.
y) };
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) };
163 p1.
x += dx; p2.
x += dx;
164 p1.
y += dy; p2.
y += dy;
173 p1.
x += dx; p2.
x += dx;
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;
369 void drawLine(
const NanoRect &rect);
386 void drawRect(
const NanoRect &rect);
403 void fillRect(
const NanoRect &rect);
441 size_t write(uint8_t c)
override;
447 void printChar(uint8_t c);
476 void setMode(uint8_t modeFlags) { m_textMode = modeFlags; };
482 void setColor(uint16_t color) { m_color = color; };
498 template <u
int8_t BPP>
514 virtual void blt() = 0;
531 using NanoCanvasBase::NanoCanvasBase;
566 using NanoCanvasBase::NanoCanvasBase;
595 using NanoCanvasBase::NanoCanvasBase;
_NanoPoint operator-(const _NanoPoint &p)
struct _NanoPoint NanoPoint
_NanoRect operator-(const _NanoPoint &p)
_NanoRect operator+(const _NanoPoint &p)
bool collisionY(lcdint_t y) const
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)
bool above(const NanoPoint &p) const
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 collision(const NanoPoint &p) 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)
bool below(const NanoPoint &p) const
void setOffset(lcdint_t ox, lcdint_t oy)
bool collisionX(lcdint_t x) const
void move(lcdint_t dx, lcdint_t dy)
void setMode(uint8_t modeFlags)
Sets canvas drawing mode Sets canvas drawing mode. The set flags define transparency of output images...
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.