You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
787 B
26 lines
787 B
#include "video.h"
|
|
|
|
namespace Video {
|
|
// Create an instance of the graphics library
|
|
ESP_8_BIT_GFX video(false /* = NTSC */, 8 /* = RGB332 color */);
|
|
// ESP_8_BIT_GFX video(true /* = NTSC */, 8 /* = RGB332 color */);
|
|
|
|
void begin() {
|
|
video.begin();
|
|
}
|
|
|
|
void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) {
|
|
int16_t i, j, byteWidth = (w + 7) / 8;
|
|
uint8_t byte;
|
|
for(j=0; j<h; j++) {
|
|
for(i=0; i<w; i++) {
|
|
if(i & 7)
|
|
byte <<= 1;
|
|
else
|
|
byte = pgm_read_byte(bitmap + j * byteWidth + i / 8);
|
|
if(byte & 0x80)
|
|
video.drawPixel(x+i, y+j, color);
|
|
}
|
|
}
|
|
}
|
|
}
|