summaryrefslogtreecommitdiff
path: root/bitmap.h
blob: 44a3e1b6f5e3b328e0f33de48c3fb843e3158121 (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
/*
 * $Id: bitmap.h,v 1.11 2004/06/16 18:46:50 lordjaxom Exp $
 */

#ifndef VDR_TEXT2SKIN_BITMAP_H
#define VDR_TEXT2SKIN_BITMAP_H

#include "common.h"
#include "cache.h"
#include <vdr/osd.h>

class cText2SkinBitmap;
typedef cText2SkinCache<string,cText2SkinBitmap*> cImageCache;

class cText2SkinBitmap {
private:
	static cImageCache mCache;
	static bool        mFirstTime;

	vector<cBitmap*>   mBitmaps;
	int                mCurrent;
	time_t             mDelay;
	time_t             mLastGet;

	// disallow direct construction
	cText2SkinBitmap(void);

public:
	static cText2SkinBitmap *Load(const char *Filename, int Alpha = 0);
	static void FlushCache(void) { mCache.Flush(); }
	
	virtual ~cText2SkinBitmap();

	cBitmap &Get(int &UpdateIn);
	void SetColor(int Index, tColor Color) { mBitmaps[mCurrent]->SetColor(Index, Color); }
	void SetAlpha(int Alpha);

	bool LoadXpm(const char *Filename, int Alpha);
#ifdef HAVE_IMLIB2
	bool LoadImlib(const char *Filename, int Alpha);
#endif
#ifdef HAVE_IMAGEMAGICK
	bool LoadMagick(const char *Filename, int Alpha);
#endif
};

#endif // VDR_TEXT2SKIN_BITMAP_H