u8 * GetImageData(void) { u8 * data = NULL; int ret; if (CONF_GetAspectRatio()) { ctx = PNGU_SelectImageFromBuffer(background169_png); if (!ctx) return NULL; } else { ctx = PNGU_SelectImageFromBuffer(background_png); if (!ctx) return NULL; } ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) return NULL; int len = imgProp.imgWidth * imgProp.imgHeight * 4; if(len%32) len += (32-len%32); data = (u8 *)memalign (32, len); ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); DCFlushRange(data, len); PNGU_ReleaseImageContext(ctx); return data; }
s32 __Gui_DrawPng(void *img, u32 x, u32 y) { IMGCTX ctx = NULL; PNGUPROP imgProp; s32 ret; /* Select PNG data */ ctx = PNGU_SelectImageFromBuffer(img); if (!ctx) { ret = -1; goto out; } /* Get image properties */ ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) { ret = -1; goto out; } /* Draw image */ Video_DrawPng(ctx, imgProp, x, y); /* Success */ ret = 0; out: /* Free memory */ if (ctx) PNGU_ReleaseImageContext(ctx); return ret; }
s32 __Gui_GetPngDimensions(void *img, u32 *w, u32 *h) { IMGCTX ctx = NULL; PNGUPROP imgProp; s32 ret; /* Select PNG data */ ctx = PNGU_SelectImageFromBuffer(img); if (!ctx) { ret = -1; goto out; } /* Get image properties */ ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) { ret = -1; goto out; } /* Set image width and height */ *w = imgProp.imgWidth; *h = imgProp.imgHeight; /* Success */ ret = 0; out: /* Free memory */ if (ctx) PNGU_ReleaseImageContext(ctx); return ret; }
u8 * GetImageData(bool dark) { PNGUPROP imgProp; IMGCTX ctx; u8 * data = NULL; int ret; ctx = PNGU_SelectImageFromBuffer(dark ? background_dark_png : background_png); if (!ctx) return NULL; ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) return NULL; imagewidth = imgProp.imgWidth; imageheight = imgProp.imgHeight; int len = ((((imgProp.imgWidth+3)>>2)*((imgProp.imgHeight+3)>>2)*32*2) + 31) & ~31; data = (u8 *)memalign (32, len); ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); DCFlushRange(data, len); PNGU_ReleaseImageContext(ctx); return data; }
IMGCTX getPngImageRessources(const void *imgData,PNGUPROP *imgProperties) { IMGCTX varout; if ((varout=PNGU_SelectImageFromBuffer(imgData))) { if (PNGU_GetImageProperties(varout,imgProperties)!=PNGU_OK) { PNGU_ReleaseImageContext(varout); varout=NULL; } } return varout; }
u8 * GetImageData(void) { u8 * data = NULL; int ret; if (CONF_GetAspectRatio()) { switch (CONF_GetLanguage()) { case CONF_LANG_FRENCH: ctx = PNGU_SelectImageFromBuffer(bk169fr_png); break; case CONF_LANG_JAPANESE: ctx = PNGU_SelectImageFromBuffer(bk169jp_png); break; case CONF_LANG_SPANISH: ctx = PNGU_SelectImageFromBuffer(bk169sp_png); break; case CONF_LANG_ITALIAN: ctx = PNGU_SelectImageFromBuffer(bk169it_png); break; case CONF_LANG_DUTCH: ctx = PNGU_SelectImageFromBuffer(bk169du_png); break; case CONF_LANG_GERMAN: ctx = PNGU_SelectImageFromBuffer(bk169ge_png); break; default: ctx = PNGU_SelectImageFromBuffer(bk169en_png); break; } } else { switch (CONF_GetLanguage()) { case CONF_LANG_FRENCH: ctx = PNGU_SelectImageFromBuffer(bkfr_png); break; case CONF_LANG_JAPANESE: ctx = PNGU_SelectImageFromBuffer(bkjp_png); break; case CONF_LANG_SPANISH: ctx = PNGU_SelectImageFromBuffer(bksp_png); break; case CONF_LANG_ITALIAN: ctx = PNGU_SelectImageFromBuffer(bkit_png); break; case CONF_LANG_DUTCH: ctx = PNGU_SelectImageFromBuffer(bkdu_png); break; case CONF_LANG_GERMAN: ctx = PNGU_SelectImageFromBuffer(bkge_png); break; default: ctx = PNGU_SelectImageFromBuffer(bken_png); break; } } if (!ctx) return NULL; ret = PNGU_GetImageProperties(ctx, &imgProp); if (ret != PNGU_OK) return NULL; int len = imgProp.imgWidth * imgProp.imgHeight * 4; if(len%32) len += (32-len%32); data = (u8 *)memalign (32, len); ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); DCFlushRange(data, len); PNGU_ReleaseImageContext(ctx); return data; }