Skip to content

Commit 9be7b01

Browse files
authored
Add section about bitmaps (#388)
1 parent ea2363a commit 9be7b01

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,33 @@ OLEDDisplayUiState* getUiState();
402402
int8_t update();
403403
```
404404

405+
## Creating and using XBM bitmaps
406+
407+
If you want to display your own images with this library, the best way to do this is using a bitmap.
408+
409+
There are two options to convert an image to a compatible bitmap:
410+
1. **Using Gimp.**
411+
In this case exporting the bitmap in an 1-bit XBM format is sufficient.
412+
2. **Using a converter website.**
413+
You could also use online converter services like e.g. [https://javl.github.io/image2cpp/](https://javl.github.io/image2cpp/). The uploaded image should have the same dimension as the screen (e.g. 128x64). The following output settings should be set:
414+
- Draw Mode: Horizontal - 1 bit per pixel
415+
- Swap bits in byte: swap checkbox should be checked.
416+
417+
The resulting bitmap can be put into a header file:
418+
```C++
419+
const unsigned char epd_example [] PROGMEM = {
420+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ...
421+
...
422+
};
423+
```
424+
425+
Subsequently, it can be used like this:
426+
```C++
427+
display.clear();
428+
display.drawXbm(0, 0, 128, 64, epd_example); // assuming your bitmap is 128x64
429+
display.display();
430+
```
431+
405432
## Example: SSD1306Demo
406433

407434
### Frame 1

0 commit comments

Comments
 (0)