Skip to content
max mc costa edited this page Jun 18, 2016 · 2 revisions

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:
demo

  1. Launch LCD Image Converter
    step 1

  2. Press'New Image' and give a legal name (no spaces or weird char or starting with numbers)
    step 2

You get a screen like that (it uses a bogus image)
bogus

  1. Select an image from your HD (take care of the size! You must resize before at dimensions that fit's in the screen!)
    step 3

You should have something similar....
the res

  1. Now go to 'Options-->Conversion...'
    step 4

  2. 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!
    option 1
    option 2
    option 3
    option 4
    option 5

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:
option 6
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.
option 7

  1. 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.
    step 6

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);

Clone this wiki locally