vdr-plugin-skindesigner/libcore/imagecache.h

60 lines
2.0 KiB
C
Raw Normal View History

2014-09-27 09:25:14 +02:00
#ifndef __NOPACITY_IMAGECACHE_H
#define __NOPACITY_IMAGECACHE_H
#define X_DISPLAY_MISSING
#include <vdr/osd.h>
#include <vdr/skins.h>
#include <vector>
#include "imageloader.h"
2014-09-27 09:25:14 +02:00
#include "../libtemplate/templatefunction.h"
class cImageCache : public cImageLoader {
2014-09-27 09:25:14 +02:00
public:
cImageCache();
~cImageCache();
void Lock(void) { mutex.Lock(); }
void Unlock(void) { mutex.Unlock(); }
void SetPathes(void);
2014-09-27 09:25:14 +02:00
//channel logos
void CacheLogo(int width, int height);
cImage *GetLogo(string channelID, int width, int height);
bool LogoExists(string channelID);
cImage *GetSeparatorLogo(string name, int width, int height);
bool SeparatorLogoExists(string name);
//icons
void CacheIcon(eImageType type, string path, int width, int height);
cImage *GetIcon(eImageType type, string name, int width, int height);
2014-10-26 08:26:44 +01:00
string GetIconName(string label, eMenuCategory cat = mcUndefined);
bool MenuIconExists(string name);
2014-09-27 09:25:14 +02:00
//skinparts
void CacheSkinpart(string path, int width, int height);
cImage *GetSkinpart(string name, int width, int height);
//Cairo Images
void CacheEllipse(int id, int width, int height, tColor color, int quadrant);
cImage *GetEllipse(int id, int width, int height, tColor color, int quadrant);
2014-09-27 09:25:14 +02:00
//helpers
void Clear(void);
void Debug(bool full);
void GetIconCacheSize(int &num, int &size);
void GetLogoCacheSize(int &num, int &size);
void GetSkinpartsCacheSize(int &num, int &size);
private:
static cMutex mutex;
static string items[16];
cImage *tempStaticLogo;
string logoPath;
string iconPath;
string skinPartsPath;
2014-09-27 09:25:14 +02:00
map<string, cImage*> iconCache;
map<string, cImage*> channelLogoCache;
map<string, cImage*> skinPartsCache;
map<int, cImage*> cairoImageCache;
2014-09-27 09:25:14 +02:00
bool LoadIcon(eImageType type, string name);
bool LoadLogo(const cChannel *channel);
bool LoadSeparatorLogo(string name);
bool LoadSkinpart(string name);
};
#endif //__NOPACITY_IMAGECACHE_H