I'd like to print a bitmap on my TFT.
I setup my screen with this library: http://forum.arduino.cc/index.php?topic=292777.0
It is like the Adafruit_GFX library (only a little bit changed). Everything works.
With the tool Img2Code I converted my image into a bitmap.
void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
const uint8_t *bitmap, int16_t w, int16_t h,uint16_t color)
screenshot
How to include this code and print the bitmap on the tft?
-
What is your question?Joris Groosman– Joris Groosman2015年05月18日 11:07:15 +00:00Commented May 18, 2015 at 11:07
-
how to draw a xbm (bitmap) on my tft. I don't know how to include the big bitmap array.linuscl– linuscl2015年05月18日 11:08:38 +00:00Commented May 18, 2015 at 11:08
1 Answer 1
As the function prototype you have show suggests, the data needs to be in a uint8_t array format.
void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
const uint8_t *bitmap, int16_t w, int16_t h,uint16_t color)
So your array data would look like:
const uint8_t myBitmap[] = { 0xff, 0xff, 0xc0, 0x00, 0xc0, 0xff,
0xc0, 0xc0, 0xff, 0xff, 0xde, 0xad, 0xbe, 0xef,
.... etc ....
0xff, 0xff, 0xff, 0xff, 0xff
};
You then call the function with the needed parameters:
tft.drawXBitmap(10, 20, myBitmap, 100, 80, 0xFFFF);
That is assuming you want to place it at (top left corner) 10,20 and the bitmap is 100x80 pixels in size. It will draw it in white (0xFFFF).