-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add XBitmap support (direct usage GIMP *.xbm files) #31
Conversation
add XBitmap(*.xbm) support, to directly use exported GIMP xbm files. (Rename the file to *.c and open in editor.)
add XBitmap(*.xbm) support, to directly use exported GIMP xbm files. (Rename the file to *.c and open in editor.)
Add description of XBitMap support extension.
refine description
Very nice fix. Why it is not already merged to the master branch? |
Thanks for submitting the change and apologies it took a little while to be reviewed. Looks like a great change--thanks for adding some comments on the usage, etc. I tested it out and it works really well. Just merged in the change, thanks! |
Just as a heads up, to use the "drawXBitmap" function, I also had to redefine the array from "static unsigned char" to "static const uint8_t PROGMEM" in my image file. If I just used the original file, then garbage would appear on my 32x32 gird. I think the array has to be defined as "PROGMEM" because the "drawXBitmap" function uses the "pgm_read_byte" function, which reads a byte from program memory. I also had to include the line "#include <avr/pgmspace.h>". After that, everything worked fine for me. |
Oh yep, the function does assume the data is in flash memory by using the PROGMEM attribute. Thanks for digging in and commenting on what you found so other folks can learn from it too! |
Hello griffdrummer, Sunday, November 23, 2014, 10:58:55 PM, you wrote:
Ideally it would be const static unsigned uint8_t PROGMEM so that on Best regards, |
Hi, // My bitmap exported by GIMP ".xbm" // code If I use the drabitmap with the image2cpp converter "http://javl.github.io/image2cpp/" Can it be a problem with the function "pgm_read_byte()" ?? |
Can you paste the xbm file content? |
Hi, I'm trying to display a grayscale bitmap using drawXBitmap, and I have also tried drawGrayscaleBitmap, but nothing is working. I have a 3.7-inch Waveshare screen. |
Draw XBitMap Files (*.xbm), exported from GIMP,
Usage:
Export from GIMP to *.xbm, rename *.xbm to *.c and open in editor.
C Array can be directly used with this function
void Adafruit_GFX::drawXBitmap(int16_t x, int16_t y,
const uint8_t *bitmap, int16_t w, int16_t h,
uint16_t color)