portapack-mayhem/firmware/tools/bitmap_tools
Benjamin Møller a4c2e155e5
Add generator and parser for bitmap.hpp (#2313)
* Combined the converter from <ico>.png to bitmap.hpp and reverse in one script: pp_png2hpp.py

* Minor change ficed variables from testing.

* Cleanup output for parser. Add description to readme.md

* Update pp_png2hpp.py

Added the suggested and much cleaner argparse code from zxkmm.
Added a icon-name handling, to convert one or a comma seperated subset of icons by name.

* Update pp_bitmap_parser.py

Updated the handler with dynamic in/outputs, in parallel to the pp_png2hpp.py script ... But I think I'll delete this one, after I decide how to handle the alpha (transparent) code.
2024-10-20 20:19:33 +08:00
..
bitmap_arr_reverse_decode.py transparent splash logo & fix tab widget color glitch (#2256) 2024-09-22 19:40:54 +02:00
make_bitmap.py LupusE's patch (#2300) 2024-10-15 15:01:19 +08:00
pp_bitmap_parser.py Add generator and parser for bitmap.hpp (#2313) 2024-10-20 20:19:33 +08:00
pp_png2hpp.py Add generator and parser for bitmap.hpp (#2313) 2024-10-20 20:19:33 +08:00
README.md Add generator and parser for bitmap.hpp (#2313) 2024-10-20 20:19:33 +08:00

bitmap is for icons, it's colorless and headless; splash and modal isn't using bitmap

Bitmap helper folder

The folder bitmap_tools contains scripts to convert icons in png format to the PortaPack readable format in bitmap.hpp.

Convert a folder contains one or more icon.png to one bitmap.hpp

The make_bitmap.py is the traditional helper, well tested. The folder with the icons is given as argument and generates the ./bitmap.hpp. This file needs to be copied to mayhem-firmware/firmware/application/.
The icon size needs to be a multiple of 8. The generated icon is black/white.

Convert bitmap array to icon.png

The bitmap_arr_reverse_decode.py takes an array from the bitmap.hpp and convert it back to a png.

Convert both ways

The pp_png2hpp.py is based on the privious scripts, as all in one solution.
With the --hpp bitmap.hpp file and the --graphics /folder_to/png_icons/ arguments, theis script will generate a bitmap.hpp.
Add the --reverse argument to generate png icons from the given bitmap.hpp.

Especially the reverse function got a parser, to automatic get the filename and size of the image.