summaryrefslogtreecommitdiff
path: root/imagecache.h
blob: 6d241bd978875ee34ae3f899088a050d9231d03a (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef __TVGUIDE_IMAGECACHE_H
#define __TVGUIDE_IMAGECACHE_H

#define X_DISPLAY_MISSING

#include <map>
#include <vector>
#include "imagemagickwrapper.h"

enum eCacheType {
    ctOsdElement = 0,
    ctGrid,
    ctLogo,
    ctChannelGroup,
    ctIcon,
};

enum eOsdElementType {
    oeNone = -1,
    oeStatusHeaderContentFull,
    oeStatusHeaderContentWindowed,
    oeStatusHeaderTVFrame,
    oeButtonRed,
    oeButtonGreen,
    oeButtonYellow,
    oeButtonBlue,
    oeLogoBack,
    oeTimeline1,
    oeTimeline2,
    oeDateViewer,
    oeClock,
    oeChannelJump,
};

class cImageCache : public cImageMagickWrapper {
public:
    cImageCache();
    ~cImageCache();
    void CreateCache(void);
    cImage *GetOsdElement(eOsdElementType type);
    cImage *GetGrid(int width, int height, bool active);
    cImage *GetChannelGroup(int width, int height);
    cImage *GetLogo(const cChannel *channel);
    cImage *GetIcon(std::string name, int width, int height);
    std::string GetCacheSize(eCacheType type);
    void Clear(void);
private:
    cImage *tempStaticLogo;
    Image bufferGrid;
    Image bufferGridActive;
    bool gridsAvailable;
    int cornerWidth;
    int cornerHeight;
    cImage *imgLeft;
    cImage *imgLeftActive;
    cImage *imgRight;
    cImage *imgRightActive;
    cImage *imgHead;
    cImage *imgHeadActive;
    cImage *imgBottom;
    cImage *imgBottomActive;
    cImage *imgChannelgroupHead;
    cImage *imgChannelgroupBottom;
    cImage *groupsHead;
    cImage *groupsBottom;
    cImage *groupsLeft;
    cImage *groupsRight;
	std::map<eOsdElementType, cImage*> osdElementCache;
    std::map<std::string, cImage*> gridCache;
    std::map<std::string, cImage*> groupsCache;
    std::map<std::string, cImage*> logoCache;
    std::map<std::string, cImage*> iconCache;
    void CreateOsdIconCache(void);
    void PrepareGridIconCache(void);
    void CreateGridIconCache(void);
    void CreateChannelGroupCache(void);
    void CreateLogoCache(void);
	bool LoadIcon(std::string name);
	void InsertIntoOsdElementCache(eOsdElementType type, int width=0, int height=0);
    void InsertIntoGridCache(std::string name, int width, int height, bool active);
    cImage *CreateGrid(int width, int height, bool active);
    void AddCornersHorizontal(cImage *img, bool active);
    void AddCornersVertical(cImage *img, bool active);
    void InsertIntoGroupsCacheHorizontal(int size);
    void InsertIntoGroupsCacheVertical(int size);
    void AddCornersGroupHorizontal(cImage *img);
    void AddCornersGroupVertical(cImage *img);
    bool LoadLogo(const cChannel *channel);
    void InsertIntoLogoCache(std::string channelID);
};

#endif //__TVGUIDE_IMAGECACHE_H