summaryrefslogtreecommitdiff
path: root/libcore/imagecache.h
blob: e11f29591078b2883fb0536511513c34c490ff85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#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"
#include "../libtemplate/templatefunction.h"

class cImageCache : public cImageLoader {
public:
    cImageCache();
    ~cImageCache();
    void Lock(void) { mutex.Lock(); }
    void Unlock(void) { mutex.Unlock(); }
    void SetPathes(void);
    //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);
    string GetIconName(string label, eMenuCategory cat = mcUndefined, string plugName = "");
    bool MenuIconExists(string name);
    //skinparts
    void CacheSkinpart(string path, int width, int height);
    cImage *GetSkinpart(string name, int width, int height);
    //cairo special images
    cImage *GetVerticalText(string text, tColor color, string font, int size, int direction);
    //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 iconPathSkin;
    string skinPartsPathSkin;
    string iconPathTheme;
    string skinPartsPathTheme;
    string svgTemplatePath;
    map<string, cImage*> iconCache;
    map<string, cImage*> channelLogoCache;
    map<string, cImage*> skinPartsCache;
    map<string, cImage*> cairoImageCache;
    bool LoadIcon(eImageType type, string name);
    bool LoadLogo(const cChannel *channel);
    bool LoadSeparatorLogo(string name);
    bool LoadSkinpart(string name);
};

#endif //__NOPACITY_IMAGECACHE_H