aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2013-04-20 21:19:26 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2013-04-20 21:19:26 +1000
commita02c124940b6c5d61ffcbfb2c7e4d493775c3192 (patch)
treee9f0ff1c65c629050948867fb716d91544f3c6be /include
parentdc85ef79aa520e000f15dfb5d781ce0a86babd0b (diff)
downloaduGFX-a02c124940b6c5d61ffcbfb2c7e4d493775c3192.tar.gz
uGFX-a02c124940b6c5d61ffcbfb2c7e4d493775c3192.tar.bz2
uGFX-a02c124940b6c5d61ffcbfb2c7e4d493775c3192.zip
GIF image handling
GIF image handling Updates to Image structure to make memory accounting optional Add set image background color to handle animated transparency.
Diffstat (limited to 'include')
-rw-r--r--include/gdisp/image.h20
-rw-r--r--include/gdisp/options.h7
2 files changed, 26 insertions, 1 deletions
diff --git a/include/gdisp/image.h b/include/gdisp/image.h
index 49b10d42..99e51118 100644
--- a/include/gdisp/image.h
+++ b/include/gdisp/image.h
@@ -113,9 +113,13 @@ typedef struct gdispImageIO {
typedef struct gdispImage {
gdispImageType type; /* @< The image type */
gdispImageFlags flags; /* @< The image flags */
+ color_t bgcolor; /* @< The default background color */
coord_t width, height; /* @< The image dimensions */
gdispImageIO io; /* @< The image IO functions */
- uint32_t membytes; /* @< How much RAM has been allocated */
+ #if GDISP_NEED_IMAGE_ACCOUNTING
+ uint32_t memused; /* @< How much RAM is currently allocated */
+ uint32_t maxmemused; /* @< How much RAM has been allocated (maximum) */
+ #endif
const struct gdispImageHandlers * fns; /* @< Don't mess with this! */
struct gdispImagePrivate * priv; /* @< Don't mess with this! */
} gdispImage;
@@ -176,6 +180,7 @@ extern "C" {
*
* @note This determines which decoder to use and then initialises all other fields
* in the gdispImage structure.
+ * @note The image background color is set to White.
* @note There are three types of return - everything OK, partial success and unrecoverable
* failures. For everything OK it returns GDISP_IMAGE_ERR_OK. A partial success can
* be distinguished from a unrecoverable failure by testing the GDISP_IMAGE_ERR_UNRECOVERABLE
@@ -197,6 +202,19 @@ extern "C" {
* @note Also calls the IO close function (if it hasn't already been called).
*/
void gdispImageClose(gdispImage *img);
+
+ /**
+ * @brief Set the background color of the image.
+ *
+ * @param[in] img The image structure
+ * @param[in] bgcolor The background color to use
+ *
+ * @pre gdispImageOpen() must have returned successfully.
+ *
+ * @note This color is only used when an image has to restore part of the background before
+ * continuing with drawing that includes transparency eg some GIF animations.
+ */
+ void gdispImageSetBgColor(gdispImage *img, color_t bgcolor);
/**
* @brief Cache the image
diff --git a/include/gdisp/options.h b/include/gdisp/options.h
index deacc036..5cdfbf59 100644
--- a/include/gdisp/options.h
+++ b/include/gdisp/options.h
@@ -186,6 +186,13 @@
#ifndef GDISP_NEED_IMAGE_PNG
#define GDISP_NEED_IMAGE_PNG FALSE
#endif
+ /**
+ * @brief Is memory accounting required during image decoding.
+ * @details Defaults to FALSE
+ */
+ #ifndef GDISP_NEED_IMAGE_ACCOUNTING
+ #define GDISP_NEED_IMAGE_ACCOUNTING FALSE
+ #endif
/**
* @}
*