Browse Source

Merge branch 'develop'

remotes/origin/master
Joel Bodenmann 3 years ago
parent
commit
39bde23dd9
  1. 1
      changelog.txt
  2. 2
      demos/3rdparty/notepad-2/notepadApp.c
  3. 2
      demos/applications/combo/main.c
  4. 6
      demos/games/justget10/jg10.c
  5. 2
      demos/games/minesweeper/mines.c
  6. 2
      demos/modules/gdisp/images/main.c
  7. 2
      demos/modules/gdisp/images_animated/main.c
  8. 2
      demos/modules/gdisp/images_palettes/main.c
  9. 2
      demos/modules/gwin/widgets/main.c
  10. 3
      src/gdisp/gdisp.h
  11. 98
      src/gdisp/gdisp_image.c
  12. 30
      src/gdisp/gdisp_image.h
  13. 18
      src/gdisp/gdisp_image_bmp.c
  14. 18
      src/gdisp/gdisp_image_gif.c
  15. 24
      src/gdisp/gdisp_image_jpg.c
  16. 14
      src/gdisp/gdisp_image_native.c
  17. 12
      src/gdisp/gdisp_image_png.c
  18. 4
      src/gdisp/gdisp_image_support.h
  19. 6
      src/gdisp/gdisp_pixmap.h
  20. 2
      src/gwin/gwin.c
  21. 2
      src/gwin/gwin.h
  22. 2
      src/gwin/gwin_button.c
  23. 2
      src/gwin/gwin_button.h
  24. 2
      src/gwin/gwin_container.c
  25. 2
      src/gwin/gwin_frame.c
  26. 2
      src/gwin/gwin_frame.h
  27. 2
      src/gwin/gwin_image.h
  28. 2
      src/gwin/gwin_list.c
  29. 4
      src/gwin/gwin_list.h
  30. 2
      src/gwin/gwin_progressbar.c
  31. 2
      src/gwin/gwin_slider.c
  32. 2
      src/gwin/gwin_tabset.c

1
changelog.txt

@ -22,6 +22,7 @@ CHANGE: Added type gThread to replace V2.x gfxThreadHandle and macros G
CHANGE: Added type gThreadreturn to replace V2.x threadreturn_t and pseudo function gfxThreadReturn() to replace THREAD_RETURN()
CHANGE: Added type gThreadpriority to replace V2.x threadpriority_t and values gThreadpriorityLow/Normal/High to replace LOW_/NORMAL_/HIGH_PRIORITY
CHANGE: Added type gPoint to replace V2.x point and point_t
CHANGE: Added type gImage to replace V2.x gdispImage
CHANGE: Added type gCoord to replace V2.x coord_t
CHANGE: Added type gPixel to replace V2.x pixel_t
CHANGE: Added type gColor to replace V2.x color_t

2
demos/3rdparty/notepad-2/notepadApp.c

@ -61,7 +61,7 @@ static GButtonObject btnClose;
/* static GButtonObject btnYes, btnNo; // Reserved for future use */
// Image object
static gdispImage toolbarImageFilmstrip;
static gImage toolbarImageFilmstrip;
static gColor myColors[] = { GFX_BLACK, GFX_RED, GFX_GREEN, GFX_BLUE, GFX_CYAN, GFX_MAGENTA, GFX_YELLOW, GFX_WHITE };

2
demos/applications/combo/main.c

@ -86,7 +86,7 @@ static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow;
static GHandle ghList1, ghList2, ghList3, ghList4;
static GHandle ghImage1;
static GHandle ghProgressbar1;
static gdispImage imgYesNo;
static gImage imgYesNo;
/* Some useful macros */
#define ScrWidth gdispGetWidth()

6
demos/games/justget10/jg10.c

@ -24,17 +24,17 @@ typedef struct { // Node properties
nodeProps jg10Field[JG10_FIELD_WIDTH][JG10_FIELD_HEIGHT]; // jg10 field array
gBool jg10GameOver = gFalse;
const char *jg10Graph[] = {"background.bmp", "1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "9.bmp", "10.bmp", "11.bmp", "12.bmp", "13.bmp", "14.bmp", "15.bmp", "16.bmp", "17.bmp", "18.bmp", "19.bmp", "20.bmp"}; // 21 elements (0-20)
gdispImage jg10Image[JG10_MAX_COUNT];
gImage jg10Image[JG10_MAX_COUNT];
#define JG10_ANIM_IMAGES 5
#define JG10_ANIM_DELAY 60
const char *jg10GraphAnim[] = {"a1.bmp","a2.bmp","a3.bmp","a4.bmp","background.bmp"}; // 5 elements (0-4)
gdispImage jg10ImageAnim[JG10_ANIM_IMAGES];
gImage jg10ImageAnim[JG10_ANIM_IMAGES];
gU8 jg10MaxVal=4; // Max value in field...
gFont font;
#if JG10_SHOW_SPLASH
GTimer jg10SplashBlink;
gBool jg10SplashTxtVisible = gFalse;
gdispImage jg10SplashImage;
gImage jg10SplashImage;
#endif

2
demos/games/minesweeper/mines.c

@ -19,7 +19,7 @@ static gI16 minesFlags; // Flag counter
static gI16 minesTime; // Time counter
static GTimer minesTimeCounterTimer;
static const char* minesGraph[] = {"1.bmp","2.bmp","3.bmp","4.bmp","5.bmp","6.bmp","7.bmp","8.bmp", "closed.bmp", "empty.bmp", "explode.bmp", "flag.bmp", "mine.bmp", "wrong.bmp"}; // 14 elements (0-13)
static gdispImage minesImage;
static gImage minesImage;
static gU8 minesStatusIconWidth = 0;
static gU8 minesStatusIconHeight = 0;
static gBool minesFirstGame = gTrue; // Just don't clear field for the first time, as we have black screen already... :/

2
demos/modules/gdisp/images/main.c

@ -36,7 +36,7 @@
* The ROMFS uses the file "romfs_files.h" to describe the set of files in the ROMFS.
*/
static gdispImage myImage;
static gImage myImage;
int main(void) {
gCoord swidth, sheight;

2
demos/modules/gdisp/images_animated/main.c

@ -39,7 +39,7 @@
#define USE_IMAGE_CACHE GFXOFF // 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
static gdispImage myImage;
static gImage myImage;
#define SHOW_ERROR(color) gdispFillArea(errx, erry, errcx, errcy, color)

2
demos/modules/gdisp/images_palettes/main.c

@ -40,7 +40,7 @@
#include "gfx.h"
static gdispImage _imgHome;
static gImage _imgHome;
int main(void)
{

2
demos/modules/gwin/widgets/main.c

@ -97,7 +97,7 @@ static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow;
static GHandle ghList1, ghList2, ghList3, ghList4;
static GHandle ghImage1;
static GHandle ghProgressbar1;
static gdispImage imgYesNo;
static gImage imgYesNo;
/* Some useful macros */
#define ScrWidth gdispGetWidth()

3
src/gdisp/gdisp.h

@ -1270,6 +1270,9 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#define fontMaxWidth gFontMaxWidth
#define fontBaselineX gFontBaselineX
#define fontBaselineY gFontBaselineY
#if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
typedef gImage gdispImage;
#endif
#endif
#endif /* GFX_USE_GDISP */

98
src/gdisp/gdisp_image.c

@ -12,62 +12,62 @@
#include "gdisp_image_support.h"
#if GDISP_NEED_IMAGE_NATIVE
extern gdispImageError gdispImageOpen_NATIVE(gdispImage *img);
extern void gdispImageClose_NATIVE(gdispImage *img);
extern gdispImageError gdispImageCache_NATIVE(gdispImage *img);
extern gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_NATIVE(gdispImage *img);
extern gdispImageError gdispImageOpen_NATIVE(gImage *img);
extern void gdispImageClose_NATIVE(gImage *img);
extern gdispImageError gdispImageCache_NATIVE(gImage *img);
extern gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_NATIVE(gImage *img);
#endif
#if GDISP_NEED_IMAGE_GIF
extern gdispImageError gdispImageOpen_GIF(gdispImage *img);
extern void gdispImageClose_GIF(gdispImage *img);
extern gdispImageError gdispImageCache_GIF(gdispImage *img);
extern gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_GIF(gdispImage *img);
extern gdispImageError gdispImageOpen_GIF(gImage *img);
extern void gdispImageClose_GIF(gImage *img);
extern gdispImageError gdispImageCache_GIF(gImage *img);
extern gdispImageError gdispGImageDraw_GIF(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_GIF(gImage *img);
#endif
#if GDISP_NEED_IMAGE_BMP
extern gdispImageError gdispImageOpen_BMP(gdispImage *img);
extern void gdispImageClose_BMP(gdispImage *img);
extern gdispImageError gdispImageCache_BMP(gdispImage *img);
extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_BMP(gdispImage *img);
extern gU16 gdispImageGetPaletteSize_BMP(gdispImage *img);
extern gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index);
extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, gU16 index, gColor newColor);
extern gdispImageError gdispImageOpen_BMP(gImage *img);
extern void gdispImageClose_BMP(gImage *img);
extern gdispImageError gdispImageCache_BMP(gImage *img);
extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_BMP(gImage *img);
extern gU16 gdispImageGetPaletteSize_BMP(gImage *img);
extern gColor gdispImageGetPalette_BMP(gImage *img, gU16 index);
extern gBool gdispImageAdjustPalette_BMP(gImage *img, gU16 index, gColor newColor);
#endif
#if GDISP_NEED_IMAGE_JPG
extern gdispImageError gdispImageOpen_JPG(gdispImage *img);
extern void gdispImageClose_JPG(gdispImage *img);
extern gdispImageError gdispImageCache_JPG(gdispImage *img);
extern gdispImageError gdispGImageDraw_JPG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_JPG(gdispImage *img);
extern gdispImageError gdispImageOpen_JPG(gImage *img);
extern void gdispImageClose_JPG(gImage *img);
extern gdispImageError gdispImageCache_JPG(gImage *img);
extern gdispImageError gdispGImageDraw_JPG(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_JPG(gImage *img);
#endif
#if GDISP_NEED_IMAGE_PNG
extern gdispImageError gdispImageOpen_PNG(gdispImage *img);
extern void gdispImageClose_PNG(gdispImage *img);
extern gdispImageError gdispImageCache_PNG(gdispImage *img);
extern gdispImageError gdispGImageDraw_PNG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_PNG(gdispImage *img);
extern gdispImageError gdispImageOpen_PNG(gImage *img);
extern void gdispImageClose_PNG(gImage *img);
extern gdispImageError gdispImageCache_PNG(gImage *img);
extern gdispImageError gdispGImageDraw_PNG(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_PNG(gImage *img);
#endif
/* The structure defining the routines for image drawing */
typedef struct gdispImageHandlers {
gdispImageError (*open)(gdispImage *img); /* The open function */
void (*close)(gdispImage *img); /* The close function */
gdispImageError (*cache)(gdispImage *img); /* The cache function */
gdispImageError (*open)(gImage *img); /* The open function */
void (*close)(gImage *img); /* The close function */
gdispImageError (*cache)(gImage *img); /* The cache function */
gdispImageError (*draw)(GDisplay *g,
gdispImage *img,
gImage *img,
gCoord x, gCoord y,
gCoord cx, gCoord cy,
gCoord sx, gCoord sy); /* The draw function */
gDelay (*next)(gdispImage *img); /* The next frame function */
gU16 (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */
gColor (*getPalette)(gdispImage *img, gU16 index); /* Retrieve a specific color value of the palette */
gBool (*adjustPalette)(gdispImage *img, gU16 index, gColor newColor); /* Replace a color value in the palette */
gDelay (*next)(gImage *img); /* The next frame function */
gU16 (*getPaletteSize)(gImage *img); /* Retrieve the size of the palette (number of entries) */
gColor (*getPalette)(gImage *img, gU16 index); /* Retrieve a specific color value of the palette */
gBool (*adjustPalette)(gImage *img, gU16 index, gColor newColor); /* Replace a color value in the palette */
} gdispImageHandlers;
static gdispImageHandlers ImageHandlers[] = {
@ -103,11 +103,11 @@ static gdispImageHandlers ImageHandlers[] = {
#endif
};
void gdispImageInit(gdispImage *img) {
void gdispImageInit(gImage *img) {
img->type = GDISP_IMAGE_TYPE_UNKNOWN;
}
gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f) {
gdispImageError gdispImageOpenGFile(gImage *img, GFILE *f) {
gdispImageError err;
if (!img)
@ -142,7 +142,7 @@ unrecoverable:
return err;
}
void gdispImageClose(gdispImage *img) {
void gdispImageClose(gImage *img) {
if (!img)
return;
if (img->fns)
@ -154,23 +154,23 @@ void gdispImageClose(gdispImage *img) {
img->priv = 0;
}
gBool gdispImageIsOpen(gdispImage *img) {
gBool gdispImageIsOpen(gImage *img) {
return img && img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0;
}
void gdispImageSetBgColor(gdispImage *img, gColor bgcolor) {
void gdispImageSetBgColor(gImage *img, gColor bgcolor) {
if (!img)
return;
img->bgcolor = bgcolor;
}
gdispImageError gdispImageCache(gdispImage *img) {
gdispImageError gdispImageCache(gImage *img) {
if (!img) return GDISP_IMAGE_ERR_NULLPOINTER;
if (!img->fns) return GDISP_IMAGE_ERR_BADFORMAT;
return img->fns->cache(img);
}
gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
if (!img) return GDISP_IMAGE_ERR_NULLPOINTER;
if (!img->fns) return GDISP_IMAGE_ERR_BADFORMAT;
@ -186,25 +186,25 @@ gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y
return img->fns->draw(g, img, x, y, cx, cy, sx, sy);
}
gDelay gdispImageNext(gdispImage *img) {
gDelay gdispImageNext(gImage *img) {
if (!img) return GDISP_IMAGE_ERR_NULLPOINTER;
if (!img->fns) return GDISP_IMAGE_ERR_BADFORMAT;
return img->fns->next(img);
}
gU16 gdispImageGetPaletteSize(gdispImage *img) {
gU16 gdispImageGetPaletteSize(gImage *img) {
if (!img || !img->fns) return 0;
if (!img->fns->getPaletteSize) return 0;
return img->fns->getPaletteSize(img);
}
gColor gdispImageGetPalette(gdispImage *img, gU16 index) {
gColor gdispImageGetPalette(gImage *img, gU16 index) {
if (!img || !img->fns) return 0;
if (!img->fns->getPalette) return 0;
return img->fns->getPalette(img, index);
}
gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor) {
gBool gdispImageAdjustPalette(gImage *img, gU16 index, gColor newColor) {
if (!img || !img->fns) return gFalse;
if (!img->fns->adjustPalette) return gFalse;
return img->fns->adjustPalette(img, index, newColor);
@ -212,7 +212,7 @@ gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor) {
// Helper Routines
void *gdispImageAlloc(gdispImage *img, gMemSize sz) {
void *gdispImageAlloc(gImage *img, gMemSize sz) {
#if GDISP_NEED_IMAGE_ACCOUNTING
void *ptr;
@ -229,7 +229,7 @@ void *gdispImageAlloc(gdispImage *img, gMemSize sz) {
#endif
}
void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz) {
void gdispImageFree(gImage *img, void *ptr, gMemSize sz) {
#if GDISP_NEED_IMAGE_ACCOUNTING
gfxFree(ptr);
img->memused -= sz;

30
src/gdisp/gdisp_image.h

@ -56,7 +56,7 @@ typedef gU16 gdispImageFlags;
/**
* @brief The structure for an image
*/
typedef struct gdispImage {
typedef struct gImage {
gdispImageType type; /* @< The image type */
gdispImageFlags flags; /* @< The image flags */
gColor bgcolor; /* @< The default background color */
@ -68,15 +68,15 @@ typedef struct gdispImage {
#endif
const struct gdispImageHandlers * fns; /* @< Don't mess with this! */
void * priv; /* @< Don't mess with this! */
} gdispImage;
} gImage;
/**
* @brief Initialise a gdispImage object
* @brief Initialise a gImage object
*
* @param[in] img The image structure to initialise
*
*/
void gdispImageInit(gdispImage *img);
void gdispImageInit(gImage *img);
/**
* @brief Open an image using an open GFILE and get it ready for drawing
@ -89,7 +89,7 @@ void gdispImageInit(gdispImage *img);
* @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.
* in the gImage 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
@ -102,7 +102,7 @@ void gdispImageInit(gdispImage *img);
* (eg GDISP_IMAGE_ERR_UNSUPPORTED_OK)
* still need to be closed when you are finished with them.
*/
gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f);
gdispImageError gdispImageOpenGFile(gImage *img, GFILE *f);
/**
* @brief Open an image in a file and get it ready for drawing
@ -156,7 +156,7 @@ gdispImageError gdispImageOpenGFile(gdispImage *img, GFILE *f);
*
* @note Also calls the IO close function (if it hasn't already been called).
*/
void gdispImageClose(gdispImage *img);
void gdispImageClose(gImage *img);
/**
* @brief Is an image open.
@ -169,7 +169,7 @@ void gdispImageClose(gdispImage *img);
* is open. Clearing the Image structure to 0's will guarantee the image
* is seen as being closed.
*/
gBool gdispImageIsOpen(gdispImage *img);
gBool gdispImageIsOpen(gImage *img);
/**
* @brief Set the background color of the image.
@ -182,7 +182,7 @@ gBool gdispImageIsOpen(gdispImage *img);
* @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, gColor bgcolor);
void gdispImageSetBgColor(gImage *img, gColor bgcolor);
/**
* @brief Cache the image
@ -200,7 +200,7 @@ void gdispImageSetBgColor(gdispImage *img, gColor bgcolor);
* example, a GDISP_IMAGE_ERR_NOMEMORY error simply means there isn't enough RAM to
* cache the image.
*/
gdispImageError gdispImageCache(gdispImage *img);
gdispImageError gdispImageCache(gImage *img);
/**
* @brief Draw the image
@ -221,7 +221,7 @@ gdispImageError gdispImageCache(gdispImage *img);
* 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, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
#define gdispImageDraw(img,x,y,cx,cy,sx,sy) gdispGImageDraw(GDISP,img,x,y,cx,cy,sx,sy)
/**
@ -243,7 +243,7 @@ gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y
* @note Calling gdispImageDraw() after getting a gDelayForever will go back to drawing the first
* frame/page.
*/
gDelay gdispImageNext(gdispImage *img);
gDelay gdispImageNext(gImage *img);
/**
* @brief Get the number of entries in the color palette.
@ -253,7 +253,7 @@ gDelay gdispImageNext(gdispImage *img);
*
* @pre gdispImageOpen() must have returned successfully.
*/
gU16 gdispImageGetPaletteSize(gdispImage *img);
gU16 gdispImageGetPaletteSize(gImage *img);
/**
* @brief Get an entry in the color palette.
@ -266,7 +266,7 @@ gU16 gdispImageGetPaletteSize(gdispImage *img);
*
* @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette.
*/
gColor gdispImageGetPalette(gdispImage *img, gU16 index);
gColor gdispImageGetPalette(gImage *img, gU16 index);
/**
* @brief Modify an entry in the color palette.
@ -279,7 +279,7 @@ gColor gdispImageGetPalette(gdispImage *img, gU16 index);
* @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, gU16 index, gColor newColor);
gBool gdispImageAdjustPalette(gImage *img, gU16 index, gColor newColor);
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */
#endif /* _GDISP_IMAGE_H */

18
src/gdisp/gdisp_image_bmp.c

@ -45,7 +45,7 @@ typedef struct gdispImagePrivate_BMP {
gPixel buf[GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE];
} gdispImagePrivate_BMP;
void gdispImageClose_BMP(gdispImage *img) {
void gdispImageClose_BMP(gImage *img) {
gdispImagePrivate_BMP *priv;
priv = (gdispImagePrivate_BMP *)img->priv;
@ -61,7 +61,7 @@ void gdispImageClose_BMP(gdispImage *img) {
}
}
gdispImageError gdispImageOpen_BMP(gdispImage *img) {
gdispImageError gdispImageOpen_BMP(gImage *img) {
gdispImagePrivate_BMP *priv;
gU8 hdr[2];
gU16 aword;
@ -352,7 +352,7 @@ unsupportedcleanup:
return GDISP_IMAGE_ERR_UNSUPPORTED; // Not supported
}
static gCoord getPixels(gdispImage *img, gCoord x) {
static gCoord getPixels(gImage *img, gCoord x) {
gdispImagePrivate_BMP * priv;
gColor * pc;
gCoord len;
@ -691,7 +691,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
}
}
gdispImageError gdispImageCache_BMP(gdispImage *img) {
gdispImageError gdispImageCache_BMP(gImage *img) {
gdispImagePrivate_BMP * priv;
gColor * pcs;
gColor * pcd;
@ -749,7 +749,7 @@ gdispImageError gdispImageCache_BMP(gdispImage *img) {
return GDISP_IMAGE_ERR_OK;
}
gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gdispGImageDraw_BMP(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImagePrivate_BMP * priv;
gCoord mx, my;
gCoord pos, len, st;
@ -815,14 +815,14 @@ gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoo
return GDISP_IMAGE_ERR_OK;
}
gDelay gdispImageNext_BMP(gdispImage *img) {
gDelay gdispImageNext_BMP(gImage *img) {
(void) img;
/* No more frames/pages */
return gDelayForever;
}
gU16 gdispImageGetPaletteSize_BMP(gdispImage *img) {
gU16 gdispImageGetPaletteSize_BMP(gImage *img) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;
@ -839,7 +839,7 @@ gU16 gdispImageGetPaletteSize_BMP(gdispImage *img) {
#endif
}
gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index) {
gColor gdispImageGetPalette_BMP(gImage *img, gU16 index) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;
@ -860,7 +860,7 @@ gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index) {
#endif
}
gBool gdispImageAdjustPalette_BMP(gdispImage *img, gU16 index, gColor newColor) {
gBool gdispImageAdjustPalette_BMP(gImage *img, gU16 index, gColor newColor) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;

18
src/gdisp/gdisp_image_gif.c

@ -106,7 +106,7 @@ typedef struct gdispImagePrivate_GIF {
*
* Pre: Frame info has been read.
*/
static gdispImageError startDecodeGif(gdispImage *img) {
static gdispImageError startDecodeGif(gImage *img) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
gU16 cnt;
@ -170,7 +170,7 @@ baddatacleanup:
*
* Pre: Frame info has been read.
*/
static void stopDecodeGif(gdispImage *img) {
static void stopDecodeGif(gImage *img) {
gdispImagePrivate_GIF * priv;
priv = (gdispImagePrivate_GIF *)img->priv;
@ -201,7 +201,7 @@ static gU16 getPrefixGif(gifimgdecode *decode, gU16 code) {
*
* Note: The resulting pixels are stored in decode->buf
*/
static gU16 getBytesGif(gdispImage *img) {
static gU16 getBytesGif(gImage *img) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
gU16 cnt;
@ -334,7 +334,7 @@ static gU16 getBytesGif(gdispImage *img) {
*
* Pre: The file position is at the start of the frame.
*/
static gdispImageError initFrameGif(gdispImage *img) {
static gdispImageError initFrameGif(gImage *img) {
gdispImagePrivate_GIF * priv;
gifimgcache * cache;
gU8 blocktype;
@ -493,7 +493,7 @@ static gdispImageError initFrameGif(gdispImage *img) {
}
}
void gdispImageClose_GIF(gdispImage *img) {
void gdispImageClose_GIF(gImage *img) {
gdispImagePrivate_GIF * priv;
gifimgcache * cache;
gifimgcache * ncache;
@ -514,7 +514,7 @@ void gdispImageClose_GIF(gdispImage *img) {
}
}
gdispImageError gdispImageOpen_GIF(gdispImage *img) {
gdispImageError gdispImageOpen_GIF(gImage *img) {
gdispImagePrivate_GIF *priv;
gU8 hdr[6];
gU16 aword;
@ -595,7 +595,7 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) {
}
}
gdispImageError gdispImageCache_GIF(gdispImage *img) {
gdispImageError gdispImageCache_GIF(gImage *img) {
gdispImagePrivate_GIF * priv;
gifimgcache * cache;
gifimgdecode * decode;
@ -766,7 +766,7 @@ baddatacleanup:
return GDISP_IMAGE_ERR_BADDATA;
}
gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gdispGImageDraw_GIF(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
gU8 * q = 0;
@ -1106,7 +1106,7 @@ baddatacleanup:
return GDISP_IMAGE_ERR_BADDATA;
}
gDelay gdispImageNext_GIF(gdispImage *img) {
gDelay gdispImageNext_GIF(gImage *img) {
gdispImagePrivate_GIF * priv;
gDelay delay;
gU8 blocksz;

24
src/gdisp/gdisp_image_jpg.c

@ -50,19 +50,19 @@ typedef struct JDEC {
gU8* mcubuf; /* Working buffer for the MCU */
void* pool; /* Pointer to available memory pool */
unsigned sz_pool; /* Size of momory pool (bytes available) */
gdispImage* img; /* Pointer to I/O device identifiler for the session */
gImage* img; /* Pointer to I/O device identifiler for the session */
} JDEC;
/* TJpgDec API functions */
gdispImageError jd_prepare(JDEC*, void*, gdispImage*);
gdispImageError jd_decomp(JDEC*, unsigned(*)(gdispImage*,void*,JRECT*), gU8);
gdispImageError jd_prepare(JDEC*, void*, gImage*);
gdispImageError jd_decomp(JDEC*, unsigned(*)(gImage*,void*,JRECT*), gU8);
/*---------------------------------------------------------------------------*/
typedef struct gdispImagePrivate_JPG {
gPixel *frame0cache;
} gdispImagePrivate_JPG;
gdispImageError gdispImageOpen_JPG(gdispImage *img){
gdispImageError gdispImageOpen_JPG(gImage *img){
gdispImagePrivate_JPG *priv;
gU8 hdr[4];
unsigned len;
@ -119,7 +119,7 @@ gdispImageError gdispImageOpen_JPG(gdispImage *img){
}
}
void gdispImageClose_JPG(gdispImage *img){
void gdispImageClose_JPG(gImage *img){
gdispImagePrivate_JPG *priv = (gdispImagePrivate_JPG *)img->priv;
if(priv){
if (priv->frame0cache){
@ -129,7 +129,7 @@ void gdispImageClose_JPG(gdispImage *img){
}
}
static unsigned gdispImage_JPG_WriteToCache(gdispImage *img, void *bitmap, JRECT *rect)
static unsigned gdispImage_JPG_WriteToCache(gImage *img, void *bitmap, JRECT *rect)
{
gdispImagePrivate_JPG *priv;
gU8 *in;
@ -147,7 +147,7 @@ static unsigned gdispImage_JPG_WriteToCache(gdispImage *img, void *bitmap, JRECT
return 1;
}
gdispImageError gdispImageCache_JPG(gdispImage *img) {
gdispImageError gdispImageCache_JPG(gImage *img) {
gdispImagePrivate_JPG *priv;
JDEC *jd;
gdispImageError r;
@ -176,7 +176,7 @@ gdispImageError gdispImageCache_JPG(gdispImage *img) {
return r;
}
gdispImageError gdispGImageDraw_JPG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy){
gdispImageError gdispGImageDraw_JPG(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy){
gdispImagePrivate_JPG * priv;
priv = (gdispImagePrivate_JPG *)img->priv;
@ -198,7 +198,7 @@ gdispImageError gdispGImageDraw_JPG(GDisplay *g, gdispImage *img, gCoord x, gCoo
return GDISP_IMAGE_ERR_OK;
}
gDelay gdispImageNext_JPG(gdispImage *img) {
gDelay gdispImageNext_JPG(gImage *img) {
(void) img;
/* No more frames/pages */
@ -766,7 +766,7 @@ gdispImageError mcu_load (
static
gdispImageError mcu_output (
JDEC* jd, /* Pointer to the decompressor object */
unsigned (*outfunc)(gdispImage*, void*, JRECT*), /* RGB output function */
unsigned (*outfunc)(gImage*, void*, JRECT*), /* RGB output function */
unsigned x, /* MCU position in the image (left of the MCU) */
unsigned y /* MCU position in the image (top of the MCU) */
)
@ -963,7 +963,7 @@ gdispImageError restart (
gdispImageError jd_prepare (
JDEC* jd, /* Blank decompressor object */
void* pool, /* Working buffer for the decompression session */
gdispImage* img /* I/O device identifier for the session */
gImage* img /* I/O device identifier for the session */
)
{
gU8 *seg, b;
@ -1124,7 +1124,7 @@ gdispImageError jd_prepare (
gdispImageError jd_decomp (
JDEC* jd, /* Initialized decompression object */
unsigned (*outfunc)(gdispImage*, void*, JRECT*), /* RGB output function */
unsigned (*outfunc)(gImage*, void*, JRECT*), /* RGB output function */
gU8 scale /* Output de-scaling factor (0 to 3) */
)
{

14
src/gdisp/gdisp_image_native.c

@ -23,15 +23,15 @@
/**
* Helper Routines Needed
*/
void *gdispImageAlloc(gdispImage *img, gMemSize sz);
void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz);
void *gdispImageAlloc(gImage *img, gMemSize sz);
void gdispImageFree(gImage *img, void *ptr, gMemSize sz);
typedef struct gdispImagePrivate_NATIVE {
gPixel *frame0cache;
gPixel buf[BLIT_BUFFER_SIZE_NATIVE];
} gdispImagePrivate_NATIVE;
void gdispImageClose_NATIVE(gdispImage *img) {
void gdispImageClose_NATIVE(gImage *img) {
gdispImagePrivate_NATIVE * priv;
priv = (gdispImagePrivate_NATIVE *)img->priv;
@ -43,7 +43,7 @@ void gdispImageClose_NATIVE(gdispImage *img) {
}
}
gdispImageError gdispImageOpen_NATIVE(gdispImage *img) {
gdispImageError gdispImageOpen_NATIVE(gImage *img) {
gU8 hdr[HEADER_SIZE_NATIVE];
/* Read the 8 byte header */
@ -70,7 +70,7 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) {
return GDISP_IMAGE_ERR_OK;
}
gdispImageError gdispImageCache_NATIVE(gdispImage *img) {
gdispImageError gdispImageCache_NATIVE(gImage *img) {
gMemSize len;
gdispImagePrivate_NATIVE * priv;
@ -93,7 +93,7 @@ gdispImageError gdispImageCache_NATIVE(gdispImage *img) {
return GDISP_IMAGE_ERR_OK;
}
gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gCoord mx, mcx;
gFileSize pos;
gMemSize len;
@ -141,7 +141,7 @@ gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, g
return GDISP_IMAGE_ERR_OK;
}
gDelay gdispImageNext_NATIVE(gdispImage *img) {
gDelay gdispImageNext_NATIVE(gImage *img) {
(void) img;
/* No more frames/pages */

12
src/gdisp/gdisp_image_png.c

@ -111,7 +111,7 @@ typedef struct PNG_zinflate {
// Put all the decoding structures together.
// Note this is immediately followed by 2 scan lines of uncompressed image data for filtering (dynamic size).
typedef struct PNG_decode {
gdispImage *img;
gImage *img;
PNG_info *pinfo;
PNG_input i;
PNG_output o;
@ -1127,7 +1127,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
* Public PNG functions
*---------------------------------------------------------------*/
void gdispImageClose_PNG(gdispImage *img) {
void gdispImageClose_PNG(gImage *img) {
PNG_info *pinfo;
pinfo = (PNG_info *)img->priv;
@ -1141,7 +1141,7 @@ void gdispImageClose_PNG(gdispImage *img) {
}
}
gdispImageError gdispImageOpen_PNG(gdispImage *img) {
gdispImageError gdispImageOpen_PNG(gImage *img) {
PNG_info *pinfo;
gU32 pos;
gU32 len;
@ -1497,7 +1497,7 @@ exit_nonmem:
return GDISP_IMAGE_ERR_NOMEMORY;
}
gdispImageError gdispGImageDraw_PNG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gdispGImageDraw_PNG(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
PNG_info *pinfo;
PNG_decode *d;
@ -1546,7 +1546,7 @@ exit_baddata:
return GDISP_IMAGE_ERR_BADDATA;
}
gdispImageError gdispImageCache_PNG(gdispImage *img) {
gdispImageError gdispImageCache_PNG(gImage *img) {
PNG_info *pinfo;
unsigned chunknext;
unsigned chunklen;
@ -1621,7 +1621,7 @@ baddata:
return GDISP_IMAGE_ERR_BADDATA;
}
gDelay gdispImageNext_PNG(gdispImage *img) {
gDelay gdispImageNext_PNG(gImage *img) {
(void) img;
/* No more frames/pages */

4
src/gdisp/gdisp_image_support.h

@ -120,8 +120,8 @@
#endif
void *gdispImageAlloc(gdispImage *img, gMemSize sz);
void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz);
void *gdispImageAlloc(gImage *img, gMemSize sz);
void gdispImageFree(gImage *img, void *ptr, gMemSize sz);
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN
extern const gU8 gdispImageEndianArray[4];

6
src/gdisp/gdisp_pixmap.h

@ -63,13 +63,13 @@ gPixel *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.
* @brief Get a pointer to a native format gImage.
* @return A pointer to a NATIVE format gImage 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
* @return The pointer to the native gImage
*
* @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().

2
src/gwin/gwin.c

@ -403,7 +403,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
#endif
#if GDISP_NEED_IMAGE
gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError gwinDrawImage(GHandle gh, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImageError ret;
if (!_gwinDrawStart(gh)) return GDISP_IMAGE_ERR_OK;

2
src/gwin/gwin.h

@ -1056,7 +1056,7 @@ typedef enum { GWIN_NORMAL, GWIN_MAXIMIZE, GWIN_MINIMIZE } GWindowMinMax;
*
* @api
*/
gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
gdispImageError gwinDrawImage(GHandle gh, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
#endif
/*-------------------------------------------------

2
src/gwin/gwin_button.c

@ -466,7 +466,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
sy = 0;
}
gdispGImageDraw(gw->g.display, (gdispImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy);
gdispGImageDraw(gw->g.display, (gImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
#endif

2
src/gwin/gwin_button.h

@ -101,7 +101,7 @@ gBool gwinButtonIsPressed(GHandle gh);
* @note In your custom button drawing function you may optionally call these
* standard functions and then draw your extra details on top.
* @note The standard functions below ignore the param parameter except for @p gwinButtonDraw_Image().
* @note The image custom draw function @p gwinButtonDraw_Image() uses param to pass in the gdispImage pointer.
* @note The image custom draw function @p gwinButtonDraw_Image() uses param to pass in the gImage pointer.
* @note These custom drawing routines don't have to worry about setting clipping as the framework
* sets clipping to the object window prior to calling these routines.
*

2
src/gwin/gwin_container.c

@ -168,7 +168,7 @@ void gwinContainerDraw_Std(GWidgetObject *gw, void *param) {
#if GDISP_NEED_IMAGE
void gwinContainerDraw_Image(GWidgetObject *gw, void *param) {
#define gi ((gdispImage *)param)
#define gi ((gImage *)param)
gCoord x, y, iw, ih, mx, my;
if (gw->g.vmt != (gwinVMT *)&containerVMT)

2
src/gwin/gwin_frame.c

@ -294,7 +294,7 @@ void gwinFrameDraw_Std(GWidgetObject *gw, void *param) {
#if GDISP_NEED_IMAGE
void gwinFrameDraw_Image(GWidgetObject *gw, void *param) {
#define gi ((gdispImage *)param)
#define gi ((gImage *)param)
gCoord x, y, iw, ih, mx, my;
if (gw->g.vmt != (gwinVMT *)&frameVMT)

2
src/gwin/gwin_frame.h

@ -106,7 +106,7 @@ void gwinFrameDraw_Std(GWidgetObject *gw, void *param);
* @param[in] gw The widget object (must be a frame object).
* @param[in] param A parameter passed in from the user. Ignored by this function.
*
* @note The image custom draw function @p gwinFrameDraw_Image() uses param to pass in the gdispImage pointer.
* @note The image custom draw function @p gwinFrameDraw_Image() uses param to pass in the gImage pointer.
* The image must be already opened before calling @p gwinSetCustomDraw().
*
* @api

2
src/gwin/gwin_image.h

@ -34,7 +34,7 @@
// An image window
typedef struct GImageObject {
GWindowObject g;
gdispImage image; // The image itself
gImage image; // The image itself
#if GWIN_NEED_IMAGE_ANIMATION
GTimer timer; // Timer used for animated images
#endif

2
src/gwin/gwin_list.c

@ -677,7 +677,7 @@ void gwinListViewItem(GHandle gh, int item) {
}
#if GWIN_NEED_LIST_IMAGES
void gwinListItemSetImage(GHandle gh, int item, gdispImage *pimg) {
void gwinListItemSetImage(GHandle gh, int item, gImage *pimg) {
const gfxQueueASyncItem * qi;
int i;

4
src/gwin/gwin_list.h

@ -100,7 +100,7 @@ typedef struct ListItem {
gU16 param; // A parameter the user can specify himself
const char* text;
#if GWIN_NEED_LIST_IMAGES
gdispImage* pimg;
gImage* pimg;
#endif
} ListItem;
@ -361,7 +361,7 @@ void gwinListViewItem(GHandle gh, int item);
* for this list is to call gwinListDeleteAll().
*
*/
void gwinListItemSetImage(GHandle gh, int item, gdispImage *pimg);
void gwinListItemSetImage(GHandle gh, int item, gImage *pimg);
#endif
/**

2
src/gwin/gwin_progressbar.c

@ -263,7 +263,7 @@ void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param) {
#if GDISP_NEED_IMAGE
void gwinProgressbarDraw_Image(GWidgetObject *gw, void *param) {
#define gsw ((GProgressbarObject *)gw)
#define gi ((gdispImage *)param)
#define gi ((gImage *)param)
const GColorSet * pcol;
gCoord z, v;

2
src/gwin/gwin_slider.c

@ -389,7 +389,7 @@ void gwinSliderDraw_Std(GWidgetObject *gw, void *param) {
#if GDISP_NEED_IMAGE
void gwinSliderDraw_Image(GWidgetObject *gw, void *param) {
#define gsw ((GSliderObject *)gw)
#define gi ((gdispImage *)param)
#define gi ((gImage *)param)
const GColorSet * pcol;
gCoord z, v;

2
src/gwin/gwin_tabset.c

@ -532,7 +532,7 @@ void gwinTabsetDraw_Std(GWidgetObject *gw, void *param) {
#if GDISP_NEED_IMAGE
void gwinTabsetDraw_Image(GWidgetObject *gw, void *param) {
#define gi ((gdispImage *)param)
#define gi ((gImage *)param)
gCoord x, y, iw, ih, mx, my;
if (gw->g.vmt != (gwinVMT *)&tabsetVMT)

Loading…
Cancel
Save