diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-07-22 12:33:45 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-07-22 12:33:45 +0200 |
commit | c14d8d1da1842157568be1d7f84bcf2337762559 (patch) | |
tree | 5f25bde57e60066f78ba18ea58966371d424818f /dvbosd.h | |
parent | e4732c091253615801bdce39db203da3b62b4285 (diff) | |
download | vdr-c14d8d1da1842157568be1d7f84bcf2337762559.tar.gz vdr-c14d8d1da1842157568be1d7f84bcf2337762559.tar.bz2 |
Larger OSD with 2bpp windows; Channel display at bottom
Diffstat (limited to 'dvbosd.h')
-rw-r--r-- | dvbosd.h | 80 |
1 files changed, 57 insertions, 23 deletions
@@ -4,17 +4,12 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.h 1.6 2001/05/01 14:41:42 kls Exp $ + * $Id: dvbosd.h 1.7 2001/07/22 11:49:35 kls Exp $ */ #ifndef __DVBOSD_H #define __DVBOSD_H -// FIXME: these should be defined in ../DVB/driver/dvb.h!!! -typedef unsigned int __u32; -typedef unsigned short __u16; -typedef unsigned char __u8; - #if defined(DEBUG_OSD) || defined(REMOTE_KBD) #include <ncurses.h> #endif @@ -22,57 +17,96 @@ typedef unsigned char __u8; #include <stdio.h> #include "font.h" +#define MAXNUMCOLORS 16 + enum eDvbColor { #ifndef DEBUG_OSD - clrTransparent, + clrTransparent = 0x00000000, #endif - clrBackground, + clrBackground = 0x7F000000, // 50% gray #ifdef DEBUG_OSD clrTransparent = clrBackground, clrBlack = clrBackground, #else - clrBlack, + clrBlack = 0xFF000000, #endif - clrRed, - clrGreen, - clrYellow, - clrBlue, - clrMagenta, - clrCyan, - clrWhite, + clrRed = 0xFF1414FC, + clrGreen = 0xFF24FC24, + clrYellow = 0xFF24C0FC, + clrMagenta = 0xFFFC00B0, + clrBlue = 0xFFFC0000, + clrCyan = 0xFFFCFC00, + clrWhite = 0xFFFCFCFC, + }; + +class cPalette { +private: + eDvbColor color[MAXNUMCOLORS]; + int maxColors, numColors; + bool used[MAXNUMCOLORS]; + bool fetched[MAXNUMCOLORS]; + bool full; +protected: + typedef unsigned char tIndexes[MAXNUMCOLORS]; +public: + cPalette(int Bpp); + int Index(eDvbColor Color); + void Reset(void); + const eDvbColor *Colors(int &FirstColor, int &LastColor); + void Take(const cPalette &Palette, tIndexes *Indexes = NULL); }; -class cBitmap { +class cBitmap : public cPalette { private: cFont *font; eDvbFont fontType; + void SetIndex(int x, int y, char Index); + char *bitmap; + bool clearWithBackground; protected: int width, height; - char *bitmap; int dirtyX1, dirtyY1, dirtyX2, dirtyY2; - void Clean(void); public: - cBitmap(int Width, int Height); + cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground = true); virtual ~cBitmap(); eDvbFont SetFont(eDvbFont Font); - bool Dirty(void); + bool Dirty(int &x1, int &y1, int &x2, int &y2); void SetPixel(int x, int y, eDvbColor Color); void SetBitmap(int x, int y, const cBitmap &Bitmap); + int Width(void) { return width; } int Width(unsigned char c); int Width(const char *s); void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); + void Clean(void); void Clear(void); + const char *Data(int x, int y); }; -class cDvbOsd : public cBitmap { +#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7 + +class cWindow; + +class cDvbOsd { private: int videoDev; + int numWindows; + int x0, y0; + cWindow *window[MAXNUMWINDOWS]; void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); + cWindow *GetWindow(int x, int y); public: - cDvbOsd(int VideoDev, int x1, int y1, int x2, int y2, int Bpp); + cDvbOsd(int VideoDev, int x, int y, int w = -1, int h = -1, int Bpp = -1); ~cDvbOsd(); + bool Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground = true, eDvbColor Color0 = clrTransparent, eDvbColor Color1 = clrTransparent, eDvbColor Color2 = clrTransparent, eDvbColor Color3 = clrTransparent); void Flush(void); + void Clear(void); + void Fill(int x1, int y1, int x2, int y2, eDvbColor Color); + void SetBitmap(int x, int y, const cBitmap &Bitmap); + int Width(unsigned char c); + int Width(const char *s); + eDvbFont SetFont(eDvbFont Font); + void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground); }; #endif //__DVBOSD_H |