@@ -388,6 +388,34 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
388388 }
389389}
390390
391+ void Adafruit_GFX::drawBitmap (int16_t x, int16_t y,
392+ uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) {
393+
394+ int16_t i, j, byteWidth = (w + 7 ) / 8 ;
395+
396+ for (j=0 ; j<h; j++) {
397+ for (i=0 ; i<w; i++ ) {
398+ if (bitRead (bitmap[j], 7 -i)) drawPixel (x+i, y+j, color);
399+ }
400+ }
401+ }
402+
403+ // Draw a 1-bit color bitmap at the specified x, y position from the
404+ // provided bitmap buffer (NOT PROGMEM memory nor a const) using color
405+ // as the foreground color and bg as the background color.
406+ void Adafruit_GFX::drawBitmap (int16_t x, int16_t y,
407+ uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg) {
408+
409+ int16_t i, j, byteWidth = (w + 7 ) / 8 ;
410+
411+ for (j=0 ; j<h; j++) {
412+ for (i=0 ; i<w; i++ ) {
413+ if (bitRead (bitmap[j], 7 -i)) drawPixel (x+i, y+j, color);
414+ else drawPixel (x+i, y+j, bg);
415+ }
416+ }
417+ }
418+
391419// Draw XBitMap Files (*.xbm), exported from GIMP,
392420// Usage: Export from GIMP to *.xbm, rename *.xbm to *.c and open in editor.
393421// C Array can be directly used with this function
0 commit comments