-
Notifications
You must be signed in to change notification settings - Fork 31
Convert Icons
Icons are packed in a file so you can fast load inside your project without going crazy with parameters, are similar to Images but are smaller, b&w and packed in series of bytes so they use much less space
Icons are converted by LCD Image Converter b&w series of bytes compatible with library
Conversion use lcd-image-converter from Riuson (thanks a lot man, wonderful work) that have binaries for WIN only. For other OS its needed to build from source code by using GD.
Download the last beta here: http://www.riuson.com/lcd-image-converter/download
An example?
#include <SPI.h>
#include <TFT_ST7735.h>
#include "_icons/world.c"
#define __CS1 10
#define __DC 9
TFT_ST7735 tft1 = TFT_ST7735(__CS1, __DC);
void setup()
{
tft1.begin();
tft1.drawIcon(0, 0, &world);
}
void loop()
{
}
You want to convert this image:
-
Launch LCD Image Converter
-
Press'New Image' and give a legal name (no spaces or weird char or starting with numbers)
You get a screen like that (it uses a bogus image)
- Select an image from your HD (take care of the size! You must resize before at dimensions that fit's in the screen!)
You should have something similar....
-
Now go to 'Options-->Conversion...'
-
Now the 'Conversion Window' let you choose what to do. For convenience it's time to import my sumotoy_Icon.xml preset, then select it. This should set everithing like the following images but not the path of the conversion template that we do at last, follow me, it's easy!
Here we choose templates. I provided 3 different templates for Fonts,Icons and Images. The Font one remain common to all presets but the image one has to be changed.
In brief, drag the 3 templates (sumotoy_icon_1.3.tmpl,sumotoy_font_2.4.tmpl,sumotoy_picture_1.3.tmpl) inside your LCD Image converter folder and choose templates as image:
You hould press the 'Save As' button on top and save. This ensure the correct path of templates has been stored together all parameters. In future you should only change preset!
Now press 'OK' if you get a save prompt, do it.
- Now you just need to convert your icon. This is very simple, choose 'File-->Convert..' al follow and save your converted icon in desktop or directly in the TFT_ST7735/_icons folder.
Can be simplier?
How to load a user icon in a sketch?
You just create an image called word.c in _icons folder? Ok, just need to include in your sketch then use this command:
tft.drawIcon(0,0,&word);