-
Notifications
You must be signed in to change notification settings - Fork 73
functions : drawIcon
drawIcon command will be used in all future versions of my display libraries and icon.c can be interchanged between libraries!
Icons are like Images but B&W and packed in series of bytes, in future I will add the compression as well (there's an option in converter and library ident the flag but still not able to decompress).
To convert an image in Icon, here's the right page:
https://github.com/sumotoy/TFT_ILI9163C/wiki/Convert-Icons
To render icons the library uses the LGPO engine I've created for fonts that allow background transparency and foreground coloring but also scaling!
To use an icon inside your sketch, you need to include first:
#include "_icons/world.c"
You simply need one command to draw icons is:
drawIcon(pos X, pos Y, &Icon, scale, background color, foreground color, inverse)
where:
- pos X: where to draw icon in x (must not exceed screen width or x + icon w > screen width)
- pos Y: where to draw icon in y (must not exceed screen height or y + icon h > screen height)
- &Icon: the icon name
- scale: 1...255 (icon width,icon height x scale must not exceed screen width or screen height)
- foreground color: 16 bit color for foreground (icon will colored)
- background color: 16 bit color for background, set as foreground will trigger icon transparency!
-
inverse: this tell the renderer how to deal with icon pixels, normally black is background and white is foreground but set inverse to 'true' will set the opposite. This is great to deal with images that are negative and you will not need to re-convert
The short form is drawIcon(pos X, pos Y, &Icon)
, in this way scale will set to 1, foreground to WHITE and background to BLACK, the inverse will be false.