2000-10-03 10:34:48 +02:00
|
|
|
/*
|
|
|
|
* dvbosd.h: Interface to the DVB On Screen Display
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2001-07-22 12:33:45 +02:00
|
|
|
* $Id: dvbosd.h 1.7 2001/07/22 11:49:35 kls Exp $
|
2000-10-03 10:34:48 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DVBOSD_H
|
|
|
|
#define __DVBOSD_H
|
|
|
|
|
|
|
|
#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
|
|
|
|
#include <ncurses.h>
|
|
|
|
#endif
|
2001-06-02 10:47:40 +02:00
|
|
|
#include <ost/osd.h>
|
2000-10-03 10:34:48 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "font.h"
|
|
|
|
|
2001-07-22 12:33:45 +02:00
|
|
|
#define MAXNUMCOLORS 16
|
|
|
|
|
2001-06-02 10:47:40 +02:00
|
|
|
enum eDvbColor {
|
2000-10-03 10:34:48 +02:00
|
|
|
#ifndef DEBUG_OSD
|
2001-07-22 12:33:45 +02:00
|
|
|
clrTransparent = 0x00000000,
|
2000-10-03 10:34:48 +02:00
|
|
|
#endif
|
2001-07-22 12:33:45 +02:00
|
|
|
clrBackground = 0x7F000000, // 50% gray
|
2000-10-03 10:34:48 +02:00
|
|
|
#ifdef DEBUG_OSD
|
|
|
|
clrTransparent = clrBackground,
|
|
|
|
clrBlack = clrBackground,
|
|
|
|
#else
|
2001-07-22 12:33:45 +02:00
|
|
|
clrBlack = 0xFF000000,
|
2000-10-03 10:34:48 +02:00
|
|
|
#endif
|
2001-07-22 12:33:45 +02:00
|
|
|
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);
|
2000-10-03 10:34:48 +02:00
|
|
|
};
|
|
|
|
|
2001-07-22 12:33:45 +02:00
|
|
|
class cBitmap : public cPalette {
|
2000-10-03 10:34:48 +02:00
|
|
|
private:
|
|
|
|
cFont *font;
|
2000-11-18 15:46:00 +01:00
|
|
|
eDvbFont fontType;
|
2001-07-22 12:33:45 +02:00
|
|
|
void SetIndex(int x, int y, char Index);
|
|
|
|
char *bitmap;
|
|
|
|
bool clearWithBackground;
|
2000-10-03 10:34:48 +02:00
|
|
|
protected:
|
|
|
|
int width, height;
|
|
|
|
int dirtyX1, dirtyY1, dirtyX2, dirtyY2;
|
|
|
|
public:
|
2001-07-22 12:33:45 +02:00
|
|
|
cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground = true);
|
2000-10-03 10:34:48 +02:00
|
|
|
virtual ~cBitmap();
|
2000-11-18 15:46:00 +01:00
|
|
|
eDvbFont SetFont(eDvbFont Font);
|
2001-07-22 12:33:45 +02:00
|
|
|
bool Dirty(int &x1, int &y1, int &x2, int &y2);
|
2000-10-03 10:34:48 +02:00
|
|
|
void SetPixel(int x, int y, eDvbColor Color);
|
2000-12-09 11:13:00 +01:00
|
|
|
void SetBitmap(int x, int y, const cBitmap &Bitmap);
|
2001-07-22 12:33:45 +02:00
|
|
|
int Width(void) { return width; }
|
2000-11-01 11:45:05 +01:00
|
|
|
int Width(unsigned char c);
|
2000-11-05 13:04:23 +01:00
|
|
|
int Width(const char *s);
|
2000-10-03 10:34:48 +02:00
|
|
|
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);
|
2001-07-22 12:33:45 +02:00
|
|
|
void Clean(void);
|
2000-10-03 10:34:48 +02:00
|
|
|
void Clear(void);
|
2001-07-22 12:33:45 +02:00
|
|
|
const char *Data(int x, int y);
|
2000-10-03 10:34:48 +02:00
|
|
|
};
|
|
|
|
|
2001-07-22 12:33:45 +02:00
|
|
|
#define MAXNUMWINDOWS 7 // OSD windows are counted 1...7
|
|
|
|
|
|
|
|
class cWindow;
|
|
|
|
|
|
|
|
class cDvbOsd {
|
2000-10-03 10:34:48 +02:00
|
|
|
private:
|
|
|
|
int videoDev;
|
2001-07-22 12:33:45 +02:00
|
|
|
int numWindows;
|
|
|
|
int x0, y0;
|
|
|
|
cWindow *window[MAXNUMWINDOWS];
|
2000-10-03 10:34:48 +02:00
|
|
|
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
|
2001-07-22 12:33:45 +02:00
|
|
|
cWindow *GetWindow(int x, int y);
|
2000-10-03 10:34:48 +02:00
|
|
|
public:
|
2001-07-22 12:33:45 +02:00
|
|
|
cDvbOsd(int VideoDev, int x, int y, int w = -1, int h = -1, int Bpp = -1);
|
2000-10-03 10:34:48 +02:00
|
|
|
~cDvbOsd();
|
2001-07-22 12:33:45 +02:00
|
|
|
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);
|
2000-10-03 10:34:48 +02:00
|
|
|
void Flush(void);
|
2001-07-22 12:33:45 +02:00
|
|
|
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);
|
2000-10-03 10:34:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__DVBOSD_H
|