mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-10-03 18:18:46 -04:00
Allow for drawing bitmaps in RAM (not in progmem).
This commit is contained in:
parent
b11992a9fd
commit
aad430de1b
@ -403,15 +403,22 @@ void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw colored bitmap (each pixel is a uint16_t, with colors defined by
|
||||||
// Draw colored bitmap (each pixel is a uint16_t, with colors defined by
|
// Draw colored bitmap (each pixel is a uint16_t, with colors defined by
|
||||||
// the drawpixel method of your graphical backend.
|
// the drawpixel method of your graphical backend.
|
||||||
|
// progmem defaults to true for bitmaps defined as static const uint16_t PROGMEM
|
||||||
|
// but you can set it to false to send a bitmap array in RAM.
|
||||||
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
|
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
|
||||||
const uint16_t *bitmap, int16_t w, int16_t h) {
|
const uint16_t *bitmap, int16_t w, int16_t h, bool progmem) {
|
||||||
int16_t i, j;
|
int16_t i, j;
|
||||||
|
|
||||||
for(j=0; j<h; j++) {
|
for(j=0; j<h; j++) {
|
||||||
for(i=0; i<w; i++ ) {
|
for(i=0; i<w; i++ ) {
|
||||||
drawPixel(x+i, y+j, pgm_read_word(bitmap + j * w + i));
|
if (progmem) {
|
||||||
|
drawPixel(x+i, y+j, pgm_read_word(bitmap + j * w + i));
|
||||||
|
} else {
|
||||||
|
drawPixel(x+i, y+j, (uint16_t) *(bitmap + j * w + i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class Adafruit_GFX : public Print {
|
|||||||
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
|
drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap,
|
||||||
int16_t w, int16_t h, uint16_t color),
|
int16_t w, int16_t h, uint16_t color),
|
||||||
drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap,
|
drawRGBBitmap(int16_t x, int16_t y, const uint16_t *bitmap,
|
||||||
int16_t w, int16_t h),
|
int16_t w, int16_t h,bool progmem=true),
|
||||||
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color,
|
||||||
uint16_t bg, uint8_t size),
|
uint16_t bg, uint8_t size),
|
||||||
setCursor(int16_t x, int16_t y),
|
setCursor(int16_t x, int16_t y),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user