28 #ifndef _NANO_CANVAS_H_ 29 #define _NANO_CANVAS_H_ 267 __attribute__((noinline));
272 void clear() __attribute__((noinline));
278 size_t write(uint8_t c);
298 __attribute__((noinline));
420 void setFreeFont(
const uint8_t *progmemFont,
const uint8_t *secondaryFont =
nullptr)
422 (void)(secondaryFont);
484 uint8_t m_buffer[W * H * BPP / 8]{};
506 using NanoCanvasBase::NanoCanvasBase;
517 using NanoCanvasBase::NanoCanvasBase;
528 using NanoCanvasBase::NanoCanvasBase;
544 using NanoCanvasBase::NanoCanvasBase;
560 using NanoCanvasBase::NanoCanvasBase;
576 using NanoCanvasBase::NanoCanvasBase;
const NanoPoint offsetEnd() const
Returns right-bottom point of the canvas in offset terms.
uint8_t lcduint_t
internal int type, used by the library.
struct _NanoPoint NanoPoint
Describes point.
void drawLine(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
Draws a line between two points using Bresenham's algorithm.
NanoCanvas1_8 represents objects for drawing in memory buffer NanoCanvas1_8 represents each pixel as ...
void drawRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
Draws rectangle outline.
NanoFont * m_font
current set font to use with NanoCanvas
NanoRect structure describes rectangle area.
size_t write(uint8_t c)
Writes single character to canvas.
void drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2)
Draws vertical line from (x1,y1) to (x1,y2).
NanoCanvasOps< BPP > T
Base type for canvas class specific operations.
lcdint_t m_cursorX
current X cursor position for text output
int8_t lcdint_t
internal int type, used by the library.
uint16_t m_bgColor
current background color
uint16_t getColor()
Returns currently set foreground color.
void drawBitmap8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap) __attribute__((noinline))
Draws 8-bit color bitmap in color buffer.
void printFixed(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style=STYLE_NORMAL) __attribute__((noinline))
Print text at specified position to canvas.
uint8_t * getData()
Return pointer to canvas pixels data.
lcdint_t y
y position in pixels
lcduint_t width()
Returns canvas width in pixels.
NanoCanvas1 represents objects for drawing in memory buffer NanoCanvas1 represents each pixel as sing...
NanoCanvasOps provides operations for drawing in memory buffer.
NanoCanvasOps(lcdint_t w, lcdint_t h, uint8_t *bytes)
Creates new canvas object.
void invertColors()
Swaps foreground and background colors.
void clear() __attribute__((noinline))
Clears canvas.
void putPixel(lcdint_t x, lcdint_t y)
Draws pixel on specified position.
NanoFont class implements work with fonts provided by the library: loading fonts, providing their par...
void fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
Fills a rectangular area with the current color.
lcduint_t height()
Returns canvas height in pixels.
void setSpacing(uint8_t spacing)
Sets spacing in pixels between 2 nearest characters.
static const uint8_t BITS_PER_PIXEL
number of bits per single pixel in buffer
Basic structures of canvas gfx library.
Template for user-defined canvas object.
Base class for all NanoCanvas childs.
void setFixedFont(const uint8_t *progmemFont)
Sets new font to use with print functions.
void setColor(uint16_t color)
Sets color for monochrome operations.
NanoCanvasOps()
Creates new empty canvas object.
uint8_t * m_buf
Canvas data.
void drawBitmap1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap) __attribute__((noinline))
Draws monochrome bitmap in color buffer using color, specified via setColor() method Draws monochrome...
NanoCanvas1_16 represents objects for drawing in memory buffer NanoCanvas1_16 represents each pixel a...
lcdint_t m_cursorY
current Y cursor position for text output
void drawHLine(lcdint_t x1, lcdint_t y1, lcdint_t x2)
Draws horizontal line from (x1,y1) to (x2,y1).
void printFixedPgm(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style=STYLE_NORMAL)
Print text at specified position to canvas.
NanoFont & getFont()
Returns reference to NanoFont object currently in use.
void setOffset(lcdint_t ox, lcdint_t oy)
Sets offset.
EFontStyle m_fontStyle
currently active font style
void setMode(uint8_t modeFlags)
Sets canvas drawing mode Sets canvas drawing mode.
void setFont(NanoFont &font)
Sets new font to use with print functions.
NanoCanvas8 represents objects for drawing in memory buffer NanoCanvas8 represents each pixel as sing...
void begin(lcdint_t w, lcdint_t h, uint8_t *bytes)
Initializes canvas object.
void loadFixedFont(const uint8_t *progmemFont)
Function allows to set another fixed font for the library.
uint16_t m_color
current color
EFontStyle
Supported font styles.
NanoPoint offset
Fixed offset for all operation of NanoCanvasOps in pixels.
void rotateCW(T &out)
Rotates the canvas clock-wise.
lcdint_t x
x position in pixels
NanoCanvas4 represents objects for drawing in memory buffer NanoCanvas4 represents each pixel as 4-bi...
const NanoRect rect() const
Returns rectangle area, covered by canvas in offset terms.
void setFreeFont(const uint8_t *progmemFont, const uint8_t *secondaryFont=nullptr)
Sets new font to use with print functions.
void drawBitmap16(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap) __attribute__((noinline))
Draws 16-bit color bitmap in color buffer.
lcduint_t m_w
width of NanoCanvas area in pixels
NanoCanvas16 represents objects for drawing in memory buffer NanoCanvas16 represents each pixel as 2-...
void loadFreeFont(const uint8_t *progmemFont)
Function allows to set another free font for the library.
void setFontSpacing(uint8_t spacing)
Sets font spacing for currently active font.
uint8_t printChar(uint8_t c)
Draws single character to canvas.
lcduint_t m_h
height of NanoCanvas area in pixels
void drawCircle(lcdint_t x, lcdint_t y, lcdint_t r, uint8_t options=0x0F) __attribute__((noinline))
Draws circle outline.
void setBackground(uint16_t color)
Sets background color.
uint8_t m_textMode
Flags for current NanoCanvas mode.