summaryrefslogtreecommitdiff
path: root/libcore/pixmapcontainer.h
blob: 3b3105a4bf467bb65777c2b83eb57f416ffe97a0 (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
#ifndef __PIXMAP_CONTAINER_H
#define __PIXMAP_CONTAINER_H

#include <string>
#include <vdr/plugin.h>
#include "fontmanager.h"

enum eFlushState {
    fsOpen,
    fsLock,
    fsCount,
};

class cPixmapContainer : public cThread {
private:
    static cMutex mutex;
    static cOsd *osd;
    static eFlushState flushState;
    bool pixContainerInit;
    int numPixmaps;
    cPixmap **pixmaps;
    int *pixmapsTransparency;
    bool checkRunning;
    int fadeTime;
    bool deleteOsdOnExit;
protected:
    void SetInitFinished(void) { pixContainerInit = false; };
    bool CreateOsd(int Left, int Top, int Width, int Height);
    void DeleteOsdOnExit(void) { deleteOsdOnExit = true; };
    //Wrappers for access to pixmaps
    bool PixmapExists(int num);
    int NumPixmaps(void) { return numPixmaps; };
    void CreatePixmap(int num, int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
    bool DestroyPixmap(int num);
    void DrawText(int num, const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, std::string fontName, int fontSize);
    void DrawRectangle(int num, const cRect &Rect, tColor Color);
    void DrawEllipse(int num, const cRect &Rect, tColor Color, int Quadrants = 0);
    void DrawSlope(int num, const cRect &Rect, tColor Color, int Type);
    void DrawImage(int num, const cPoint &Point, const cImage &Image);
    void DrawBitmap(int num, const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
    void Fill(int num, tColor Color);
    void SetAlpha(int num, int Alpha);
    void SetTransparency(int num, int Transparency);
    void SetLayer(int num, int Layer);
    int Width(int num);
    int Height(int num);
    int DrawportWidth(int num);
    int DrawportHeight(int num);
    int DrawportX(int num);
    int DrawportY(int num);
    void SetDrawPortPoint(int num, const cPoint &Point);
    void SetCheckRunning(void) { checkRunning = true; };
    void UnsetCheckRunning(void) { checkRunning = false; };
    //HELPERS -- do not access the pixmaps array directly, use wrapper functions
    void SetFadeTime(int fade) { fadeTime = fade; };
    void FadeIn(void);
    void FadeOut(void);
    void ScrollVertical(int num, int scrollDelay, int scrollSpeed);
    void ScrollHorizontal(int num, int scrollDelay, int scrollSpeed, int scrollMode);
    void CancelSave(void);
    void DoSleep(int duration);
    void DrawBlendedBackground(int num, int xStart, int width, tColor color, tColor colorBlending, bool fromTop);
    void DrawRoundedCorners(int num, int radius, int x, int y, int width, int height);
    void DrawRoundedCornersWithBorder(int num, tColor borderColor, int radius, int width, int height);
public:
    cPixmapContainer(int numPixmaps);
    virtual ~cPixmapContainer(void);
    void LockFlush(void);
    void OpenFlush(void);
    void DoFlush(void);
    virtual void Action(void) {};
};

#endif //__PIXMAP_CONTAINER_H