The sketch in #0 would have been fine in 2016.
However Adafruit has made massive changes to its libraries in the intervening years.
setAddrWindow(x, y, w, h) has replaced setAddrWindow(x, y, x1, y1)
several methods require a specific startWrite() and endWrite() wrapper
spiwrite() is now called spiWrite()
the Library Manager encourages you to install/update several unrelated classes.
this guarantees that Adafruit_GFX will not compile on several targets
nothing to do with GFX. all to do with the "unrelated classes"
I don't have an SPI HX8357. I can only test on Adafruit_ILI9341
Do you really want a 16-bit BMP file ?
David.
uint16_t readPixA(int x, int y) { // get pixel color code in rgb565 format
tft.startWrite(); //needed for low-level methods. CS active
tft.setAddrWindow(x, y, 1, 1);
tft.writeCommand(0x2E); // memory read command. sets DC
uint8_t r, g, b;
r = tft.spiRead(); // discard dummy read
r = tft.spiRead();
g = tft.spiRead();
b = tft.spiRead();
tft.endWrite(); //needed for low-level methods. CS idle
return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3);
}