Skip to content

Improved README: added section about bitmaps #388

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

Merged
merged 2 commits into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,33 @@ OLEDDisplayUiState* getUiState();
int8_t update();
```

## Creating and using XBM bitmaps

If you want to display your own images with this library, the best way to do this is using a bitmap.

There are two options to convert an image to a compatible bitmap:
1. **Using Gimp.**
In this case exporting the bitmap in an 1-bit XBM format is sufficient.
2. **Using a converter website.**
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:
- Draw Mode: Horizontal - 1 bit per pixel
- Swap bits in byte: swap checkbox should be checked.

The resulting bitmap can be put into a header file:
```C++
const unsigned char epd_example [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ...
...
};
```

Subsequently, it can be used like this:
```C++
display.clear();
display.drawXbm(0, 0, 128, 64, epd_example); // assuming your bitmap is 128x64
display.display();
```

## Example: SSD1306Demo

### Frame 1
Expand Down