mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-10-03 18:18:46 -04:00
Implementation of drawBitmap with background overload.
This commit is contained in:
parent
01273c2ad2
commit
e5f3bc9440
@ -345,6 +345,23 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_GFX::drawBitmap(int16_t x, int16_t y,
|
||||
const uint8_t *bitmap, int16_t w, int16_t h,
|
||||
uint16_t color, uint16_t bg) {
|
||||
|
||||
int16_t i, j, byteWidth = (w + 7) / 8;
|
||||
|
||||
for(j=0; j<h; j++) {
|
||||
for(i=0; i<w; i++ ) {
|
||||
if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
|
||||
drawPixel(x+i, y+j, color);
|
||||
}
|
||||
else {
|
||||
drawPixel(x+i, y+j, bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ARDUINO >= 100
|
||||
size_t Adafruit_GFX::write(uint8_t c) {
|
||||
|
Loading…
Reference in New Issue
Block a user