40 uint8_t text_index = 0;
41 uint8_t page_offset = 0;
44 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
48 if ( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] ==
'\0') )
52 if ( y >= (
lcdint_t)(this->m_h >> 3) )
57 if ( page_offset == this->m_font->getPages() )
70 this->m_intf.endBlock();
71 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
76 unicode = this->m_font->unicode16FromUtf8(ch[j]);
80 this->m_font->getCharBitmap(unicode, &char_info);
83 if ( char_info.
height > page_offset * 8 )
85 char_info.
glyph += page_offset * char_info.
width;
86 for ( i = char_info.
width; i > 0; i-- )
89 if ( style == STYLE_NORMAL )
91 data = pgm_read_byte(&char_info.
glyph[0]);
93 else if ( style == STYLE_BOLD )
95 uint8_t temp = pgm_read_byte(&char_info.
glyph[0]);
101 uint8_t temp = pgm_read_byte(&char_info.
glyph[1]);
102 data = (temp & 0xF0) | ldata;
103 ldata = (temp & 0x0F);
105 this->m_intf.send(data ^ this->m_bgColor);
113 for ( i = 0; i < char_info.
spacing; i++ )
114 this->m_intf.send(this->m_bgColor);
116 this->m_intf.endBlock();
121 uint16_t unicode = this->m_font->unicode16FromUtf8(c);
125 this->m_font->getCharBitmap(unicode, &char_info);
126 uint8_t mode = this->m_textMode;
127 for ( uint8_t i = 0; i < (this->m_fontStyle == STYLE_BOLD ? 2 : 1); i++ )
129 this->drawBitmap1(this->m_cursorX + i, this->m_cursorY, char_info.
width, char_info.
height, char_info.
glyph);
132 this->m_textMode = mode;
135 (this->m_cursorX > ((
lcdint_t)this->m_w - (
lcdint_t)this->m_font->getHeader().width))) ||
137 (this->m_cursorX > ((
lcdint_t)this->m_w - (
lcdint_t)this->m_font->getHeader().width))) )
139 this->m_cursorY += (
lcdint_t)this->m_font->getHeader().height;
141 if ( (this->m_textMode & CANVAS_TEXT_WRAP_LOCAL) &&
142 (this->m_cursorY > ((
lcdint_t)this->m_h - (
lcdint_t)this->m_font->getHeader().height)) )
154 this->m_cursorY += (
lcdint_t)this->m_font->getHeader().height;
157 else if ( c ==
'\r' )
168 #ifndef DOXYGEN_SHOULD_SKIP_THIS 173 uint8_t text_index = 0;
174 uint8_t page_offset = 0;
177 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
183 if ( (x > this->m_w - this->m_font->getHeader().width) || (ch[j] ==
'\0') )
187 if ( y >= (this->m_h >> 3) )
192 if ( page_offset == this->m_font->getPages() )
205 this->m_intf.endBlock();
206 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
209 if ( c >= this->m_font->getHeader().ascii_offset )
211 c -= this->m_font->getHeader().ascii_offset;
214 offset = (c * this->m_font->getPages() + page_offset) * this->m_font->getHeader().
width;
215 for ( i = this->m_font->getHeader().width; i > 0; i-- )
218 if ( style == STYLE_NORMAL )
220 data = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
222 else if ( style == STYLE_BOLD )
224 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset]);
230 uint8_t temp = pgm_read_byte(&this->m_font->getPrimaryTable()[offset + 1]);
231 data = (temp & 0xF0) | ldata;
232 ldata = (temp & 0x0F);
234 this->m_intf.send(data ^ this->m_bgColor);
237 x += this->m_font->getHeader().width;
240 this->m_intf.endBlock();
248 uint8_t text_index = 0;
249 uint8_t page_offset = 0;
252 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
256 if ( (x > this->m_w - (this->m_font->getHeader().width << factor)) || (ch[j] ==
'\0') )
260 if ( y >= (this->m_h >> 3) )
265 if ( page_offset == (this->m_font->getPages() << factor) )
278 this->m_intf.endBlock();
279 this->m_intf.startBlock(xpos, y, this->m_w - xpos);
284 unicode = this->m_font->unicode16FromUtf8(ch[j]);
288 this->m_font->getCharBitmap(unicode, &char_info);
291 if ( char_info.
height > (page_offset >> factor) * 8 )
293 char_info.
glyph += (page_offset >> factor) * char_info.
width;
294 for ( i = char_info.
width; i > 0; i-- )
297 if ( style == STYLE_NORMAL )
299 data = pgm_read_byte(char_info.
glyph);
301 else if ( style == STYLE_BOLD )
303 uint8_t temp = pgm_read_byte(char_info.
glyph);
309 uint8_t temp = pgm_read_byte(char_info.
glyph + 1);
310 data = (temp & 0xF0) | ldata;
311 ldata = (temp & 0x0F);
316 uint8_t mask = ~((0xFF) << (1 << factor));
321 data >>= ((page_offset & ((1 << factor) - 1)) << (3 - factor));
322 for ( uint8_t idx = 0; idx < 1 << (3 - factor); idx++ )
324 accum |= (((data >> idx) & 0x01) ? (mask << (idx << factor)) : 0);
328 for ( uint8_t z = (1 << factor); z > 0; z-- )
330 this->m_intf.send(data ^ this->m_bgColor);
339 for ( i = 0; i < (char_info.
spacing << factor); i++ )
340 this->m_intf.send(this->m_bgColor);
347 this->m_intf.startBlock(x, y >> 3, 1);
348 this->m_intf.send((1 << (y & 0x07)) ^ this->m_bgColor);
349 this->m_intf.endBlock();
354 this->m_intf.startBlock(x1, y1 >> 3, x2 - x1 + 1);
355 for ( uint8_t x = x1; x <= x2; x++ )
357 this->m_intf.send((1 << (y1 & 0x07)) ^ (~this->m_color));
359 this->m_intf.endBlock();
364 uint8_t topPage = y1 >> 3;
365 uint8_t bottomPage = y2 >> 3;
366 uint8_t height = y2 - y1;
368 this->m_intf.startBlock(x1, topPage, 1);
369 if ( topPage == bottomPage )
371 this->m_intf.send(((0xFF >> (0x07 - height)) << (y1 & 0x07)) ^ (~this->m_color));
372 this->m_intf.endBlock();
375 this->m_intf.send((0xFF << (y1 & 0x07)) ^ (~this->m_color));
376 for ( y = (topPage + 1); y <= (bottomPage - 1); y++ )
378 this->m_intf.nextBlock();
379 this->m_intf.send(0xFF ^ (~this->m_color));
381 this->m_intf.nextBlock();
382 this->m_intf.send((0xFF >> (0x07 - (y2 & 0x07))) ^ (~this->m_color));
383 this->m_intf.endBlock();
388 uint8_t templ = this->m_color;
397 uint8_t bank1 = (y1 >> 3);
398 uint8_t bank2 = (y2 >> 3);
399 this->m_intf.startBlock(x1, bank1, x2 - x1 + 1);
400 for ( uint8_t bank = bank1; bank <= bank2; bank++ )
403 if ( bank1 == bank2 )
405 mask = (mask >> ((y1 & 7) + 7 - (y2 & 7))) << (y1 & 7);
407 else if ( bank1 == bank )
409 mask = (mask << (y1 & 7));
411 else if ( bank2 == bank )
413 mask = (mask >> (7 - (y2 & 7)));
415 for ( uint8_t x = x1; x <= x2; x++ )
419 this->m_intf.send(templ & mask);
421 this->m_intf.nextBlock();
423 this->m_intf.endBlock();
446 this->m_intf.startBlock(x, y, w);
447 for ( j = (h >> 3); j > 0; j-- )
450 for ( i = w; i > 0; i-- )
453 for ( uint8_t k = 0; k < 8; k++ )
455 data |= (((pgm_read_byte(&bitmap[k * pitch]) >> bit) & 0x01) << k);
457 this->m_intf.send(this->m_bgColor ^ data);
470 this->m_intf.nextBlock();
472 this->m_intf.endBlock();
479 uint8_t offset = y & 0x07;
480 uint8_t complexFlag = 0;
481 uint8_t mainFlag = 1;
495 bitmap += ((
lcduint_t)((-y) + 7) >> 3) * w;
506 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
515 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
517 this->m_intf.startBlock(x, y >> 3, w);
518 for ( j = 0; j < pages; j++ )
522 for ( i = w; i > 0; i-- )
526 data |= (pgm_read_byte(bitmap) << offset);
528 data |= (pgm_read_byte(bitmap - origin_width) >> (8 - offset));
534 this->m_intf.send(this->m_bgColor ^ data);
536 bitmap += origin_width - w;
537 complexFlag = offset;
538 this->m_intf.nextBlock();
540 this->m_intf.endBlock();
547 uint8_t offset = y & 0x07;
548 uint8_t complexFlag = 0;
549 uint8_t mainFlag = 1;
574 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
583 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
585 uint8_t color = this->m_color ? 0xFF : 0x00;
586 this->m_intf.startBlock(x, y >> 3, w);
587 for ( j = 0; j < pages; j++ )
591 for ( i = w; i > 0; i-- )
595 data |= ((pgm_read_byte(buf) << offset) & color);
597 data |= ((pgm_read_byte(buf - origin_width) >> (8 - offset)) & color);
599 this->m_intf.send(this->m_bgColor ^ data);
601 buf += origin_width - w;
602 complexFlag = offset;
603 this->m_intf.nextBlock();
605 this->m_intf.endBlock();
630 uint8_t offset = y & 0x07;
631 uint8_t complexFlag = 0;
632 uint8_t mainFlag = 1;
646 buffer += ((
lcduint_t)((-y) + 7) >> 3) * w;
657 max_pages = (
lcduint_t)(h + 15 - offset) >> 3;
666 pages = ((y + h - 1) >> 3) - (y >> 3) + 1;
668 this->m_intf.startBlock(x, y >> 3, w);
669 for ( j = 0; j < pages; j++ )
673 for ( i = w; i > 0; i-- )
677 data |= ((*buffer << offset) & this->m_color);
679 data |= ((*(buffer - origin_width) >> (8 - offset)) & this->m_color);
681 this->m_intf.send(this->m_bgColor ^ data);
683 buffer += origin_width - w;
684 complexFlag = offset;
685 this->m_intf.nextBlock();
687 this->m_intf.endBlock();
694 this->m_intf.startBlock(x, y >> 3, w);
695 for ( j = (h >> 3); j > 0; j-- )
697 this->m_intf.sendBuffer(buf, w);
699 this->m_intf.nextBlock();
701 this->m_intf.endBlock();
724 color ^= this->m_bgColor;
725 this->m_intf.startBlock(0, 0, 0);
726 for (
lcduint_t m = (this->m_h >> 3); m > 0; m-- )
728 for (
lcduint_t n = this->m_w; n > 0; n-- )
730 this->m_intf.send(color);
732 this->m_intf.nextBlock();
734 this->m_intf.endBlock();
void drawBitmap8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Draws 8-bit color bitmap in color buffer. Draws 8-bit color bitmap in color buffer.
void fill(uint16_t color)
void drawBitmap16(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
uint8_t height
char height in pixels
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...
void drawBuffer4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
void fillRect(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2) __attribute__((noinline))
#define SSD1306_MORE_CHARS_REQUIRED
void gfx_drawMonoBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buf)
void drawBuffer1(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
uint8_t printChar(uint8_t c)
void drawBuffer1Fast(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer)
void drawXBitmap(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
void putPixel(lcdint_t x, lcdint_t y) __attribute__((noinline))
uint8_t width
char width in pixels
void printFixedN(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style, uint8_t factor) __attribute__((noinline))
void drawBuffer8(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))
const uint8_t * glyph
char data, located in progmem.
size_t write(uint8_t c) __attribute__((noinline))
void printFixed(lcdint_t xpos, lcdint_t y, const char *ch, EFontStyle style=STYLE_NORMAL) __attribute__((noinline))
void drawBitmap4(lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
Draws 4-bit gray-color bitmap in color buffer. Draws 4-bit gray-color bitmap in color buffer...
uint8_t spacing
additional spaces after char in pixels
void drawVLine(lcdint_t x1, lcdint_t y1, lcdint_t y2)
void drawHLine(lcdint_t x1, lcdint_t y1, lcdint_t x2)
void drawBuffer16(lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *buffer) __attribute__((noinline))