diff options
author | Joel Bodenmann <joel@unormal.org> | 2014-02-09 02:19:38 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2014-02-09 02:19:38 +0100 |
commit | f68f4fcd21831894a1330131d7feefa0e63c39c1 (patch) | |
tree | 53f68c28ca4bc52a9ef0d393b362a488ca8e0ddf /demos | |
parent | 3c6df9a4a1b810411d9207fd2da39c3378bb9657 (diff) | |
parent | c5f87f9952b11f0792dd1455e3f4286123c1d388 (diff) | |
download | uGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.tar.gz uGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.tar.bz2 uGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.zip |
Merge branch 'gfile'
Diffstat (limited to 'demos')
-rw-r--r-- | demos/modules/gdisp/images/gfxconf.h | 4 | ||||
-rw-r--r-- | demos/modules/gdisp/images/main.c | 23 | ||||
-rw-r--r-- | demos/modules/gdisp/images/romfs_files.h | 7 | ||||
-rw-r--r-- | demos/modules/gdisp/images/romfs_testpal8.h (renamed from demos/modules/gdisp/images/test-pal8.h) | 28 | ||||
-rw-r--r-- | demos/modules/gdisp/images_animated/gfxconf.h | 3 | ||||
-rw-r--r-- | demos/modules/gdisp/images_animated/main.c | 26 | ||||
-rw-r--r-- | demos/modules/gdisp/images_animated/romfs_files.h | 7 | ||||
-rw-r--r-- | demos/modules/gdisp/images_animated/romfs_testanim.h (renamed from demos/modules/gdisp/images_animated/testanim.h) | 26 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/gfxconf.h | 5 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/main.c | 16 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/romfs_files.h | 8 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/romfs_img_chibios.h (renamed from demos/modules/gwin/widgets/image_chibios.h) | 8 | ||||
-rw-r--r-- | demos/modules/gwin/widgets/romfs_img_yesno.h (renamed from demos/modules/gwin/widgets/image_yesno.h) | 12 |
13 files changed, 125 insertions, 48 deletions
diff --git a/demos/modules/gdisp/images/gfxconf.h b/demos/modules/gdisp/images/gfxconf.h index 6cd78b37..4ef9ab9e 100644 --- a/demos/modules/gdisp/images/gfxconf.h +++ b/demos/modules/gdisp/images/gfxconf.h @@ -51,5 +51,9 @@ #define GDISP_NEED_IMAGE_JPG FALSE #define GDISP_NEED_IMAGE_PNG FALSE +#define GFX_USE_GFILE TRUE +#define GFILE_NEED_ROMFS TRUE +//#define GFILE_NEED_NATIVEFS TRUE + #endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/images/main.c b/demos/modules/gdisp/images/main.c index b87f663c..6a2e4418 100644 --- a/demos/modules/gdisp/images/main.c +++ b/demos/modules/gdisp/images/main.c @@ -29,15 +29,12 @@ #include "gfx.h" -#ifdef WIN32 - #define USE_MEMORY_FILE TRUE // Can be true or false for Win32 -#else - #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image -#endif - -#if USE_MEMORY_FILE - #include "test-pal8.h" -#endif +/** + * The image file must be stored on a GFILE file-system. + * Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both). + * + * The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS. + */ static gdispImage myImage; @@ -52,13 +49,7 @@ int main(void) { sheight = gdispGetHeight(); // Set up IO for our image -#if USE_MEMORY_FILE - gdispImageSetMemoryReader(&myImage, test_pal8); -#else - gdispImageSetSimulFileReader(&myImage, "test-pal8.bmp"); -#endif - - gdispImageOpen(&myImage); + gdispImageOpenFile(&myImage, "test-pal8.bmp"); gdispImageDraw(&myImage, 0, 0, swidth, sheight, 0, 0); gdispImageClose(&myImage); diff --git a/demos/modules/gdisp/images/romfs_files.h b/demos/modules/gdisp/images/romfs_files.h new file mode 100644 index 00000000..a31dc7bf --- /dev/null +++ b/demos/modules/gdisp/images/romfs_files.h @@ -0,0 +1,7 @@ +/** + * This file contains the list of files for the ROMFS. + * + * The files have been converted using... + * file2c -dbcs infile outfile + */ +#include "romfs_testpal8.h" diff --git a/demos/modules/gdisp/images/test-pal8.h b/demos/modules/gdisp/images/romfs_testpal8.h index 9d1d7e0f..a7844b0d 100644 --- a/demos/modules/gdisp/images/test-pal8.h +++ b/demos/modules/gdisp/images/romfs_testpal8.h @@ -1,10 +1,10 @@ /** * This file was generated from "test-pal8.bmp" using... * - * file2c -cs test-pal8.bmp test-pal8.h + * file2c -bbcs test-pal8.bmp romfs_testpal8.h * */ -static const unsigned char test_pal8[] = { +static const char test_pal8[] = { 0x42, 0x4D, 0x26, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x04, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x13, 0x0B, 0x00, 0x00, 0x13, 0x0B, 0x00, 0x00, 0xFC, 0x00, @@ -69,6 +69,8 @@ static const unsigned char test_pal8[] = { 0x66, 0x00, 0xFF, 0x80, 0x99, 0x00, 0xFF, 0x80, 0xCC, 0x00, 0xFF, 0x80, 0xFF, 0x00, 0xFF, 0xAA, 0x00, 0x00, 0xFF, 0xAA, 0x33, 0x00, 0xFF, 0xAA, 0x66, 0x00, 0xFF, 0xAA, 0x99, 0x00, 0xFF, 0xAA, 0xCC, 0x00, 0xFF, 0xAA, 0xFF, 0x00, 0xFF, 0xD5, 0x00, 0x00, 0xFF, 0xD5, 0x33, 0x00, 0xFF, 0xD5, +}; +static const char test_pal8_p2[] = { 0x66, 0x00, 0xFF, 0xD5, 0x99, 0x00, 0xFF, 0xD5, 0xCC, 0x00, 0xFF, 0xD5, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x33, 0x00, 0xFF, 0xFF, 0x66, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, 0xCC, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x30, 0x30, 0x30, 0x30, 0x36, @@ -133,6 +135,8 @@ static const unsigned char test_pal8[] = { 0x5C, 0x2B, 0x5C, 0x56, 0x5C, 0x56, 0x87, 0x56, 0x87, 0x81, 0xB2, 0x81, 0xB2, 0x81, 0xB2, 0xAC, 0xB2, 0xAC, 0xDD, 0xAC, 0xDD, 0xD7, 0x2A, 0x00, 0x30, 0x00, 0x31, 0x06, 0x31, 0x07, 0x38, 0x07, 0x38, 0x0D, 0x3E, 0x0E, 0x3E, 0x0E, 0x45, 0x14, 0x45, 0x15, 0x46, 0x1B, 0x46, 0x1B, 0x4C, 0x22, +}; +static const char test_pal8_p3[] = { 0x4C, 0x22, 0x53, 0x22, 0x53, 0x29, 0x93, 0x62, 0x68, 0x62, 0x92, 0x62, 0x68, 0x62, 0x93, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x31, 0x30, 0x31, 0x30, 0x37, @@ -197,6 +201,8 @@ static const unsigned char test_pal8[] = { 0x62, 0x31, 0x62, 0x5C, 0x62, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0xB8, 0x87, 0xB8, 0x87, 0xB8, 0xB2, 0xB8, 0xB2, 0xE3, 0xB2, 0xE3, 0xDD, 0x54, 0x2A, 0x30, 0x2A, 0x5B, 0x30, 0x31, 0x31, 0x62, 0x31, 0x38, 0x37, 0x68, 0x38, 0x3E, 0x38, 0x6F, 0x3E, 0x45, 0x3F, 0x70, 0x45, 0x46, 0x45, 0x76, 0x4C, +}; +static const char test_pal8_p4[] = { 0x4C, 0x4C, 0x7D, 0x4C, 0x53, 0x53, 0x93, 0x62, 0x68, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x00, 0x01, 0x01, 0x01, 0x07, 0x01, 0x31, 0x31, 0x31, 0x31, 0x37, @@ -261,6 +267,8 @@ static const unsigned char test_pal8[] = { 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x62, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xB8, 0xB8, 0xE9, 0xB8, 0xE3, 0xE3, 0x54, 0x54, 0x5A, 0x2A, 0x5B, 0x30, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x38, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x45, 0x70, 0x45, 0x76, 0x76, +}; +static const char test_pal8_p5[] = { 0x76, 0x4C, 0x7D, 0x4C, 0x7D, 0x53, 0x93, 0x68, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x92, 0x93, 0x62, 0x93, 0x8C, 0x93, 0x00, 0x02, 0x02, 0x02, 0x08, 0x02, 0x32, 0x32, 0x32, 0x32, 0x38, @@ -325,6 +333,8 @@ static const unsigned char test_pal8[] = { 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x62, 0x93, 0x68, 0x93, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xBE, 0xB8, 0xE9, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x54, 0x85, 0x5A, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x92, 0x62, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, +}; +static const char test_pal8_p6[] = { 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x93, 0x62, 0x93, 0x68, 0x93, 0x68, 0x93, 0x68, 0x93, 0x62, 0x93, 0x92, 0x93, 0x68, 0x93, 0x92, 0x93, 0x62, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x00, 0x02, 0x03, 0x02, 0x09, 0x02, 0x33, 0x32, 0x33, 0x32, 0x39, @@ -389,6 +399,8 @@ static const unsigned char test_pal8[] = { 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0xBE, 0xEF, 0xBE, 0xEF, 0xE9, 0xA8, 0x7E, 0x84, 0x7E, 0xAF, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0xBC, 0x8C, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +static const char test_pal8_p7[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x92, 0x93, 0x68, 0x99, 0x92, 0x93, 0x68, 0x99, 0x92, 0x93, 0x92, 0x99, 0x92, 0x93, 0x92, 0xC3, 0x92, 0x93, 0x92, 0xC3, 0x92, 0x93, 0x00, 0x03, 0x03, 0x03, 0x09, 0x03, 0x33, 0x33, 0x33, 0x33, 0x39, @@ -453,6 +465,8 @@ static const unsigned char test_pal8[] = { 0x74, 0x43, 0x74, 0x6E, 0x74, 0x6E, 0x9F, 0x6E, 0x9F, 0x99, 0xCA, 0x99, 0xCA, 0x99, 0xCA, 0xC4, 0xCA, 0xC4, 0xF5, 0xC4, 0xF5, 0xEF, 0xA8, 0x7E, 0xAE, 0x7E, 0xAF, 0x84, 0xAF, 0x85, 0xB6, 0x85, 0xB6, 0x8B, 0xBC, 0x8C, 0xBC, 0x8C, 0xC3, 0x92, 0xC3, 0x93, 0xC4, 0x99, 0xC4, 0x99, 0xCA, 0xA0, +}; +static const char test_pal8_p8[] = { 0xCA, 0xA0, 0xD1, 0xA0, 0xD1, 0xA7, 0x99, 0x93, 0x99, 0x68, 0x99, 0x92, 0x99, 0x68, 0x99, 0x93, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x0A, 0x04, 0x34, 0x34, 0x34, 0x34, 0x3A, @@ -517,6 +531,8 @@ static const unsigned char test_pal8[] = { 0x7A, 0x49, 0x7A, 0x74, 0x74, 0x74, 0xA5, 0x74, 0xA5, 0x9F, 0xD0, 0x9F, 0xCA, 0x9F, 0xD0, 0xCA, 0xD0, 0xCA, 0xFB, 0xCA, 0xF5, 0xF5, 0xD2, 0xA8, 0xD8, 0xA8, 0xD9, 0xAE, 0xD9, 0xAF, 0xE0, 0xAF, 0xE0, 0xB5, 0xE6, 0xB6, 0xE6, 0xB6, 0xED, 0xBC, 0xED, 0xBD, 0xEE, 0xC3, 0xEE, 0xC3, 0xF4, 0xCA, +}; +static const char test_pal8_p9[] = { 0xF4, 0xCA, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x92, 0xC3, 0x93, 0x99, 0x93, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x0B, 0x04, 0x35, 0x34, 0x35, 0x34, 0x3A, @@ -581,7 +597,15 @@ static const unsigned char test_pal8[] = { 0x7A, 0x4F, 0x7A, 0x7A, 0x7A, 0x7A, 0xA5, 0x7A, 0xA5, 0xA5, 0xD0, 0xA5, 0xD0, 0xA5, 0xD0, 0xD0, 0xD0, 0xD0, 0xFB, 0xD0, 0xFB, 0xFB, 0xD2, 0xD2, 0xD8, 0xD2, 0xD9, 0xD8, 0xD9, 0xD9, 0xE0, 0xD9, 0xE0, 0xDF, 0xE6, 0xE0, 0xE6, 0xE0, 0xED, 0xE6, 0xED, 0xE7, 0xEE, 0xED, 0xEE, 0xED, 0xF4, 0xF4, +}; +static const char test_pal8_p10[] = { 0xF4, 0xF4, 0xFB, 0xF4, 0xFB, 0xFB, 0xC4, 0x93, 0x99, 0x93, 0xC4, 0x93, 0x99, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x00, }; + +#ifdef ROMFS_DIRENTRY_HEAD + static const ROMFS_DIRENTRY test_pal8_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "test-pal8.bmp", 9254, test_pal8 }; + #undef ROMFS_DIRENTRY_HEAD + #define ROMFS_DIRENTRY_HEAD &test_pal8_dir +#endif diff --git a/demos/modules/gdisp/images_animated/gfxconf.h b/demos/modules/gdisp/images_animated/gfxconf.h index cc38ed36..fddda437 100644 --- a/demos/modules/gdisp/images_animated/gfxconf.h +++ b/demos/modules/gdisp/images_animated/gfxconf.h @@ -51,5 +51,8 @@ #define GDISP_NEED_IMAGE_JPG FALSE #define GDISP_NEED_IMAGE_PNG FALSE +#define GFX_USE_GFILE TRUE +#define GFILE_NEED_ROMFS TRUE + #endif /* _GFXCONF_H */ diff --git a/demos/modules/gdisp/images_animated/main.c b/demos/modules/gdisp/images_animated/main.c index 9b2b5d2c..039cf584 100644 --- a/demos/modules/gdisp/images_animated/main.c +++ b/demos/modules/gdisp/images_animated/main.c @@ -29,23 +29,20 @@ #include "gfx.h" +/** + * The image file must be stored on a GFILE file-system. + * Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both). + * + * The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS. + */ + #define USE_IMAGE_CACHE FALSE // Only if you want to get performance at the expense of RAM #define MY_BG_COLOR RGB2COLOR(220, 220, 255) // Pale blue so we can see the transparent parts -#ifdef WIN32 - #define USE_MEMORY_FILE TRUE // Can be true or false for Win32 -#else - #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image -#endif +static gdispImage myImage; #define SHOW_ERROR(color) gdispFillArea(errx, erry, errcx, errcy, color) -#if USE_MEMORY_FILE - #include "testanim.h" -#endif - -static gdispImage myImage; - /** * This demo display the animated gif (either directly from a file or from a * file encoded in flash. @@ -75,13 +72,8 @@ int main(void) { errcy = sheight; // Set up IO for our image -#if USE_MEMORY_FILE - gdispImageSetMemoryReader(&myImage, testanim); -#else - gdispImageSetFileReader(&myImage, "testanim.gif"); -#endif + if (!(gdispImageOpenFile(&myImage, "testanim.gif") & GDISP_IMAGE_ERR_UNRECOVERABLE)) { - if (gdispImageOpen(&myImage) == GDISP_IMAGE_ERR_OK) { gdispImageSetBgColor(&myImage, MY_BG_COLOR); // Adjust the error indicator area if necessary if (myImage.width > errx && myImage.height < sheight) { diff --git a/demos/modules/gdisp/images_animated/romfs_files.h b/demos/modules/gdisp/images_animated/romfs_files.h new file mode 100644 index 00000000..9cd40491 --- /dev/null +++ b/demos/modules/gdisp/images_animated/romfs_files.h @@ -0,0 +1,7 @@ +/** + * This file contains the list of files for the ROMFS. + * + * The files have been converted using... + * file2c -dbcs infile outfile + */ +#include "romfs_testanim.h" diff --git a/demos/modules/gdisp/images_animated/testanim.h b/demos/modules/gdisp/images_animated/romfs_testanim.h index ce2ba8c7..3b35b120 100644 --- a/demos/modules/gdisp/images_animated/testanim.h +++ b/demos/modules/gdisp/images_animated/romfs_testanim.h @@ -1,10 +1,10 @@ /** * This file was generated from "testanim.gif" using... * - * file2c -cs testanim.gif testanim.h + * file2c -bbcs testanim.gif romfs_testanim.h * */ -static const unsigned char testanim[] = { +static const char testanim[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x99, 0x00, 0x73, 0x00, 0xE6, 0x46, 0x00, 0x04, 0x07, 0x00, 0x10, 0x0F, 0x04, 0x1D, 0x1E, 0x29, 0x20, 0x23, 0x08, 0x2E, 0x2C, 0x18, 0x31, 0x32, 0x01, 0x2E, 0x32, 0x2A, 0x35, 0x37, 0x3B, 0x20, 0x28, 0x42, 0x2B, 0x37, 0x53, 0x3E, 0x41, 0x03, 0x3C, 0x44, @@ -69,6 +69,8 @@ static const unsigned char testanim[] = { 0x84, 0x61, 0x8E, 0x71, 0x05, 0x63, 0xE6, 0x5C, 0x85, 0x80, 0x80, 0xD7, 0x60, 0xB3, 0x10, 0x70, 0x40, 0x00, 0xB5, 0x61, 0xA0, 0x40, 0x04, 0x18, 0x30, 0x70, 0x80, 0x01, 0x09, 0x88, 0x35, 0xDA, 0x82, 0xD1, 0x58, 0xA0, 0xC8, 0x31, 0x79, 0xED, 0x48, 0x61, 0x95, 0x71, 0x5D, 0x68, 0xC0, 0x47, +}; +static const char testanim_p2[] = { 0x14, 0x52, 0x18, 0xD7, 0x8C, 0x0B, 0x78, 0x80, 0xC1, 0x00, 0x95, 0x65, 0xB8, 0xA5, 0x3E, 0xDF, 0x08, 0xF3, 0x4F, 0x02, 0xC9, 0x4D, 0x76, 0x90, 0x9D, 0x91, 0xCD, 0xE5, 0x81, 0x07, 0x2D, 0xE4, 0xE4, 0xD6, 0x9B, 0x23, 0x79, 0x08, 0x82, 0x7A, 0x4A, 0xC5, 0x45, 0x80, 0x04, 0x03, 0x10, 0x40, @@ -133,6 +135,8 @@ static const unsigned char testanim[] = { 0x8D, 0x34, 0xE6, 0x9E, 0x0E, 0x08, 0x87, 0xEB, 0x62, 0xC5, 0x1D, 0x67, 0x16, 0x00, 0x9A, 0xF3, 0xA8, 0x00, 0xE9, 0x6E, 0x68, 0xC0, 0xF1, 0x21, 0x85, 0xA1, 0xCF, 0xA3, 0x9E, 0xE9, 0x70, 0xC3, 0xD0, 0x56, 0xF9, 0xB0, 0x9C, 0xD5, 0x1A, 0x08, 0x86, 0x16, 0xC0, 0x81, 0x0D, 0x38, 0xD1, 0x08, +}; +static const char testanim_p3[] = { 0x21, 0xC5, 0x2A, 0x86, 0x5C, 0xF7, 0x35, 0x48, 0x74, 0x55, 0x07, 0xBE, 0xD4, 0x4A, 0x14, 0x27, 0x47, 0x49, 0x84, 0x0D, 0xB3, 0x61, 0xC0, 0x88, 0xD6, 0x5C, 0x4E, 0x51, 0x9F, 0x48, 0xCE, 0x48, 0x79, 0x85, 0xC0, 0x88, 0x01, 0x62, 0x95, 0xC3, 0x34, 0x0E, 0xC0, 0xA7, 0x35, 0x2C, 0xDD, 0x51, @@ -197,6 +201,8 @@ static const unsigned char testanim[] = { 0x83, 0xB2, 0x64, 0xAA, 0xF2, 0x4D, 0x4C, 0x67, 0x38, 0x33, 0x61, 0x1F, 0x1D, 0x71, 0x67, 0xAE, 0x63, 0x4A, 0x86, 0x13, 0x68, 0x7F, 0x01, 0x65, 0xAC, 0x17, 0x5F, 0x40, 0x62, 0x68, 0xBB, 0x66, 0x77, 0x53, 0xA6, 0x77, 0xA8, 0x20, 0x2B, 0xA5, 0xC3, 0x34, 0xF2, 0x86, 0x0A, 0xEC, 0xD2, 0x24, +}; +static const char testanim_p4[] = { 0xE0, 0x67, 0x2E, 0x2B, 0x24, 0x0E, 0x6B, 0x93, 0x27, 0x4B, 0x43, 0x0F, 0x5D, 0x26, 0x7C, 0x59, 0xB7, 0x21, 0x71, 0x41, 0x2F, 0x01, 0x24, 0x7B, 0xBD, 0x55, 0x3E, 0x7E, 0x38, 0x1B, 0x40, 0xE1, 0x3A, 0x08, 0x70, 0x85, 0x82, 0xE0, 0x73, 0x7A, 0x32, 0x3A, 0x06, 0xC8, 0x6E, 0xD3, 0x73, 0x6B, @@ -261,6 +267,8 @@ static const unsigned char testanim[] = { 0x32, 0xA0, 0x03, 0x1D, 0x40, 0x03, 0x0B, 0x00, 0x03, 0x71, 0xFA, 0x02, 0x7A, 0x9A, 0x97, 0x40, 0x40, 0x02, 0x78, 0x69, 0x9B, 0x31, 0x26, 0x03, 0xE2, 0x33, 0x51, 0xF4, 0x30, 0xA5, 0xB3, 0x81, 0x35, 0x77, 0x42, 0x5D, 0x58, 0x5A, 0x19, 0xE5, 0xEA, 0x66, 0x27, 0x2A, 0x0B, 0x33, 0xE6, 0x6B, +}; +static const char testanim_p5[] = { 0x0A, 0x89, 0x65, 0xB3, 0x35, 0xA0, 0xA5, 0xE9, 0x93, 0xBC, 0x78, 0x9D, 0xEA, 0xFA, 0x1D, 0xAE, 0xD3, 0x88, 0x05, 0x1A, 0x00, 0x9E, 0xDA, 0x02, 0x33, 0xE2, 0x01, 0x16, 0xFA, 0x02, 0x42, 0xF0, 0x02, 0x3E, 0x90, 0x97, 0x3A, 0x80, 0x97, 0xA4, 0xEA, 0x03, 0x24, 0x45, 0x3E, 0xAC, 0x64, 0xAB, @@ -325,6 +333,8 @@ static const unsigned char testanim[] = { 0xBD, 0xFC, 0x56, 0x2E, 0xE0, 0x28, 0x7B, 0xE9, 0xB4, 0xF5, 0x1A, 0x63, 0xD1, 0x1A, 0x63, 0x5D, 0x3C, 0xC3, 0x1C, 0xBD, 0xA4, 0x61, 0x79, 0x67, 0xBB, 0xA2, 0x24, 0x71, 0xE5, 0x3B, 0x3B, 0x02, 0x29, 0x2B, 0x0A, 0xD2, 0xFA, 0x8C, 0x65, 0x6F, 0x8D, 0xCD, 0xEA, 0x06, 0x6F, 0x71, 0x69, 0x4D, +}; +static const char testanim_p6[] = { 0xDD, 0x5C, 0xB4, 0x61, 0x8A, 0x55, 0x78, 0xF8, 0xD2, 0xDB, 0xD6, 0xC4, 0x2F, 0x90, 0x9E, 0xCC, 0x5A, 0xAF, 0x35, 0xD0, 0xA6, 0x82, 0xBD, 0x8A, 0xB9, 0x82, 0xA5, 0xF3, 0x59, 0x21, 0xE9, 0x04, 0x26, 0xA8, 0xA5, 0x23, 0x4A, 0xD1, 0xDA, 0x56, 0x13, 0x01, 0x74, 0x86, 0x0A, 0xD0, 0x10, 0xD9, @@ -389,6 +399,8 @@ static const unsigned char testanim[] = { 0x11, 0x88, 0x8B, 0x2A, 0x2A, 0xE0, 0xE7, 0x8D, 0x05, 0xE7, 0x90, 0xA3, 0x98, 0xDF, 0x96, 0x90, 0xDD, 0xA6, 0x82, 0x9D, 0xD4, 0xD0, 0xD1, 0x98, 0x02, 0x06, 0x0C, 0xB0, 0x72, 0xB5, 0x20, 0x96, 0x87, 0x16, 0x32, 0x6C, 0xE9, 0xD2, 0x25, 0xE3, 0x85, 0x8E, 0x5E, 0x1D, 0x30, 0x6C, 0x08, 0xC6, +}; +static const char testanim_p7[] = { 0xEA, 0x40, 0x83, 0x03, 0x19, 0x1A, 0x28, 0x1B, 0xD0, 0x60, 0x9A, 0xB2, 0x4D, 0x04, 0x04, 0x39, 0xF3, 0x64, 0xA9, 0x94, 0xB7, 0x7D, 0xFB, 0xB6, 0xA9, 0x9C, 0x00, 0xCF, 0x54, 0x3E, 0x70, 0x88, 0x06, 0x88, 0x73, 0x34, 0x80, 0x82, 0x0A, 0x46, 0x88, 0x2A, 0x35, 0x6A, 0xC4, 0xA8, 0x52, 0x24, @@ -453,6 +465,8 @@ static const unsigned char testanim[] = { 0x01, 0x1F, 0x50, 0x50, 0x18, 0x09, 0x67, 0x9D, 0x03, 0x6B, 0xCF, 0x18, 0x8A, 0x4F, 0x4C, 0x51, 0x8C, 0x59, 0x80, 0xC0, 0x00, 0x64, 0xAA, 0x8F, 0x04, 0x2C, 0x00, 0x9F, 0x5C, 0x60, 0x60, 0x65, 0x35, 0x78, 0x48, 0x69, 0x3A, 0xD0, 0x82, 0x91, 0x6D, 0x20, 0x22, 0x4F, 0xEC, 0x00, 0xA8, 0xD4, +}; +static const char testanim_p8[] = { 0xA2, 0x23, 0x5A, 0xE1, 0x26, 0x47, 0xC9, 0x23, 0x89, 0x63, 0x46, 0x32, 0x80, 0xB2, 0x64, 0x69, 0x50, 0xF9, 0xE8, 0x4E, 0x27, 0xCA, 0xE1, 0x38, 0x14, 0xDE, 0x30, 0x02, 0xD2, 0xB2, 0x10, 0x00, 0x70, 0xF7, 0xB3, 0xEA, 0xF0, 0xA5, 0x12, 0x56, 0xB2, 0xC4, 0x8E, 0xB2, 0x36, 0x94, 0x4C, 0xD1, @@ -517,6 +531,8 @@ static const unsigned char testanim[] = { 0x12, 0x42, 0x3C, 0x6C, 0xF3, 0x51, 0x92, 0x20, 0x33, 0x82, 0x42, 0x68, 0xB4, 0xB0, 0xD5, 0x68, 0x40, 0xA2, 0x1A, 0x21, 0x87, 0x78, 0x80, 0x11, 0xD4, 0x18, 0xCC, 0x5C, 0x46, 0x80, 0xB4, 0xD0, 0x90, 0x40, 0xD2, 0x82, 0x1A, 0xDB, 0x2E, 0xCC, 0x33, 0xC2, 0x52, 0xC6, 0x0F, 0x5C, 0x32, 0x6A, +}; +static const char testanim_p9[] = { 0x0C, 0x01, 0xE2, 0xA3, 0x05, 0x86, 0x0E, 0x92, 0x0E, 0x90, 0x78, 0x61, 0x61, 0xC1, 0x0B, 0x1B, 0xFE, 0x2F, 0x3C, 0xD1, 0x20, 0x08, 0xE4, 0xE3, 0x8F, 0x17, 0x35, 0x6A, 0xB4, 0x70, 0x61, 0xD5, 0xC8, 0x82, 0xBF, 0x5C, 0x49, 0xB8, 0xF0, 0xF1, 0x71, 0x88, 0x8C, 0x8F, 0x3E, 0x78, 0x1A, 0x21, @@ -565,3 +581,9 @@ static const unsigned char testanim[] = { 0xD7, 0x82, 0xFC, 0x87, 0xAE, 0x20, 0x04, 0x10, 0xA0, 0x48, 0xA0, 0x86, 0xCC, 0x05, 0x0C, 0x30, 0x87, 0x2C, 0x38, 0x88, 0xED, 0x86, 0x04, 0x02, 0x00, 0x3B, }; + +#ifdef ROMFS_DIRENTRY_HEAD + static const ROMFS_DIRENTRY testanim_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "testanim.gif", 8938, testanim }; + #undef ROMFS_DIRENTRY_HEAD + #define ROMFS_DIRENTRY_HEAD &testanim_dir +#endif diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index b22af659..60de8d8b 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -79,6 +79,11 @@ #define GWIN_NEED_RADIO TRUE #define GWIN_NEED_LIST TRUE +/* Features for the GFILE subsystem. */ +#define GFX_USE_GFILE TRUE +#define GFILE_NEED_ROMFS TRUE +//#define GFILE_NEED_NATIVEFS TRUE + /* Features for the GINPUT subsystem. */ #define GINPUT_NEED_MOUSE TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index af2926d7..7c06f3bf 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -28,16 +28,19 @@ #include "gfx.h" -// include our chibios logo in a .gif format -#include "image_chibios.h" -#include "image_yesno.h" - /** * This demo demonstrates many of the GWIN widgets. * On the "Radio" tab try playing with the color radio buttons. * On the "Checkbox" tab try playing with the "Disable All" checkbox. */ +/** + * The image files must be stored on a GFILE file-system. + * Use either GFILE_NEED_NATIVEFS or GFILE_NEED_ROMFS (or both). + * + * The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS. + */ + /* Our custom yellow style */ static const GWidgetStyle YellowWidgetStyle = { Yellow, // window background @@ -184,15 +187,14 @@ static void createWidgets(void) { wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(0, &wi, TRUE); gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE); gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE); - gdispImageSetMemoryReader(&imgYesNo, image_yesno); - gdispImageOpen(&imgYesNo); + gdispImageOpenFile(&imgYesNo, "image_yesno.gif"); gwinListItemSetImage(ghList3, 1, &imgYesNo); gwinListItemSetImage(ghList3, 3, &imgYesNo); // Image wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; ghImage1 = gwinImageCreate(0, &wi.g); - gwinImageOpenMemory(ghImage1, image_chibios); + gwinImageOpenFile(ghImage1, "chibios.bmp"); gwinImageCache(ghImage1); // Console - we apply some special colors before making it visible diff --git a/demos/modules/gwin/widgets/romfs_files.h b/demos/modules/gwin/widgets/romfs_files.h new file mode 100644 index 00000000..b503765d --- /dev/null +++ b/demos/modules/gwin/widgets/romfs_files.h @@ -0,0 +1,8 @@ +/** + * This file contains the list of files for the ROMFS. + * + * The files have been converted using... + * file2c -dbcs infile outfile + */ +#include "romfs_img_chibios.h" +#include "romfs_img_yesno.h" diff --git a/demos/modules/gwin/widgets/image_chibios.h b/demos/modules/gwin/widgets/romfs_img_chibios.h index a052395f..14007610 100644 --- a/demos/modules/gwin/widgets/image_chibios.h +++ b/demos/modules/gwin/widgets/romfs_img_chibios.h @@ -1,4 +1,4 @@ -static const unsigned char image_chibios[] = { +static const char image_chibios[] = { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x74, 0x00, 0x74, 0x00, 0xE7, 0xFE, 0x00, 0x08, 0x07, 0x02, 0x00, 0x0A, 0x03, 0x08, 0x07, 0x0E, 0x05, 0x0D, 0x00, 0x00, 0x11, 0x02, 0x03, 0x16, 0x01, 0x09, 0x15, 0x00, 0x00, 0x19, 0x03, 0x14, 0x16, 0x06, 0x00, 0x1D, 0x02, 0x07, 0x1C, 0x01, 0x0F, 0x1A, @@ -635,3 +635,9 @@ static const unsigned char image_chibios[] = { 0xE0, 0x3F, 0x62, 0xE0, 0x07, 0x86, 0xE0, 0x08, 0x96, 0xE0, 0x09, 0xA6, 0xE0, 0x0A, 0xB6, 0xE0, 0x0B, 0xC6, 0x60, 0xF0, 0x08, 0x08, 0x00, 0x3B, }; + +#ifdef ROMFS_DIRENTRY_HEAD + static const ROMFS_DIRENTRY image_chibios_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "chibios.bmp", 634*16+8, image_chibios }; + #undef ROMFS_DIRENTRY_HEAD + #define ROMFS_DIRENTRY_HEAD &image_chibios_dir +#endif diff --git a/demos/modules/gwin/widgets/image_yesno.h b/demos/modules/gwin/widgets/romfs_img_yesno.h index c3150ea7..0559330e 100644 --- a/demos/modules/gwin/widgets/image_yesno.h +++ b/demos/modules/gwin/widgets/romfs_img_yesno.h @@ -1,10 +1,10 @@ /** - * This file was generated from "yesno.gif" using... + * This file was generated from "image_yesno.gif" using... * - * file2c -bcs image_yesno.gif image_yesno.h + * file2c -bbcs image_yesno.gif romfs_img_yesno.h * */ -static const unsigned char image_yesno[] = { +static const char image_yesno[] = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x0B, 0x00, 0x2C, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0xC6, 0xFF, 0xC6, 0xCE, 0xFF, 0xCE, 0xFF, 0x08, 0x18, 0xFF, 0xCE, 0xDE, 0xFF, 0xDE, 0xDE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -19,3 +19,9 @@ static const unsigned char image_yesno[] = { 0x05, 0x35, 0x81, 0x84, 0x86, 0x83, 0x14, 0x8B, 0x07, 0x86, 0x79, 0x8F, 0x82, 0x8F, 0x8E, 0x17, 0x8E, 0x62, 0x8B, 0x8C, 0x8A, 0x87, 0x05, 0x11, 0x00, 0x3B, }; + +#ifdef ROMFS_DIRENTRY_HEAD + static const ROMFS_DIRENTRY image_yesno_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "image_yesno.gif", 202, image_yesno }; + #undef ROMFS_DIRENTRY_HEAD + #define ROMFS_DIRENTRY_HEAD &image_yesno_dir +#endif |