Added support for multicolor pixmaps in drawRGBBitmap.

This commit is contained in:
Marc MERLIN 2015-01-04 13:55:42 -08:00
parent a9e5bc4707
commit 2261b1e46c
2 changed files with 16 additions and 0 deletions

View File

@ -403,6 +403,20 @@ void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
}
}
// Draw colored bitmap (each pixel is a uint16_t, with colors defined by
// the drawpixel method of your graphical backend.
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
const uint16_t *bitmap, int16_t w, int16_t h) {
int16_t i, j;
for(j=0; j<h; j++) {
for(i=0; i<w; i++ ) {
drawPixel(x+i, y+j, pgm_read_byte(bitmap + j * w + i));
}
}
}
#if ARDUINO >= 100
size_t Adafruit_GFX::write(uint8_t c) {
#else

View File

@ -52,6 +52,8 @@ class Adafruit_GFX : public Print {
int16_t w, int16_t h, uint16_t color, uint16_t bg),
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
int16_t w, int16_t h, uint16_t color),
drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap,
int16_t w, int16_t h),
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
uint16_t bg, uint8_t size),
setCursor(int16_t x, int16_t y),