aboutsummaryrefslogtreecommitdiffstats
path: root/include/gwin/image.h
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-02-07 14:07:29 +1000
committerinmarket <andrewh@inmarket.com.au>2014-02-07 14:07:29 +1000
commitbd4827922708efc85c878ebd17ca6a8c88bc75b5 (patch)
treedfd224ab4f0d1157bb5ba5466e636525cdb61f51 /include/gwin/image.h
parent695bcbee5b84cd2e152baca91c58bdc2e971b0d1 (diff)
downloaduGFX-bd4827922708efc85c878ebd17ca6a8c88bc75b5.tar.gz
uGFX-bd4827922708efc85c878ebd17ca6a8c88bc75b5.tar.bz2
uGFX-bd4827922708efc85c878ebd17ca6a8c88bc75b5.zip
Update gwin Images to properly use new GFILE based images
Diffstat (limited to 'include/gwin/image.h')
-rw-r--r--include/gwin/image.h53
1 files changed, 31 insertions, 22 deletions
diff --git a/include/gwin/image.h b/include/gwin/image.h
index 66dd0b94..66aba3d1 100644
--- a/include/gwin/image.h
+++ b/include/gwin/image.h
@@ -60,42 +60,51 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit);
#define gwinImageCreate(w, pInit) gwinGImageCreate(GDISP, w, pInit)
/**
- * @brief Sets the input routines that support reading the image from memory
- * in RAM or flash.
- * @return TRUE if the IO open function succeeds
+ * @brief Opens the image using a GFILE
+ * @return TRUE if the image can be opened
*
* @param[in] gh The widget (must be an image widget)
- * @param[in] memory A pointer to the image in RAM or Flash
+ * @param[in] f The open (for reading) GFILE to use
*
* @api
*/
-bool_t gwinImageOpenMemory(GHandle gh, const void* memory);
+bool_t gwinImageOpenGFile(GHandle gh, GFILE *f);
-#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_LINUX || GFX_USE_OS_OSX || defined(__DOXYGEN__)
- /**
- * @brief Sets the input routines that support reading the image from a file
- * @return TRUE if the IO open function succeeds
- *
- * @param[in] gh The widget (must be an image widget)
- * @param[in] filename The filename to open
- *
- * @api
- */
- bool_t gwinImageOpenFile(GHandle gh, const char* filename);
-#endif
+/**
+ * @brief Opens the image using the specified filename
+ * @return TRUE if the open succeeds
+ *
+ * @param[in] gh The widget (must be an image widget)
+ * @param[in] filename The filename to open
+ *
+ * @api
+ */
+#define gwinImageOpenFile(gh, filename) gwinImageOpenGFile((gh), gfileOpen((filename), "rb"))
-#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__)
/**
- * @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card).
+ * @brief Sets the input routines that support reading the image from memory
+ * in RAM or flash.
+ * @pre GFILE_NEED_MEMFS must be TRUE
* @return TRUE if the IO open function succeeds
*
* @param[in] gh The widget (must be an image widget)
- * @param[in] streamPtr A pointer to the (open) BaseFileStream object.
+ * @param[in] ptr A pointer to the image in RAM or Flash
*
* @api
*/
- bool_t gwinImageOpenStream(GHandle gh, void *streamPtr);
-#endif
+#define gwinImageOpenMemory(gh, ptr) gwinImageOpenGFile((gh), gfileOpenMemory((void *)(ptr), "rb"))
+
+/**
+ * @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card).
+ * @return TRUE if the IO open function succeeds
+ * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be TRUE
+ *
+ * @param[in] gh The widget (must be an image widget)
+ * @param[in] streamPtr A pointer to the (open) BaseFileStream object.
+ *
+ * @api
+ */
+#define gwinImageOpenStream(gh, streamPtr) gwinImageOpenGFile((gh), gfileOpenBaseFIleStream((streamPtr), "rb"))
/**
* @brief Cache the image.