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

3 years ago
3 years ago
  1. #include "video.h"
  2. namespace Video {
  3. // Create an instance of the graphics library
  4. ESP_8_BIT_GFX video(false /* = NTSC */, 8 /* = RGB332 color */);
  5. // ESP_8_BIT_GFX video(true /* = NTSC */, 8 /* = RGB332 color */);
  6. void begin() {
  7. video.begin();
  8. }
  9. void drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color) {
  10. int16_t i, j, byteWidth = (w + 7) / 8;
  11. uint8_t byte;
  12. for(j=0; j<h; j++) {
  13. for(i=0; i<w; i++) {
  14. if(i & 7)
  15. byte <<= 1;
  16. else
  17. byte = pgm_read_byte(bitmap + j * byteWidth + i / 8);
  18. if(byte & 0x80)
  19. video.drawPixel(x+i, y+j, color);
  20. }
  21. }
  22. }
  23. }