/Arduino-DueVGA-Tools

Tools and code examples for converting/displaying bitmapped graphics on the Arduino Due using the DueVGA library.

Primary LanguageC

Arduino-DueVGA-Tools

Tools and code examples for converting/displaying bitmapped graphics on the Arduino Due using the DueVGA library.

./convert.rb

This utility will convert an 8bit PNG file, exported with the supplied 256 colour palette, into a bitmap ( unsigned char array ) for use on the Arduino Due with the DueVGA library available here: http://stimmer.github.io/DueVGA/

To install the dependencies, use "bundle install"

To get started, type "./convert.rb --help"

To use a colour palette, you must select the hex colour values you want and place them into a comma-separated string.

You may choose 16 colours for a palette, the first colour at index 0 will be treated as transparent, giving you 15 actual colours.

This table may prove useful: http://pi.gadgetoid.com/arduino-due/DueVGA-colour-table

Converting an image using a colour palette will include 3 bytes of metadata in the resulting array. Width, Height and Frame Count. The example code uses this meta-data to draw a specific frame from your converted image. Example:

static unsigned char my_image[n] = { 32, // width 32, // height 8, // frames 0x01,0x01,0xff... }

To pack the whole colour palette using a 16 colour palette you could try "./convert.rb -f palette.png -p "0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F""

This will result in the following output:

static unsigned char palette_palette[15] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f} static unsigned char palette[131] = { 32, 8, 1, 0x01,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x45,0x67,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x89,0xab,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xcd,0xef,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00