From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Wasabi/api/imgldr/imgldr.h | 86 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Src/Wasabi/api/imgldr/imgldr.h (limited to 'Src/Wasabi/api/imgldr/imgldr.h') diff --git a/Src/Wasabi/api/imgldr/imgldr.h b/Src/Wasabi/api/imgldr/imgldr.h new file mode 100644 index 00000000..33a64864 --- /dev/null +++ b/Src/Wasabi/api/imgldr/imgldr.h @@ -0,0 +1,86 @@ +#ifndef __IMGLDR_H +#define __IMGLDR_H + +//CUT +#define FT_UNKNOWN 0 +#define FT_BMP 1 +#define FT_JPEG 5 +#define FT_PNG 6 + +#include +#include +#ifdef WASABI_COMPILE_XMLPARSER +#include +#include +#else +class XmlReaderParamsI; +#endif +#ifdef WASABI_COMPILE_SKIN +#include +#include +#endif + +#include + +typedef struct { + ARGB32 *bitmapbits; + StringW filename; + int usageCount; + bool has_alpha; + int width; + int height; + StringW includepath; +// String rootpath; + XmlReaderParamsI params; + StringW original_element_id; + StringW fullpathfilename; +} skinCacheEntry; + +typedef unsigned long ARGB32; + +#ifdef WASABI_COMPILE_SKIN + +class skinCacheComp +{ +public: + static int compareItem(void *p1, void *p2) { + return wcscmp(((skinCacheEntry *)p1)->fullpathfilename, ((skinCacheEntry *)p2)->fullpathfilename); + } + static int compareAttrib(const wchar_t *attrib, void *item) { + return wcscmp(attrib, ((skinCacheEntry *)item)->fullpathfilename); + } +}; + +#endif //WASABI_COMPILE_SKIN + +class imageLoader +{ +public: + static ARGB32 *makeBmp(const wchar_t *filename, const wchar_t *path, int *has_alpha, int *w, int *h, ifc_xmlreaderparams *params, bool addmem, int *force_nocache); +#ifdef _WIN32 + static ARGB32 *makeBmp(OSMODULEHANDLE hInst, int id, int *has_alpha, int *w, int *h, const wchar_t *forcegroup=NULL); +#endif + static int getFileType(uint8_t *pData); + static StringW getWallpaper(); + static void release(ARGB32 *bitmapbits); +#ifdef WASABI_COMPILE_SKIN + static ARGB32 *requestSkinBitmap(const wchar_t *id, int *has_alpha, int *x, int *y, int *subw, int *subh, int *w, int *h, int cached=1); + static void releaseSkinBitmap(ARGB32 *bmpbits); + static void applySkinFilters(); + static void applySkinFilters(skinCacheEntry *entry); + static ARGB32 filterSkinColor(ARGB32 color, const wchar_t *elementid, const wchar_t *groupname); + static int layerEqual(const wchar_t *id1, const wchar_t *id2); +#endif //WASABI_COMPILE_SKIN + static int getMemUsage() { return totalMemUsage; } + static int getNumCached() { return skinCacheList.getNumItems(); } +private: +#ifdef WASABI_COMPILE_SKIN + //static int paramsMatch(ifc_xmlreaderparams *a, ifc_xmlreaderparams *b); + static PtrListInsertMultiSorted skinCacheList; +#endif //WASABI_COMPILE_SKIN + static void optimizeHasAlpha(ARGB32 *bits, int len, int *has_alpha); + static void addMemUsage(const wchar_t *filename, int size); + static void subMemUsage(int size); + static int totalMemUsage; +}; +#endif -- cgit