diff options
author | inmarket <andrewh@inmarket.com.au> | 2018-06-23 13:02:07 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2018-06-23 13:02:07 +1000 |
commit | 41271d632b74f5cf47c30d3b699eb6b2786f2136 (patch) | |
tree | 78bcb729c6d6177ca598f28908fefd186c50e9b6 /src/gdisp | |
parent | 3b97fb798e96514057bcf17263c1e5dbdcd7da26 (diff) | |
download | uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.tar.gz uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.tar.bz2 uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.zip |
Added new type definitions - moving towards V3.0
Diffstat (limited to 'src/gdisp')
-rw-r--r-- | src/gdisp/gdisp.c | 22 | ||||
-rw-r--r-- | src/gdisp/gdisp.h | 16 | ||||
-rw-r--r-- | src/gdisp/gdisp_driver.h | 8 | ||||
-rw-r--r-- | src/gdisp/gdisp_fonts.c | 12 | ||||
-rw-r--r-- | src/gdisp/gdisp_image.c | 12 | ||||
-rw-r--r-- | src/gdisp/gdisp_image.h | 402 | ||||
-rw-r--r-- | src/gdisp/gdisp_image_bmp.c | 10 | ||||
-rw-r--r-- | src/gdisp/gdisp_image_png.c | 90 | ||||
-rw-r--r-- | src/gdisp/gdisp_image_support.h | 16 | ||||
-rw-r--r-- | src/gdisp/gdisp_pixmap.c | 6 | ||||
-rw-r--r-- | src/gdisp/gdisp_pixmap.h | 96 |
11 files changed, 329 insertions, 361 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index f1df787a..38edda9c 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -501,7 +501,7 @@ static void line_clip(GDisplay *g) { } #if GDISP_STARTUP_LOGO_TIMEOUT > 0 - static bool_t gdispInitDone; + static gBool gdispInitDone; static void StartupLogoDisplay(GDisplay *g) { coord_t x, y, w; const coord_t * p; @@ -604,14 +604,14 @@ void _gdispInit(void) #endif } - gdispInitDone = TRUE; + gdispInitDone = gTrue; } #endif // Start the automatic timer flush (if required) #if GDISP_NEED_TIMERFLUSH gtimerInit(&FlushTimer); - gtimerStart(&FlushTimer, FlushTimerFn, 0, TRUE, GDISP_NEED_TIMERFLUSH); + gtimerStart(&FlushTimer, FlushTimerFn, 0, gTrue, GDISP_NEED_TIMERFLUSH); #endif } @@ -620,9 +620,9 @@ void _gdispDeinit(void) /* ToDo */ } -bool_t _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { +gBool _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { #define gd ((GDisplay *)g) - bool_t ret; + gBool ret; // Intialise fields gd->systemdisplay = systeminstance; @@ -3150,7 +3150,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co return; } - void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round) { + void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, gBool round) { coord_t dx, dy, nx = 0, ny = 0; /* Compute the direction vector for the line */ @@ -3345,21 +3345,21 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co (void) count; ((coord_t*)state)[0]++; - return TRUE; + return gTrue; } static bool mf_drawline_callback(mf_str line, uint16_t count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, drawcharglyph, state); GD->t.wrapy += GD->t.font->line_height; #undef GD - return TRUE; + return gTrue; } static bool mf_fillline_callback(mf_str line, uint16_t count, void *state) { #define GD ((GDisplay *)state) mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, fillcharglyph, state); GD->t.wrapy += GD->t.font->line_height; #undef GD - return TRUE; + return gTrue; } #endif @@ -3638,9 +3638,9 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co // No mutex required as we only read static data #if GDISP_NEED_TEXT_KERNING - return mf_get_string_width(font, str, count, TRUE); + return mf_get_string_width(font, str, count, gTrue); #else - return mf_get_string_width(font, str, count, FALSE); + return mf_get_string_width(font, str, count, gFalse); #endif } diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h index 5bf2b284..587c3115 100644 --- a/src/gdisp/gdisp.h +++ b/src/gdisp/gdisp.h @@ -225,10 +225,6 @@ extern GDisplay *GDISP; */ typedef color_t pixel_t; -#ifdef __cplusplus -extern "C" { -#endif - /* Color Utility Functions */ /** @@ -445,7 +441,7 @@ void gdispGFillArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, c * non-byte boundary (no end-of-line padding). * @note If GDISP_NEED_ASYNC is defined then the buffer must be static * or at least retained until this call has finished the blit. You can - * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. + * tell when all graphics drawing is finished by @p gdispIsBusy() going gFalse. * * @param[in] g The display to use * @param[in] x,y The start position @@ -902,7 +898,7 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co * * @api */ - void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, bool_t round); + void gdispGDrawThickLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color, coord_t width, gBool round); #define gdispDrawThickLine(x0,y0,x1,y1,c,w,r) gdispGDrawThickLine(GDISP,x0,y0,x1,y1,c,w,r) #endif @@ -1109,14 +1105,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co /** * @brief Add a font permanently to the font list. - * @returns TRUE on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM. + * @returns gTrue on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM. * @pre GDISP_NEED_TEXT must be GFXON in your gfxconf.h * * @param[in] font The font to add to the font list. * * @api */ - bool_t gdispAddFont(font_t font); + gBool gdispAddFont(font_t font); #endif /* Extra Arc Functions */ @@ -1225,10 +1221,6 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #define gdispGUnsetClip(g) gdispGSetClip((g),0,0,gdispGGetWidth(g),gdispGGetHeight(g)) #define gdispUnsetClip() gdispGUnsetClip(GDISP) -#ifdef __cplusplus -} -#endif - #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) #include "gdisp_image.h" #endif diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h index 14e019ff..dffce58d 100644 --- a/src/gdisp/gdisp_driver.h +++ b/src/gdisp/gdisp_driver.h @@ -383,7 +383,7 @@ typedef struct GDISPVMT { GDriverVMT d; #define GDISP_VFLG_DYNAMICONLY 0x0001 // This display should never be statically initialised #define GDISP_VFLG_PIXMAP 0x0002 // This is a pixmap display - bool_t (*init)(GDisplay *g); + gBool (*init)(GDisplay *g); void (*deinit)(GDisplay *g); void (*writestart)(GDisplay *g); // Uses p.x,p.y p.cx,p.cy void (*writepos)(GDisplay *g); // Uses p.x,p.y @@ -421,11 +421,11 @@ typedef struct GDISPVMT { /** * @brief Initialize the driver. - * @return TRUE if successful. + * @return gTrue if successful. * @param[in] g The driver structure * @param[out] g->g The driver must fill in the GDISPControl structure */ - LLDSPEC bool_t gdisp_lld_init(GDisplay *g); + LLDSPEC gBool gdisp_lld_init(GDisplay *g); #if GDISP_HARDWARE_DEINIT || defined(__DOXYGEN__) /** @@ -724,7 +724,7 @@ typedef struct GDISPVMT { #ifdef __cplusplus extern "C" { #endif - bool_t _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); + gBool _gdispInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); void _gdispPostInitDriver(GDriver *g); void _gdispDeInitDriver(GDriver *g); #ifdef __cplusplus diff --git a/src/gdisp/gdisp_fonts.c b/src/gdisp/gdisp_fonts.c index 36e8f73f..a217c4d9 100644 --- a/src/gdisp/gdisp_fonts.c +++ b/src/gdisp/gdisp_fonts.c @@ -19,7 +19,7 @@ static const struct mf_font_list_s *fontList; /** * Match a pattern against the font name. */ -static bool_t matchfont(const char *pattern, const char *name) { +static gBool matchfont(const char *pattern, const char *name) { while(1) { switch (pattern[0]) { case '*': @@ -34,7 +34,7 @@ static bool_t matchfont(const char *pattern, const char *name) { return name[0] == 0; default: if (name[0] != pattern[0]) - return FALSE; + return gFalse; pattern++; name++; break; @@ -90,14 +90,14 @@ const char *gdispGetFontName(font_t font) { return font->short_name; } -bool_t gdispAddFont(font_t font) { +gBool gdispAddFont(font_t font) { struct mf_font_list_s *hdr; if ((font->flags & (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) != (FONT_FLAG_DYNAMIC|FONT_FLAG_UNLISTED)) - return FALSE; + return gFalse; if (!(hdr = gfxAlloc(sizeof(struct mf_font_list_s)))) - return FALSE; + return gFalse; if (!fontList) fontList = mf_get_font_list(); @@ -105,7 +105,7 @@ bool_t gdispAddFont(font_t font) { hdr->next = fontList; ((struct mf_font_s *)font)->flags &= ~FONT_FLAG_UNLISTED; fontList = hdr; - return TRUE; + return gTrue; } #endif /* GFX_USE_GDISP && GDISP_NEED_TEXT */ diff --git a/src/gdisp/gdisp_image.c b/src/gdisp/gdisp_image.c index cc137209..ae6a1a77 100644 --- a/src/gdisp/gdisp_image.c +++ b/src/gdisp/gdisp_image.c @@ -35,7 +35,7 @@ extern delaytime_t gdispImageNext_BMP(gdispImage *img); extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img); extern color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index); - extern bool_t gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor); + extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor); #endif #if GDISP_NEED_IMAGE_JPG @@ -67,7 +67,7 @@ typedef struct gdispImageHandlers { delaytime_t (*next)(gdispImage *img); /* The next frame function */ uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */ color_t (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */ - bool_t (*adjustPalette)(gdispImage *img, uint16_t index, color_t newColor); /* Replace a color value in the palette */ + gBool (*adjustPalette)(gdispImage *img, uint16_t index, color_t newColor); /* Replace a color value in the palette */ } gdispImageHandlers; static gdispImageHandlers ImageHandlers[] = { @@ -154,7 +154,7 @@ void gdispImageClose(gdispImage *img) { img->priv = 0; } -bool_t gdispImageIsOpen(gdispImage *img) { +gBool gdispImageIsOpen(gdispImage *img) { return img && img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0; } @@ -204,9 +204,9 @@ color_t gdispImageGetPalette(gdispImage *img, uint16_t index) { return img->fns->getPalette(img, index); } -bool_t gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor) { - if (!img || !img->fns) return FALSE; - if (!img->fns->adjustPalette) return FALSE; +gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor) { + if (!img || !img->fns) return gFalse; + if (!img->fns->adjustPalette) return gFalse; return img->fns->adjustPalette(img, index, newColor); } diff --git a/src/gdisp/gdisp_image.h b/src/gdisp/gdisp_image.h index 4cd348cf..99391850 100644 --- a/src/gdisp/gdisp_image.h +++ b/src/gdisp/gdisp_image.h @@ -70,224 +70,216 @@ typedef struct gdispImage { void * priv; /* @< Don't mess with this! */ } gdispImage; -#ifdef __cplusplus -extern "C" { -#endif - - /** - * @brief Initialise a gdispImage object - * - * @param[in] img The image structure to initialise - * - */ - void gdispImageInit(gdispImage *img); - - /** - * @brief Open an image using an open GFILE and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] img The image structure - * @param[in] f The open GFILE stream. - * - * @pre The GFILE must be open for reading. - * - * @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 - * bit in the error code. - * A partial success return code means an image can still be drawn but perhaps with - * reduced functionality eg only the first page of a multi-page image. - * @note @p gdispImageClose() should be called when finished with the image. This will close - * the image and its underlying GFILE file. Note that images opened with partial success - * (eg GDISP_IMAGE_ERR_UNSUPPORTED_OK) - * still need to be closed when you are finished with them. - */ - gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f); +/** + * @brief Initialise a gdispImage object + * + * @param[in] img The image structure to initialise + * + */ +void gdispImageInit(gdispImage *img); - /** - * @brief Open an image in a file and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre You must have included the file-system support into GFILE that you want to use. - * - * @param[in] img The image structure - * @param[in] filename The filename to open - * - * @note This function just opens the GFILE using the filename and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenFile(img, filename) gdispImageOpenGFile((img), gfileOpen((filename), "rb")) +/** + * @brief Open an image using an open GFILE and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] img The image structure + * @param[in] f The open GFILE stream. + * + * @pre The GFILE must be open for reading. + * + * @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 + * bit in the error code. + * A partial success return code means an image can still be drawn but perhaps with + * reduced functionality eg only the first page of a multi-page image. + * @note @p gdispImageClose() should be called when finished with the image. This will close + * the image and its underlying GFILE file. Note that images opened with partial success + * (eg GDISP_IMAGE_ERR_UNSUPPORTED_OK) + * still need to be closed when you are finished with them. + */ +gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f); - /** - * @brief Open an image in a ChibiOS basefilestream and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON. This only makes sense on the ChibiOS - * operating system. - * - * @param[in] img The image structure - * @param[in] BaseFileStreamPtr A pointer to an open BaseFileStream - * - * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenBaseFileStream(img, BaseFileStreamPtr) gdispImageOpenGFile((img), gfileOpenBaseFileStream((BaseFileStreamPtr), "rb")) +/** + * @brief Open an image in a file and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre You must have included the file-system support into GFILE that you want to use. + * + * @param[in] img The image structure + * @param[in] filename The filename to open + * + * @note This function just opens the GFILE using the filename and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenFile(img, filename) gdispImageOpenGFile((img), gfileOpen((filename), "rb")) - /** - * @brief Open an image in memory and get it ready for drawing - * @details Determine the image format and get ready to decode the first image frame - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @pre GFILE_NEED_MEMFS must be GFXON - * - * @param[in] img The image structure - * @param[in] ptr A pointer to the image bytes in memory - * - * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). - */ - #define gdispImageOpenMemory(img, ptr) gdispImageOpenGFile((img), gfileOpenMemory((void *)(ptr), "rb")) +/** + * @brief Open an image in a ChibiOS basefilestream and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON. This only makes sense on the ChibiOS + * operating system. + * + * @param[in] img The image structure + * @param[in] BaseFileStreamPtr A pointer to an open BaseFileStream + * + * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenBaseFileStream(img, BaseFileStreamPtr) gdispImageOpenGFile((img), gfileOpenBaseFileStream((BaseFileStreamPtr), "rb")) - /** - * @brief Close an image and release any dynamically allocated working storage. - * - * @param[in] img The image structure - * - * @pre gdispImageOpenFile() must have returned successfully. - * - * @note Also calls the IO close function (if it hasn't already been called). - */ - void gdispImageClose(gdispImage *img); +/** + * @brief Open an image in memory and get it ready for drawing + * @details Determine the image format and get ready to decode the first image frame + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @pre GFILE_NEED_MEMFS must be GFXON + * + * @param[in] img The image structure + * @param[in] ptr A pointer to the image bytes in memory + * + * @note This function just opens the GFILE using the basefilestream and passes it to @p gdispImageOpenGFile(). + */ +#define gdispImageOpenMemory(img, ptr) gdispImageOpenGFile((img), gfileOpenMemory((void *)(ptr), "rb")) - /** - * @brief Is an image open. - * @return TRUE if the image is currently open. - * - * @param[in] img The image structure - * - * @note Be careful with calling this on an uninitialized image structure as the image - * will contain random data which may be interpreted as meaning the image - * is open. Clearing the Image structure to 0's will guarantee the image - * is seen as being closed. - */ - bool_t gdispImageIsOpen(gdispImage *img); +/** + * @brief Close an image and release any dynamically allocated working storage. + * + * @param[in] img The image structure + * + * @pre gdispImageOpenFile() must have returned successfully. + * + * @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 Is an image open. + * @return gTrue if the image is currently open. + * + * @param[in] img The image structure + * + * @note Be careful with calling this on an uninitialized image structure as the image + * will contain random data which may be interpreted as meaning the image + * is open. Clearing the Image structure to 0's will guarantee the image + * is seen as being closed. + */ +gBool gdispImageIsOpen(gdispImage *img); - /** - * @brief Cache the image - * @details Decodes and caches the current frame into RAM. - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note This can use a LOT of RAM! - * @note The decoder may choose to ignore the request for caching. If it does so it will - * return GDISP_IMAGE_ERR_UNSUPPORTED_OK. - * @note A fatal error here does not necessarily mean that drawing the image will fail. For - * example, a GDISP_IMAGE_ERR_NOMEMORY error simply means there isn't enough RAM to - * cache the image. - */ - gdispImageError gdispImageCache(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 Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] g The display to draw on - * @param[in] img The image structure - * @param[in] x,y The screen location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - */ - gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); - #define gdispImageDraw(img,x,y,cx,cy,sx,sy) gdispGImageDraw(GDISP,img,x,y,cx,cy,sx,sy) +/** + * @brief Cache the image + * @details Decodes and caches the current frame into RAM. + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note This can use a LOT of RAM! + * @note The decoder may choose to ignore the request for caching. If it does so it will + * return GDISP_IMAGE_ERR_UNSUPPORTED_OK. + * @note A fatal error here does not necessarily mean that drawing the image will fail. For + * example, a GDISP_IMAGE_ERR_NOMEMORY error simply means there isn't enough RAM to + * cache the image. + */ +gdispImageError gdispImageCache(gdispImage *img); - /** - * @brief Prepare for the next frame/page in the image file. - * @return A time in milliseconds to keep displaying the current frame before trying to draw - * the next frame. Watch out for the special values TIME_IMMEDIATE and TIME_INFINITE. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note It will return TIME_IMMEDIATE if the first frame/page hasn't been drawn or if the next frame - * should be drawn immediately. - * @note It will return TIME_INFINITE if another image frame doesn't exist or an error has occurred. - * @note Images that support multiple pages (eg TIFF files) will return TIME_IMMEDIATE between pages - * and then TIME_INFINITE when there are no more pages. - * @note An image that displays a looped animation will never return TIME_INFINITE unless it - * gets an error. - * @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first - * frame/page. - */ - delaytime_t gdispImageNext(gdispImage *img); +/** + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] g The display to draw on + * @param[in] img The image structure + * @param[in] x,y The screen location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) + */ +gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); +#define gdispImageDraw(img,x,y,cx,cy,sx,sy) gdispGImageDraw(GDISP,img,x,y,cx,cy,sx,sy) - /** - * @brief Get the number of entries in the color palette. - * @return The number of entries in the color palette or 0 if the image doesn't use a color palette. - * - * @param[in] img The image structure - * - * @pre gdispImageOpen() must have returned successfully. - */ - uint16_t gdispImageGetPaletteSize(gdispImage *img); +/** + * @brief Prepare for the next frame/page in the image file. + * @return A time in milliseconds to keep displaying the current frame before trying to draw + * the next frame. Watch out for the special values TIME_IMMEDIATE and TIME_INFINITE. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note It will return TIME_IMMEDIATE if the first frame/page hasn't been drawn or if the next frame + * should be drawn immediately. + * @note It will return TIME_INFINITE if another image frame doesn't exist or an error has occurred. + * @note Images that support multiple pages (eg TIFF files) will return TIME_IMMEDIATE between pages + * and then TIME_INFINITE when there are no more pages. + * @note An image that displays a looped animation will never return TIME_INFINITE unless it + * gets an error. + * @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first + * frame/page. + */ +delaytime_t gdispImageNext(gdispImage *img); - /** - * @brief Get an entry in the color palette. - * @return The color value at a given position in the color palette. - * - * @param[in] img The image structure - * @param[in] index The index of the color palette entry - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. - */ - color_t gdispImageGetPalette(gdispImage *img, uint16_t index); +/** + * @brief Get the number of entries in the color palette. + * @return The number of entries in the color palette or 0 if the image doesn't use a color palette. + * + * @param[in] img The image structure + * + * @pre gdispImageOpen() must have returned successfully. + */ +uint16_t gdispImageGetPaletteSize(gdispImage *img); - /** - * @brief Modify an entry in the color palette. - * @return @p TRUE on success, @p FALSE otherwise. - * - * @param[in] img The image structure - * @param[in] index The index of the color palette entry - * @param[in] newColor The new color value of the specified entry - * - * @pre gdispImageOpen() must have returned successfully. - * @note This function will return @p FALSE if the index is out of bounds or if the image doesn't use a color palette. - */ - bool_t gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor); +/** + * @brief Get an entry in the color palette. + * @return The color value at a given position in the color palette. + * + * @param[in] img The image structure + * @param[in] index The index of the color palette entry + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette. + */ +color_t gdispImageGetPalette(gdispImage *img, uint16_t index); -#ifdef __cplusplus -} -#endif +/** + * @brief Modify an entry in the color palette. + * @return @p gTrue on success, @p gFalse otherwise. + * + * @param[in] img The image structure + * @param[in] index The index of the color palette entry + * @param[in] newColor The new color value of the specified entry + * + * @pre gdispImageOpen() must have returned successfully. + * @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette. + */ +gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, color_t newColor); #endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */ #endif /* _GDISP_IMAGE_H */ diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c index 02ae8da4..2cb00853 100644 --- a/src/gdisp/gdisp_image_bmp.c +++ b/src/gdisp/gdisp_image_bmp.c @@ -860,23 +860,23 @@ color_t gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) { #endif } -bool_t gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor) { +gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, color_t newColor) { #if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8 gdispImagePrivate_BMP *priv; priv = (gdispImagePrivate_BMP *)img->priv; if (!priv) - return FALSE; + return gFalse; if (!(priv->bmpflags & BMP_PALETTE)) - return FALSE; + return gFalse; if (index >= priv->palsize) - return FALSE; + return gFalse; priv->palette[(uint8_t)index] = newColor; - return TRUE; + return gTrue; #else return 0; diff --git a/src/gdisp/gdisp_image_png.c b/src/gdisp/gdisp_image_png.c index 822c7002..8032ffe6 100644 --- a/src/gdisp/gdisp_image_png.c +++ b/src/gdisp/gdisp_image_png.c @@ -138,16 +138,16 @@ static void PNG_iInit(PNG_decode *d) { } // Load the next byte of image data from the PNG file -static bool_t PNG_iLoadData(PNG_decode *d) { +static gBool PNG_iLoadData(PNG_decode *d) { uint32_t sz; // Is there data still left in the buffer? if (d->i.buflen) - return TRUE; + return gTrue; // If we are cached then we have no more data if (!d->i.f) - return FALSE; + return gFalse; // Have we finished the current chunk? if (!d->i.chunklen) { @@ -155,7 +155,7 @@ static bool_t PNG_iLoadData(PNG_decode *d) { // Find a new chunk gfileSetPos(d->i.f, d->i.chunknext); if (gfileRead(d->i.f, d->i.buf, 8) != 8) - return FALSE; + return gFalse; // Calculate the chunk length and next chunk d->i.chunklen = gdispImageGetAlignedBE32(d->i.buf, 0); @@ -168,7 +168,7 @@ static bool_t PNG_iLoadData(PNG_decode *d) { break; goto gotchunk; case 0x49454E44: // "IEND" - All done - return FALSE; + return gFalse; } } } @@ -180,11 +180,11 @@ gotchunk: if (sz > GDISP_IMAGE_PNG_FILE_BUFFER_SIZE) sz = GDISP_IMAGE_PNG_FILE_BUFFER_SIZE; if (gfileRead(d->i.f, d->i.buf, sz) != sz) - return FALSE; + return gFalse; d->i.chunklen -= sz; d->i.buflen = sz; d->i.pbuf = d->i.buf; - return TRUE; + return gTrue; } // Get the last loaded byte of image data from the PNG file @@ -222,12 +222,12 @@ static void PNG_oFlush(PNG_output *o) { } // Start a new image line -static bool_t PNG_oStartY(PNG_output *o, coord_t y) { +static gBool PNG_oStartY(PNG_output *o, coord_t y) { if (y < o->sy || y >= o->sy+o->cy) - return FALSE; + return gFalse; o->ix = 0; o->iy = y; - return TRUE; + return gTrue; } // Feed a pixel color to the display buffer @@ -283,18 +283,18 @@ static void PNG_zInit(PNG_zinflate *z) { } // Get the inflate header (slightly customized for PNG validity testing) -static bool_t PNG_zGetHeader(PNG_decode *d) { +static gBool PNG_zGetHeader(PNG_decode *d) { if (!PNG_iLoadData(d)) - return FALSE; + return gFalse; d->z.tmp[0] = PNG_iGetByte(d); if (!PNG_iLoadData(d)) - return FALSE; + return gFalse; d->z.tmp[1] = PNG_iGetByte(d); if (gdispImageGetAlignedBE16(d->z.tmp, 0) % 31 != 0 // Must be modulo 31, the FCHECK value is made that way || (d->z.tmp[0] & 0x0F) != 8 || (d->z.tmp[0] & 0x80) // only method 8: inflate 32k sliding window || (d->z.tmp[1] & 0x20)) // no preset dictionary - return FALSE; - return TRUE; + return gFalse; + return gTrue; } // Get a bit from the input (treated as a LSB first stream) @@ -400,7 +400,7 @@ static void PNG_zBuildFixedTrees(PNG_decode *d) { } // Build inflate dynamic length and distance trees -static bool_t PNG_zDecodeTrees(PNG_decode *d) { +static gBool PNG_zDecodeTrees(PNG_decode *d) { static const uint8_t IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; unsigned hlit, hdist, hclen; unsigned i, num; @@ -412,7 +412,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { hclen = PNG_zGetBits(d, 4) + 4; // 4 - 19 if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; for (i = 0; i < 19; ++i) d->z.tmp[i] = 0; @@ -422,7 +422,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { d->z.tmp[IndexLookup[i]] = PNG_zGetBits(d, 3); if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; // Build the code length tree PNG_zBuildTree(&d->z.ltree, d->z.tmp, 19); @@ -431,7 +431,7 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { for (num = 0; num < hlit + hdist; ) { symbol = PNG_zGetSymbol(d, &d->z.ltree); if ((d->z.flags & PNG_ZFLG_EOF)) - return FALSE; + return gFalse; switch(symbol) { case 16: // Copy the previous code length 3-6 times @@ -456,33 +456,33 @@ static bool_t PNG_zDecodeTrees(PNG_decode *d) { // Build the trees PNG_zBuildTree(&d->z.ltree, d->z.tmp, hlit); PNG_zBuildTree(&d->z.dtree, d->z.tmp + hlit, hdist); - return TRUE; + return gTrue; } // Copy bytes from the input stream. Completing the copy completes the block. -static bool_t PNG_zCopyInput(PNG_decode *d, unsigned length) { +static gBool PNG_zCopyInput(PNG_decode *d, unsigned length) { // Copy the block while(length--) { if (!PNG_iLoadData(d)) { // EOF? d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } d->z.buf[d->z.bufend++] = PNG_iGetByte(d); WRAP_ZBUF(d->z.bufend); if (d->z.bufend == d->z.bufpos) { // Buffer full? d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_COPY; ((unsigned *)d->z.tmp)[0] = length; - return TRUE; + return gTrue; } } // The block is done d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_NEW; - return TRUE; + return gTrue; } // Copy an uncompressed inflate block into the output -static bool_t PNG_zUncompressedBlock(PNG_decode *d) { +static gBool PNG_zUncompressedBlock(PNG_decode *d) { unsigned length; // This block works on byte boundaries @@ -492,7 +492,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { for (length = 0; length < 4; length++) { if (!PNG_iLoadData(d)) { // EOF? d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } d->z.tmp[length] = PNG_iGetByte(d); } @@ -503,7 +503,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { // Check length if ((uint16_t)length != (uint16_t)~gdispImageGetAlignedLE16(d->z.tmp, 2)) { d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } // Copy the block @@ -511,7 +511,7 @@ static bool_t PNG_zUncompressedBlock(PNG_decode *d) { } // Inflate a compressed inflate block into the output -static bool_t PNG_zInflateBlock(PNG_decode *d) { +static gBool PNG_zInflateBlock(PNG_decode *d) { static const uint8_t lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 }; static const uint16_t lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 }; static const uint8_t dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 }; @@ -527,7 +527,7 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { // Is the block done? if (symbol == 256) { d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_NEW; - return TRUE; + return gTrue; } if (symbol < 256) { @@ -536,7 +536,7 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { WRAP_ZBUF(d->z.bufend); if (d->z.bufend == d->z.bufpos) { // Buffer full? d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_INFLATE; - return TRUE; + return gTrue; } continue; } @@ -576,21 +576,21 @@ static bool_t PNG_zInflateBlock(PNG_decode *d) { d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET; ((unsigned *)d->z.tmp)[0] = length; ((unsigned *)d->z.tmp)[1] = offset; - return TRUE; + return gTrue; } } } iserror: d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } // Start a new uncompressed/inflate block -static bool_t PNG_zStartBlock(PNG_decode *d) { +static gBool PNG_zStartBlock(PNG_decode *d) { // Check for previous error, EOF or no more blocks if ((d->z.flags & (PNG_ZFLG_EOF|PNG_ZFLG_FINAL))) - return FALSE; + return gFalse; // Is this the final inflate block? if (PNG_zGetBit(d)) @@ -601,32 +601,32 @@ static bool_t PNG_zStartBlock(PNG_decode *d) { case 0: // Decompress uncompressed block if (!PNG_zUncompressedBlock(d)) - return FALSE; + return gFalse; break; case 1: // Decompress block with fixed huffman trees PNG_zBuildFixedTrees(d); if (!PNG_zInflateBlock(d)) - return FALSE; + return gFalse; break; case 2: // Decompress block with dynamic huffman trees if (!PNG_zDecodeTrees(d)) - return FALSE; + return gFalse; if (!PNG_zInflateBlock(d)) - return FALSE; + return gFalse; break; default: // Bad block type // Mark it as an error d->z.flags |= PNG_ZFLG_EOF; - return FALSE; + return gFalse; } - return TRUE; + return gTrue; } // Resume an offset copy -static bool_t PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) { +static gBool PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) { // Copy the matching string while (length--) { d->z.buf[d->z.bufend++] = d->z.buf[offset++]; @@ -636,7 +636,7 @@ static bool_t PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset) d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_OFFSET; ((unsigned *)d->z.tmp)[0] = length; ((unsigned *)d->z.tmp)[1] = offset; - return TRUE; + return gTrue; } } return PNG_zInflateBlock(d); @@ -720,14 +720,14 @@ static uint8_t PNG_fCalcPath(uint16_t a, uint16_t b, uint16_t c) { } // Scan-line filter type 0 -static bool_t PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 +static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 uint8_t ft; unsigned i; // Get the filter type and check for validity (eg not EOF) ft = PNG_zGetByte(d); if (ft > 0x04) - return FALSE; + return gFalse; // Uncompress the scan line for(i = 0; i < d->f.scanbytes; i++) @@ -770,7 +770,7 @@ static bool_t PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0 break; } - return TRUE; + return gTrue; } /*----------------------------------------------------------------- diff --git a/src/gdisp/gdisp_image_support.h b/src/gdisp/gdisp_image_support.h index 9fefd3d6..ab636dae 100644 --- a/src/gdisp/gdisp_image_support.h +++ b/src/gdisp/gdisp_image_support.h @@ -120,19 +120,11 @@ #endif -#ifdef __cplusplus -extern "C" { -#endif - - void *gdispImageAlloc(gdispImage *img, size_t sz); - void gdispImageFree(gdispImage *img, void *ptr, size_t sz); - - #if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN - extern const uint8_t gdispImageEndianArray[4]; - #endif +void *gdispImageAlloc(gdispImage *img, size_t sz); +void gdispImageFree(gdispImage *img, void *ptr, size_t sz); -#ifdef __cplusplus -} +#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN + extern const uint8_t gdispImageEndianArray[4]; #endif #endif /* _GDISP_IMAGE_SUPPORT_H */ diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c index 45dee66b..88bd57a3 100644 --- a/src/gdisp/gdisp_pixmap.c +++ b/src/gdisp/gdisp_pixmap.c @@ -110,11 +110,11 @@ pixel_t *gdispPixmapGetBits(GDisplay *g) { /* Driver exported functions. */ /*===========================================================================*/ -LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { +LLDSPEC gBool gdisp_lld_init(GDisplay *g) { // The user api function should have already allocated and initialised the pixmap // structure and put it into the priv member during driver initialisation. if (!g->priv) - return FALSE; + return gFalse; // Initialize the GDISP structure // Width and height were saved into the start of the framebuffer. @@ -126,7 +126,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Powermode = powerOn; g->board = 0; - return TRUE; + return gTrue; } LLDSPEC void gdisp_lld_deinit(GDisplay *g) { diff --git a/src/gdisp/gdisp_pixmap.h b/src/gdisp/gdisp_pixmap.h index ebf7e1db..4d5e8004 100644 --- a/src/gdisp/gdisp_pixmap.h +++ b/src/gdisp/gdisp_pixmap.h @@ -24,66 +24,58 @@ #if (GFX_USE_GDISP && GDISP_NEED_PIXMAP) || defined(__DOXYGEN__) -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create an off-screen pixmap that can be drawn to just like a normal display + * + * @param[in] width The width of the pixmap to be created + * @param[in] height The height of the pixmap to be created + * + * @return The created GDisplay representing the pixmap or 0 if the pixmap couldn't be created. + * + * @note Once created, an off-screen pixmap can be drawn on using the standard gdispGxxxx calls. + * @note It must be destroyed using @p gdispDeleteOffscreenPixmap + * @note Because the RAM for the display area is allocated, on small micros only very small pixmaps should be considered. + * For example a 100x100 at 16 bits per pixel would be 20K of RAM (plus some overheads). + */ +GDisplay *gdispPixmapCreate(coord_t width, coord_t height); - /** - * @brief Create an off-screen pixmap that can be drawn to just like a normal display - * - * @param[in] width The width of the pixmap to be created - * @param[in] height The height of the pixmap to be created - * - * @return The created GDisplay representing the pixmap or 0 if the pixmap couldn't be created. - * - * @note Once created, an off-screen pixmap can be drawn on using the standard gdispGxxxx calls. - * @note It must be destroyed using @p gdispDeleteOffscreenPixmap - * @note Because the RAM for the display area is allocated, on small micros only very small pixmaps should be considered. - * For example a 100x100 at 16 bits per pixel would be 20K of RAM (plus some overheads). - */ - GDisplay *gdispPixmapCreate(coord_t width, coord_t height); +/** + * @brief Destroy an off-screen pixmap + * + * @param[in] g The pixmap virtual display to delete + * + * @note If a normal display is passed to this routine, it will be ignored. + */ +void gdispPixmapDelete(GDisplay *g); - /** - * @brief Destroy an off-screen pixmap - * - * @param[in] g The pixmap virtual display to delete - * - * @note If a normal display is passed to this routine, it will be ignored. - */ - void gdispPixmapDelete(GDisplay *g); +/** + * @brief Get a pointer to the pixels of the display surface. + * @return The pointer to the pixmap display surface or NULL if this display is not a pixmap. + * + * @param[in] g The pixmap virtual display + * + * @note The pointer returned can be used for calls to @p gdispGBlitArea() or can be read or written to directly + * by the application code. For any one particular pixmap the pointer will not change over the life of the pixmap + * (although different pixmaps will have different pixel pointers). Once a pixmap is deleted, the pixel pointer + * should not be used by the application. + */ +pixel_t *gdispPixmapGetBits(GDisplay *g); +#if GDISP_NEED_PIXMAP_IMAGE || defined(__DOXYGEN__) /** - * @brief Get a pointer to the pixels of the display surface. - * @return The pointer to the pixmap display surface or NULL if this display is not a pixmap. + * @brief Get a pointer to a native format gdispImage. + * @return A pointer to a NATIVE format gdispImage in memory or NULL if this display is not a pixmap. + * @pre GDISP_NEED_PIXAMP_IMAGE must be GFXON in your gfxconf.h * * @param[in] g The pixmap virtual display * - * @note The pointer returned can be used for calls to @p gdispGBlitArea() or can be read or written to directly - * by the application code. For any one particular pixmap the pointer will not change over the life of the pixmap - * (although different pixmaps will have different pixel pointers). Once a pixmap is deleted, the pixel pointer - * should not be used by the application. + * @return The pointer to the native gdispImage + * + * @note The pointer returned can be passed to @p gdispImageOpenMemory() or to @p gfileOpenMemory(). + * @note If you are just wanting to copy to a real display it is more efficient to use @p gdispGetPixmapBits() and @p gdispGBlitArea(). + * @note Like @p gdispGetPixmapBits(), the pointer returned is valid for the life of the pixmap. */ - pixel_t *gdispPixmapGetBits(GDisplay *g); - - #if GDISP_NEED_PIXMAP_IMAGE || defined(__DOXYGEN__) - /** - * @brief Get a pointer to a native format gdispImage. - * @return A pointer to a NATIVE format gdispImage in memory or NULL if this display is not a pixmap. - * @pre GDISP_NEED_PIXAMP_IMAGE must be GFXON in your gfxconf.h - * - * @param[in] g The pixmap virtual display - * - * @return The pointer to the native gdispImage - * - * @note The pointer returned can be passed to @p gdispImageOpenMemory() or to @p gfileOpenMemory(). - * @note If you are just wanting to copy to a real display it is more efficient to use @p gdispGetPixmapBits() and @p gdispGBlitArea(). - * @note Like @p gdispGetPixmapBits(), the pointer returned is valid for the life of the pixmap. - */ - void *gdispPixmapGetMemoryImage(GDisplay *g); - #endif - -#ifdef __cplusplus -} + void *gdispPixmapGetMemoryImage(GDisplay *g); #endif #endif /* GFX_USE_GDISP && GDISP_NEED_PIXMAP */ |