KurtE
Senior Member+
Sorry, I am not sure about all of the things that are in or not in the GFX library. But I do see functions in adafruit GFX library like:
drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h);
But again this is nothing special, that is the code just does:
So it writes out one pixel at a time. So again it assumes you have the right size and it only updates that portion of the display that you specify.
Sort of like writeRect.
As for writeRect leaving stuff on screen? It all depends on how you use it. Obviously if your image that you are using is the size of the screen, you can then simply setup to have the whole image directly in an array of 16 bit values, which you go directly to the screen...
writeRect(0,0, tft.width(), tft.height, bmpColors);
Which again does something similar:
The main difference is how fast. That is the drawRGB... will output something like:
(1+2+2+1+2+2+1+2) = 13 bytes per pixel
The writeRect: will write the first part out (1+2+2+1+2+2+1) = 11 bytes for the start of rectangle and then 2 bytes for each pixel.
As for what is shown on screen like white or the like. That you need to take care either way. They only touch the portion of the screen you tell it to do.
drawRGBBitmap(int16_t x, int16_t y, const uint16_t bitmap[], int16_t w, int16_t h);
But again this is nothing special, that is the code just does:
Code:
void Adafruit_GFX::drawRGBBitmap(int16_t x, int16_t y,
const uint16_t bitmap[], int16_t w, int16_t h) {
startWrite();
for(int16_t j=0; j<h; j++, y++) {
for(int16_t i=0; i<w; i++ ) {
writePixel(x+i, y, pgm_read_word(&bitmap[j * w + i]));
}
}
endWrite();
}
Sort of like writeRect.
As for writeRect leaving stuff on screen? It all depends on how you use it. Obviously if your image that you are using is the size of the screen, you can then simply setup to have the whole image directly in an array of 16 bit values, which you go directly to the screen...
writeRect(0,0, tft.width(), tft.height, bmpColors);
Which again does something similar:
Code:
void ST7735_t3::writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors)
{
beginSPITransaction();
setAddr(x, y, x + w - 1, y + h - 1);
writecommand(ST7735_RAMWR);
for (y = h; y > 0; y--) {
for (x = w; x > 1; x--) {
writedata16(*pcolors++);
}
writedata16_last(*pcolors++);
}
endSPITransaction();
}
(1+2+2+1+2+2+1+2) = 13 bytes per pixel
The writeRect: will write the first part out (1+2+2+1+2+2+1) = 11 bytes for the start of rectangle and then 2 bytes for each pixel.
As for what is shown on screen like white or the like. That you need to take care either way. They only touch the portion of the screen you tell it to do.