summaryrefslogtreecommitdiff
path: root/dvbosd.h
blob: e2a424a8d5b7a03b10f3b45c021250d02daf7926 (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
75
76
77
/*
 * 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.
 *
 * $Id: dvbosd.h 1.4 2000/11/18 15:25:25 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
#include <stdio.h>
#include <dvb.h>
#include "font.h"

enum eDvbColor { 
#ifndef DEBUG_OSD
  clrTransparent,
#endif
  clrBackground,
#ifdef DEBUG_OSD
  clrTransparent = clrBackground,
  clrBlack = clrBackground,
#else
  clrBlack,
#endif
  clrRed,
  clrGreen,
  clrYellow,
  clrBlue,
  clrMagenta,
  clrCyan,
  clrWhite,
  };

class cBitmap {
private:
  cFont *font;
  eDvbFont fontType;
protected:
  int width, height;
  char *bitmap;
  int dirtyX1, dirtyY1, dirtyX2, dirtyY2;
  void Clean(void);
public:
  cBitmap(int Width, int Height);
  virtual ~cBitmap();
  eDvbFont SetFont(eDvbFont Font);
  bool Dirty(void);
  void SetPixel(int x, int y, eDvbColor Color);
  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 Clear(void);
  };

class cDvbOsd : public cBitmap {
private:
  int videoDev;
  void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
public:
  cDvbOsd(int VideoDev, int x1, int y1, int x2, int y2, int Bpp);
  ~cDvbOsd();
  void Flush(void);
  };

#endif //__DVBOSD_H