Custom Icons PanelDue
-
Hello,
I would like to add some custom icons to my panelDue, but I dont know how to get the arrays needed from my .bmp files.
I have read some post in the forum around this topic but I am still unable to get this arrays.
How can I get them?
Thanks! -
Hi Ivan. I was looking for a converter tool also and hadn't seen mention of what tool was originally used.
Hopefully someone else gives you a better answer.I only wanted black/white icons so i mashed some awful C# code up if you want to try it. There's no prompt when you click the convert button but it should make a .c file in the same folder as the executable. The C file has an array. My format is missing the x and y bytes at the start of the array. you'll have to add that yourself.
I thought i might return to the code sometime to make it a proper tool for paneldue icons if no other better tool was available. Also, this is windows code and not so OS universal. Perhaps a python script using the pillow? pil? python libraries is in order. if gui based, it would be nice to somehow map a 16 colour bitmap to the panels theme palletes.
-
The icon c array is of type uint8_t - an unsigned 8 bit integer ( a byte).
-
The first two bytes are x and y size byte as like the other image arrays
-
Each byte represents two pixels.
-
the third byte and those after are the pixel pair bytes. The lower nibble (lower significant 4 bits of the byte) preceeds the higher nibble
-
each nibble (pixel) represents a palette map position value 0 to 15. you'll have to check the palette map for each theme to see what colour your pixel value creates
-
the pixels start in the top left corner of the icon and the next nibble and next bytes in the array increments down in the Y direction until a Y column is complete and x increments and fills down the next Y column.
My arrays just have values of 0x00, 0x01, 0x10 and 0x11. This only works because my 24 bit bitmap was only colours 0x000000 and 0xFFFFFF. and that's what my routine looks for. In the paneldue "light" palette, palette map position 0 is white? and palette map position 1 is white?
Sorry its not in github. i'll leave a dropbox link for a while if you want to look at the code or try the exe in the bin/debug folder
https://www.dropbox.com/s/kdzi67dnvtcw37x/BMP2RGB565Array.zip?dl=0 -
-
Hi JD,
Thanks very much for your answer.
I have been trying the .exe in the bin/debug forlder with the icons I would like to add to my panel but I didnt get the result I wanted to.
Although I didnt manage to get the arrays I needed, this program has helped me understanding how this arrays are structured and I think I will be able to do them by hand.
Thanks again for the code!