aboutsummaryrefslogtreecommitdiffstats
path: root/demos/modules/gdisp
diff options
context:
space:
mode:
Diffstat (limited to 'demos/modules/gdisp')
-rw-r--r--demos/modules/gdisp/images/gfxconf.h4
-rw-r--r--demos/modules/gdisp/images/main.c23
-rw-r--r--demos/modules/gdisp/images/romfs_files.h7
-rw-r--r--demos/modules/gdisp/images/romfs_testpal8.h (renamed from demos/modules/gdisp/images/test-pal8.h)10
-rw-r--r--demos/modules/gdisp/images_animated/gfxconf.h3
-rw-r--r--demos/modules/gdisp/images_animated/main.c26
-rw-r--r--demos/modules/gdisp/images_animated/romfs_files.h7
-rw-r--r--demos/modules/gdisp/images_animated/romfs_testanim.h (renamed from demos/modules/gdisp/images_animated/testanim.h)10
8 files changed, 53 insertions, 37 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..e6a353a2 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 -dcs 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,
@@ -585,3 +585,9 @@ static const unsigned char test_pal8[] = {
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..cbda0d79 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 -dcs 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,
@@ -565,3 +565,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