MCPcopy Create free account
hub / github.com/cbm80amiga/Arduino_ST7789_Fast / drawImageF

Method drawImageF

Arduino_ST7789_Fast.cpp:511–534  ·  view source on GitHub ↗

---------------------------------------------------------- draws image from flash (PROGMEM)

Source from the content-addressed store, hash-verified

509// ----------------------------------------------------------
510// draws image from flash (PROGMEM)
511void Arduino_ST7789::drawImageF(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *img16)
512{
513 if(x>=_width || y>=_height || w<=0 || h<=0) return;
514 setAddrWindow(x, y, x+w-1, y+h-1);
515
516 uint32_t num = (uint32_t)w*h;
517 uint16_t num16 = num>>3;
518 uint8_t *img = (uint8_t *)img16;
519 while(num16--) {
520 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
521 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
522 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
523 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
524 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
525 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
526 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
527 writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2;
528 }
529 uint8_t num8 = num & 0x7;
530 while(num8--) { writeSPI(pgm_read_byte(img+1)); writeSPI(pgm_read_byte(img+0)); img+=2; }
531
532 CS_IDLE;
533 SPI_END;
534}
535
536// ----------------------------------------------------------
537// Pass 8-bit (each) R,G,B, get back 16-bit packed color

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected