From 33a4bdf66b71321fdfd42df961ac6d912e1e3091 Mon Sep 17 00:00:00 2001 From: subsonicpulse Date: Tue, 15 Apr 2014 21:05:51 +0200 Subject: [PATCH 1/4] Add XBitmap (*.xbm) support add XBitmap(*.xbm) support, to directly use exported GIMP xbm files. (Rename the file to *.c and open in editor.) --- Adafruit_GFX.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Adafruit_GFX.h b/Adafruit_GFX.h index 7d049e7d..4669ba9d 100644 --- a/Adafruit_GFX.h +++ b/Adafruit_GFX.h @@ -48,6 +48,8 @@ class Adafruit_GFX : public Print { int16_t radius, uint16_t color), drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color), + drawXBitmap(int16_t x, int16_t y, const uint8_t *bitmap, + int16_t w, int16_t h, uint16_t color), drawChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size), setCursor(int16_t x, int16_t y), From 4dc78f04329816a19537d17ad2dfacc6c3b4b2b8 Mon Sep 17 00:00:00 2001 From: subsonicpulse Date: Tue, 15 Apr 2014 21:09:53 +0200 Subject: [PATCH 2/4] Add XBitmap (*.xbm) support add XBitmap(*.xbm) support, to directly use exported GIMP xbm files. (Rename the file to *.c and open in editor.) --- Adafruit_GFX.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Adafruit_GFX.cpp b/Adafruit_GFX.cpp index f043a4db..0fb42b08 100644 --- a/Adafruit_GFX.cpp +++ b/Adafruit_GFX.cpp @@ -363,6 +363,24 @@ void Adafruit_GFX::drawBitmap(int16_t x, int16_t y, } } +//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) { + + int16_t i, j, byteWidth = (w + 7) / 8; + + for(j=0; j= 100 size_t Adafruit_GFX::write(uint8_t c) { #else From fe2637e27ece94dfce20bed125873b60eb44a6ca Mon Sep 17 00:00:00 2001 From: subsonicpulse Date: Tue, 15 Apr 2014 21:25:25 +0200 Subject: [PATCH 3/4] XBitMap support (*.xbm) description Add description of XBitMap support extension. --- README.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.txt b/README.txt index 39ccbec7..4679b61b 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,15 @@ +Current additions: + +- XBitMap support (*.xbm) + Use directly exported xbm files from GIMP with bitmap data, + (fits perfectly with SSD1306 library from Adafruit) + Usage: Export bitmap with GIMP as *.xbm file, + Rename the *.xbm to *.c, + Open file in editor, + Use C array directly in your sources. + +---------------------------------- + This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions). Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! From d9f6c6726b152280adf535bcd8c370ecf35abd28 Mon Sep 17 00:00:00 2001 From: subsonicpulse Date: Tue, 15 Apr 2014 21:28:45 +0200 Subject: [PATCH 4/4] XBitMap support (*.xbm) refine description --- README.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index 4679b61b..b2c3f935 100644 --- a/README.txt +++ b/README.txt @@ -1,8 +1,9 @@ Current additions: - XBitMap support (*.xbm) - Use directly exported xbm files from GIMP with bitmap data, + Use exported xbm files from GIMP with bitmap data directly in your sources. (fits perfectly with SSD1306 library from Adafruit) + New function: Adafruit_GFX::drawXBitmap() Usage: Export bitmap with GIMP as *.xbm file, Rename the *.xbm to *.c, Open file in editor,