|
@@ -88,6 +88,8 @@ void setup()
|
|
|
|
|
|
|
|
drawBitmaps_200x200();
|
|
drawBitmaps_200x200();
|
|
|
drawBitmaps_other();
|
|
drawBitmaps_other();
|
|
|
|
|
+
|
|
|
|
|
+ //drawBitmaps_test();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void loop(void)
|
|
void loop(void)
|
|
@@ -148,6 +150,16 @@ void drawBitmaps_other()
|
|
|
delay(2000);
|
|
delay(2000);
|
|
|
drawBitmapFromSD("woof.bmp", w2 - 120, h2 - 160);
|
|
drawBitmapFromSD("woof.bmp", w2 - 120, h2 - 160);
|
|
|
delay(2000);
|
|
delay(2000);
|
|
|
|
|
+ drawBitmapFromSD("bitmap640x384_1.bmp", 0, 0);
|
|
|
|
|
+ delay(2000);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void drawBitmaps_test()
|
|
|
|
|
+{
|
|
|
|
|
+ int16_t w2 = display.WIDTH / 2;
|
|
|
|
|
+ int16_t h2 = display.HEIGHT / 2;
|
|
|
|
|
+ drawBitmapFromSD("betty_4.bmp", w2 - 102, h2 - 126);
|
|
|
|
|
+ delay(2000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static const uint16_t input_buffer_pixels = 20; // may affect performance
|
|
static const uint16_t input_buffer_pixels = 20; // may affect performance
|
|
@@ -220,7 +232,7 @@ void drawBitmapFromSD(const char *filename, int16_t x, int16_t y, bool with_colo
|
|
|
uint16_t h = height;
|
|
uint16_t h = height;
|
|
|
if ((x + w - 1) >= int16_t(display.WIDTH)) w = int16_t(display.WIDTH) - x;
|
|
if ((x + w - 1) >= int16_t(display.WIDTH)) w = int16_t(display.WIDTH) - x;
|
|
|
if ((y + h - 1) >= int16_t(display.HEIGHT)) h = int16_t(display.HEIGHT) - y;
|
|
if ((y + h - 1) >= int16_t(display.HEIGHT)) h = int16_t(display.HEIGHT) - y;
|
|
|
- if (w < max_row_width) // handle with direct drawing
|
|
|
|
|
|
|
+ if (w <= max_row_width) // handle with direct drawing
|
|
|
{
|
|
{
|
|
|
valid = true;
|
|
valid = true;
|
|
|
uint8_t bitmask = 0xFF;
|
|
uint8_t bitmask = 0xFF;
|
|
@@ -255,8 +267,8 @@ void drawBitmapFromSD(const char *filename, int16_t x, int16_t y, bool with_colo
|
|
|
uint32_t in_bytes = 0;
|
|
uint32_t in_bytes = 0;
|
|
|
uint8_t in_byte = 0; // for depth <= 8
|
|
uint8_t in_byte = 0; // for depth <= 8
|
|
|
uint8_t in_bits = 0; // for depth <= 8
|
|
uint8_t in_bits = 0; // for depth <= 8
|
|
|
- uint8_t out_byte = 0;
|
|
|
|
|
- uint8_t out_color_byte = 0;
|
|
|
|
|
|
|
+ uint8_t out_byte = 0xFF; // white (for w%8!=0 boarder)
|
|
|
|
|
+ uint8_t out_color_byte = 0xFF; // white (for w%8!=0 boarder)
|
|
|
uint32_t out_idx = 0;
|
|
uint32_t out_idx = 0;
|
|
|
file.seekSet(rowPosition);
|
|
file.seekSet(rowPosition);
|
|
|
for (uint16_t col = 0; col < w; col++) // for each pixel
|
|
for (uint16_t col = 0; col < w; col++) // for each pixel
|
|
@@ -316,23 +328,26 @@ void drawBitmapFromSD(const char *filename, int16_t x, int16_t y, bool with_colo
|
|
|
}
|
|
}
|
|
|
if (whitish)
|
|
if (whitish)
|
|
|
{
|
|
{
|
|
|
- out_byte |= 0x80 >> col % 8; // not black
|
|
|
|
|
- out_color_byte |= 0x80 >> col % 8; // not colored
|
|
|
|
|
|
|
+ //out_byte |= 0x80 >> col % 8; // not black
|
|
|
|
|
+ //out_color_byte |= 0x80 >> col % 8; // not colored
|
|
|
|
|
+ // keep white
|
|
|
}
|
|
}
|
|
|
else if (colored && with_color)
|
|
else if (colored && with_color)
|
|
|
{
|
|
{
|
|
|
- out_byte |= 0x80 >> col % 8; // not black
|
|
|
|
|
|
|
+ //out_byte |= 0x80 >> col % 8; // not black
|
|
|
|
|
+ out_color_byte &= ~(0x80 >> col % 8); // colored
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- out_color_byte |= 0x80 >> col % 8; // not colored
|
|
|
|
|
|
|
+ //out_color_byte |= 0x80 >> col % 8; // not colored
|
|
|
|
|
+ out_byte &= ~(0x80 >> col % 8); // black
|
|
|
}
|
|
}
|
|
|
- if (7 == col % 8)
|
|
|
|
|
|
|
+ if ((7 == col % 8) || (col == w - 1)) // write that last byte! (for w%8!=0 boarder)
|
|
|
{
|
|
{
|
|
|
output_row_color_buffer[out_idx] = out_color_byte;
|
|
output_row_color_buffer[out_idx] = out_color_byte;
|
|
|
output_row_mono_buffer[out_idx++] = out_byte;
|
|
output_row_mono_buffer[out_idx++] = out_byte;
|
|
|
- out_byte = 0;
|
|
|
|
|
- out_color_byte = 0;
|
|
|
|
|
|
|
+ out_byte = 0xFF; // white (for w%8!=0 boarder)
|
|
|
|
|
+ out_color_byte = 0xFF; // white (for w%8!=0 boarder)
|
|
|
}
|
|
}
|
|
|
} // end pixel
|
|
} // end pixel
|
|
|
uint16_t yrow = y + (flip ? h - row - 1 : row);
|
|
uint16_t yrow = y + (flip ? h - row - 1 : row);
|