Thanks..
As I thought, you aren't creating any new File objects in the range of code where the dropped bytes appear. It's all the same object, so I don't think there's any way for it to fall out of sync.
Try adding a call to bpFile.seek() that explicitly sets the file position before reading each block of RGB bytes. It's slower and should be unnecessary, but it may need to be done.
2.8" TFT Photo drawing question
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
- ron_g
- Posts: 156
- Joined: Tue Apr 05, 2011 6:21 pm
Re: 2.8" TFT Photo drawing question
You are correct. The below code displays the BMP correctly. And paints very slowly. I will see if I can call seek() less often and still have it read correctly.
Thanks for the help.
Thanks for the help.
Code: Select all
int pos = bmpFile.position();
for (col=0; col<w; col++) { // For each pixel...
bmpFile.seek(pos); // kludge to test Bridge fix
b = bmpFile.read();
g = bmpFile.read();
r = bmpFile.read();
tft.pushColor(tft.color565(r,g,b));
pos += 3; // kludge to test Bridge fix
} // end pixel
Please be positive and constructive with your questions and comments.