summaryrefslogtreecommitdiff
path: root/bitmap.h
blob: 79c44e758b8d4e216494c915d8a8719aef5ba0f3 (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
/*
 * $Id: bitmap.h,v 1.12 2004/06/18 16:08:11 lordjaxom Exp $
 */

#ifndef VDR_TEXT2SKIN_BITMAP_H
#define VDR_TEXT2SKIN_BITMAP_H

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

class cText2SkinBitmap {
private:
	static cText2SkinCache mCache;

	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 ResetCache(void) { mCache.Reset(); }
	static void FlushCache(void) { mCache.Flush(); }
	
	virtual ~cText2SkinBitmap();

	void Reset(void) { mCurrent = 0; mLastGet = 0; }
	cBitmap &Get(int &UpdateIn);
	void SetColor(int Index, tColor 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
};

inline void cText2SkinBitmap::SetColor(int Index, tColor Color) {
	mBitmaps[mCurrent]->SetColor(Index, Color);
}

#endif // VDR_TEXT2SKIN_BITMAP_H