One of the more complicated things was how to show icons on the Inkplate 6COLOR. Now, generally it is pretty easy: You take the graphic, you convert it into a C header file, import it and then render it to the screen.
However, there are a few challenges: The
drawBitmap3Bit function that is used cannot scale the icon, which is a bit weird because it takes the size of the icon as parameters. But scaling is just not something that this function does.
It’s best is to export an icon immediately in the format and size you want to use. I exported from Sketch and that worked fine.
For icons that have the background full colored in one of the seven colors, make sure to make the color as close to the pure Inkplate color as possible:
I tried out using half-transparent colors, but when I enabled dithering, it did also dither areas that had a solid color. I think going monochrome is best for icons, or you have to manually dither beforehand.
Then, use the [image converter] and upload the image. Select the correct Inkplate board and you should be good to go. Enter the pixel size of your image to get the best representation and click “Convert”. The code is output below the buttons and I almost overlooked it. It also has a preview of the file. Download the “Header File” and place it next to your Arduino sketch file.
You can then import the file using
iconname is your icon’s filename and also means that three variables are defined which you can immediately use in the aforementioned
- iconname → the graphic information
- iconname_w → width
- iconname_w → height
The following code would output a brain graphic in the middle of the screen:
#include "brain.h" display.drawBitmap3Bit(display.width() / 2 - (brain_w / 2), display.height() / 2 - (brain_h / 2), brain, brain_w, brain_h);