mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Prepared the OSD functions for multiple overlapping windows
This commit is contained in:
parent
b2202e7998
commit
441c35e8e8
1
HISTORY
1
HISTORY
@ -887,3 +887,4 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed channel data for "DW TV" (thanks to Axel Gruber).
|
- Fixed channel data for "DW TV" (thanks to Axel Gruber).
|
||||||
- Added DPID to "PREMIERE MOVIE 1" in channels.conf.cable (thanks to Stephan
|
- Added DPID to "PREMIERE MOVIE 1" in channels.conf.cable (thanks to Stephan
|
||||||
Schreiber).
|
Schreiber).
|
||||||
|
- Prepared the OSD functions for multiple overlapping windows.
|
||||||
|
10
dvbapi.c
10
dvbapi.c
@ -7,7 +7,7 @@
|
|||||||
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
|
* DVD support initially written by Andreas Schultz <aschultz@warp10.net>
|
||||||
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
|
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
|
||||||
*
|
*
|
||||||
* $Id: dvbapi.c 1.141 2001/11/25 16:38:09 kls Exp $
|
* $Id: dvbapi.c 1.142 2002/01/13 15:48:37 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define DVDDEBUG 1
|
//#define DVDDEBUG 1
|
||||||
@ -2842,7 +2842,11 @@ void cDvbApi::Open(int w, int h)
|
|||||||
}
|
}
|
||||||
else if (d == 0) { //XXX full menu
|
else if (d == 0) { //XXX full menu
|
||||||
osd->Create(0, 0, w, lineHeight, 2);
|
osd->Create(0, 0, w, lineHeight, 2);
|
||||||
osd->Create(0, lineHeight, w, (Setup.OSDheight - 3) * lineHeight, 2, true, clrBackground, clrCyan, clrWhite, clrBlack);
|
osd->Create(0, lineHeight, w, (Setup.OSDheight - 3) * lineHeight, 2);
|
||||||
|
osd->AddColor(clrBackground);
|
||||||
|
osd->AddColor(clrCyan);
|
||||||
|
osd->AddColor(clrWhite);
|
||||||
|
osd->AddColor(clrBlack);
|
||||||
osd->Create(0, (Setup.OSDheight - 2) * lineHeight, w, 2 * lineHeight, 4);
|
osd->Create(0, (Setup.OSDheight - 2) * lineHeight, w, 2 * lineHeight, 4);
|
||||||
}
|
}
|
||||||
else { //XXX progress display
|
else { //XXX progress display
|
||||||
@ -3197,7 +3201,7 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Pol
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
esyslog(LOG_ERR, "ERROR %d in frontend get event", res);
|
esyslog(LOG_ERR, "ERROR %d in frontend get event (channel %d, card %d)", res, ChannelNumber, CardIndex() + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
esyslog(LOG_ERR, "ERROR: timeout while tuning");
|
esyslog(LOG_ERR, "ERROR: timeout while tuning");
|
||||||
|
184
dvbosd.c
184
dvbosd.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbosd.c 1.10 2001/07/24 16:25:34 kls Exp $
|
* $Id: dvbosd.c 1.11 2002/01/13 15:49:28 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dvbosd.h"
|
#include "dvbosd.h"
|
||||||
@ -257,25 +257,35 @@ const char *cBitmap::Data(int x, int y)
|
|||||||
|
|
||||||
class cWindow : public cBitmap {
|
class cWindow : public cBitmap {
|
||||||
private:
|
private:
|
||||||
|
int handle; // the index within the OSD's window array (0...MAXNUMWINDOWS - 1)
|
||||||
int x0, y0;
|
int x0, y0;
|
||||||
|
int bpp;
|
||||||
|
bool tiled;
|
||||||
bool shown;
|
bool shown;
|
||||||
public:
|
public:
|
||||||
cWindow(int x, int y, int w, int h, int Bpp, bool ClearWithBackground = true);
|
cWindow(int Handle, int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled);
|
||||||
int X0(void) { return x0; }
|
int X0(void) { return x0; }
|
||||||
int Y0(void) { return y0; }
|
int Y0(void) { return y0; }
|
||||||
|
int Bpp(void) { return bpp; }
|
||||||
|
bool Tiled(void) { return tiled; }
|
||||||
bool Shown(void) { bool s = shown; shown = true; return s; }
|
bool Shown(void) { bool s = shown; shown = true; return s; }
|
||||||
|
int Handle(void) { return handle; }
|
||||||
bool Contains(int x, int y);
|
bool Contains(int x, int y);
|
||||||
|
void Relocate(int x, int y);
|
||||||
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
|
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
|
||||||
void SetBitmap(int x, int y, const cBitmap &Bitmap);
|
void SetBitmap(int x, int y, const cBitmap &Bitmap);
|
||||||
void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground);
|
void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground);
|
||||||
const char *Data(int x, int y);
|
const char *Data(int x, int y);
|
||||||
};
|
};
|
||||||
|
|
||||||
cWindow::cWindow(int x, int y, int w, int h, int Bpp, bool ClearWithBackground)
|
cWindow::cWindow(int Handle, int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled)
|
||||||
:cBitmap(w, h, Bpp, ClearWithBackground)
|
:cBitmap(w, h, Bpp, ClearWithBackground)
|
||||||
{
|
{
|
||||||
|
handle = Handle;
|
||||||
x0 = x;
|
x0 = x;
|
||||||
y0 = y;
|
y0 = y;
|
||||||
|
bpp = Bpp;
|
||||||
|
tiled = Tiled;
|
||||||
shown = false;
|
shown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,19 +296,39 @@ bool cWindow::Contains(int x, int y)
|
|||||||
return x >= 0 && y >= 0 && x < width && y < height;
|
return x >= 0 && y >= 0 && x < width && y < height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cWindow::Relocate(int x, int y)
|
||||||
|
{
|
||||||
|
x0 = x;
|
||||||
|
y0 = y;
|
||||||
|
}
|
||||||
|
|
||||||
void cWindow::Fill(int x1, int y1, int x2, int y2, eDvbColor Color)
|
void cWindow::Fill(int x1, int y1, int x2, int y2, eDvbColor Color)
|
||||||
{
|
{
|
||||||
cBitmap::Fill(x1 - x0, y1 - y0, x2 - x0, y2 - y0, Color);
|
if (tiled) {
|
||||||
|
x1 -= x0;
|
||||||
|
y1 -= y0;
|
||||||
|
x2 -= x0;
|
||||||
|
y2 -= y0;
|
||||||
|
}
|
||||||
|
cBitmap::Fill(x1, y1, x2, y2, Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cWindow::SetBitmap(int x, int y, const cBitmap &Bitmap)
|
void cWindow::SetBitmap(int x, int y, const cBitmap &Bitmap)
|
||||||
{
|
{
|
||||||
cBitmap::SetBitmap(x - x0, y - y0, Bitmap);
|
if (tiled) {
|
||||||
|
x -= x0;
|
||||||
|
y -= y0;
|
||||||
|
}
|
||||||
|
cBitmap::SetBitmap(x, y, Bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cWindow::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
|
void cWindow::Text(int x, int y, const char *s, eDvbColor ColorFg, eDvbColor ColorBg)
|
||||||
{
|
{
|
||||||
cBitmap::Text(x - x0, y - y0, s, ColorFg, ColorBg);
|
if (tiled) {
|
||||||
|
x -= x0;
|
||||||
|
y -= y0;
|
||||||
|
}
|
||||||
|
cBitmap::Text(x, y, s, ColorFg, ColorBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cWindow::Data(int x, int y)
|
const char *cWindow::Data(int x, int y)
|
||||||
@ -325,14 +355,28 @@ cDvbOsd::cDvbOsd(int VideoDev, int x, int y, int w, int h, int Bpp)
|
|||||||
cDvbOsd::~cDvbOsd()
|
cDvbOsd::~cDvbOsd()
|
||||||
{
|
{
|
||||||
if (videoDev >= 0) {
|
if (videoDev >= 0) {
|
||||||
while (numWindows > 0) {
|
for (int i = 0; i < numWindows; i++) {
|
||||||
Cmd(OSD_SetWindow, 0, numWindows--);
|
SetWindow(window[i]);
|
||||||
Cmd(OSD_Close);
|
Cmd(OSD_Close);
|
||||||
delete window[numWindows];
|
delete window[i];
|
||||||
}
|
}
|
||||||
|
numWindows = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cDvbOsd::SetWindow(cWindow *Window)
|
||||||
|
{
|
||||||
|
// Window handles are counted 0...(MAXNUMWINDOWS - 1), but the actual window
|
||||||
|
// numbers in the driver are used from 1...MAXNUMWINDOWS.
|
||||||
|
int Handle = Window->Handle();
|
||||||
|
if (0 <= Handle && Handle < MAXNUMWINDOWS) {
|
||||||
|
Cmd(OSD_SetWindow, 0, Handle + 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
esyslog(LOG_ERR, "ERROR: illegal window handle: %d", Handle);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void cDvbOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, const void *data)
|
void cDvbOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, const void *data)
|
||||||
{
|
{
|
||||||
if (videoDev >= 0) {
|
if (videoDev >= 0) {
|
||||||
@ -349,60 +393,74 @@ void cDvbOsd::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, co
|
|||||||
sigfillset(&set);
|
sigfillset(&set);
|
||||||
sigprocmask(SIG_BLOCK, &set, &oldset);
|
sigprocmask(SIG_BLOCK, &set, &oldset);
|
||||||
ioctl(videoDev, OSD_SEND_CMD, &dc);
|
ioctl(videoDev, OSD_SEND_CMD, &dc);
|
||||||
usleep(5000); // XXX Workaround for a driver bug (cInterface::DisplayChannel() displayed texts at wrong places
|
if (cmd == OSD_SetBlock) // XXX this is the only command that takes longer
|
||||||
// XXX and sometimes the OSD was no longer displayed).
|
usleep(5000); // XXX Workaround for a driver bug (cInterface::DisplayChannel() displayed texts at wrong places
|
||||||
// XXX Increase the value if the problem still persists on your particular system.
|
// XXX and sometimes the OSD was no longer displayed).
|
||||||
// TODO Check if this is still necessary with driver versions after 0.7.
|
// XXX Increase the value if the problem still persists on your particular system.
|
||||||
|
// TODO Check if this is still necessary with driver versions after 0.7.
|
||||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cDvbOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground, eDvbColor Color0, eDvbColor Color1, eDvbColor Color2, eDvbColor Color3)
|
tWindowHandle cDvbOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground, bool Tiled)
|
||||||
{
|
{
|
||||||
/* TODO XXX
|
|
||||||
- check that no two windows overlap
|
|
||||||
*/
|
|
||||||
if (numWindows < MAXNUMWINDOWS) {
|
if (numWindows < MAXNUMWINDOWS) {
|
||||||
if (x >= 0 && y >= 0 && w > 0 && h > 0 && (Bpp == 1 || Bpp == 2 || Bpp == 4 || Bpp == 8)) {
|
if (x >= 0 && y >= 0 && w > 0 && h > 0 && (Bpp == 1 || Bpp == 2 || Bpp == 4 || Bpp == 8)) {
|
||||||
if ((w & 0x03) != 0) {
|
if ((w & 0x03) != 0) {
|
||||||
w += 4 - (w & 0x03);
|
w += 4 - (w & 0x03);
|
||||||
esyslog(LOG_ERR, "ERROR: OSD window width must be a multiple of 4 - increasing to %d", w);
|
esyslog(LOG_ERR, "ERROR: OSD window width must be a multiple of 4 - increasing to %d", w);
|
||||||
}
|
}
|
||||||
cWindow *win = new cWindow(x, y, w, h, Bpp, ClearWithBackground);
|
cWindow *win = new cWindow(numWindows, x, y, w, h, Bpp, ClearWithBackground, Tiled);
|
||||||
if (Color0 != clrTransparent) {
|
if (SetWindow(win)) {
|
||||||
win->Index(Color0);
|
window[win->Handle()] = win;
|
||||||
win->Index(Color1);
|
Cmd(OSD_Open, Bpp, x0 + x, y0 + y, x0 + x + w - 1, y0 + y + h - 1, (void *)1); // initially hidden!
|
||||||
win->Index(Color2);
|
numWindows++;
|
||||||
win->Index(Color3);
|
return win->Handle();
|
||||||
win->Reset();
|
|
||||||
}
|
}
|
||||||
window[numWindows++] = win;
|
else
|
||||||
Cmd(OSD_SetWindow, 0, numWindows);
|
delete win;
|
||||||
Cmd(OSD_Open, Bpp, x0 + x, y0 + y, x0 + x + w - 1, y0 + y + h - 1, (void *)1); // initially hidden!
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
esyslog(LOG_ERR, "ERROR: illegal OSD parameters");
|
esyslog(LOG_ERR, "ERROR: illegal OSD parameters");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
esyslog(LOG_ERR, "ERROR: too many OSD windows");
|
esyslog(LOG_ERR, "ERROR: too many OSD windows");
|
||||||
return false;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cDvbOsd::AddColor(eDvbColor Color, tWindowHandle Window)
|
||||||
|
{
|
||||||
|
cWindow *w = GetWindow(Window);
|
||||||
|
if (w) {
|
||||||
|
w->Index(Color);
|
||||||
|
w->Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cWindow *cDvbOsd::GetWindow(int x, int y)
|
cWindow *cDvbOsd::GetWindow(int x, int y)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numWindows; i++) {
|
for (int i = 0; i < numWindows; i++) {
|
||||||
if (window[i]->Contains(x, y))
|
if (window[i]->Tiled() && window[i]->Contains(x, y))
|
||||||
return window[i];
|
return window[i];
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cWindow *cDvbOsd::GetWindow(tWindowHandle Window)
|
||||||
|
{
|
||||||
|
if (0 <= Window && Window < numWindows)
|
||||||
|
return window[Window];
|
||||||
|
if (Window == LAST_CREATED_WINDOW && numWindows > 0)
|
||||||
|
return window[numWindows - 1];
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void cDvbOsd::Flush(void)
|
void cDvbOsd::Flush(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numWindows; i++) {
|
for (int i = 0; i < numWindows; i++) {
|
||||||
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
|
||||||
if (window[i]->Dirty(x1, y1, x2, y2)) {
|
if (window[i]->Dirty(x1, y1, x2, y2)) {
|
||||||
Cmd(OSD_SetWindow, 0, i + 1);
|
SetWindow(window[i]);
|
||||||
int FirstColor = 0, LastColor = 0;
|
int FirstColor = 0, LastColor = 0;
|
||||||
const eDvbColor *pal;
|
const eDvbColor *pal;
|
||||||
while ((pal = window[i]->Colors(FirstColor, LastColor)) != NULL)
|
while ((pal = window[i]->Colors(FirstColor, LastColor)) != NULL)
|
||||||
@ -414,28 +472,36 @@ void cDvbOsd::Flush(void)
|
|||||||
// Showing the windows in a separate loop to avoid seeing them come up one after another
|
// Showing the windows in a separate loop to avoid seeing them come up one after another
|
||||||
for (int i = 0; i < numWindows; i++) {
|
for (int i = 0; i < numWindows; i++) {
|
||||||
if (!window[i]->Shown()) {
|
if (!window[i]->Shown()) {
|
||||||
Cmd(OSD_SetWindow, 0, i + 1);
|
SetWindow(window[i]);
|
||||||
Cmd(OSD_MoveWindow, 0, x0 + window[i]->X0(), y0 + window[i]->Y0());
|
Cmd(OSD_MoveWindow, 0, x0 + window[i]->X0(), y0 + window[i]->Y0());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDvbOsd::Clear(void)
|
void cDvbOsd::Clear(tWindowHandle Window)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numWindows; i++)
|
if (Window == ALL_TILED_WINDOWS || Window == ALL_WINDOWS) {
|
||||||
window[i]->Clear();
|
for (int i = 0; i < numWindows; i++)
|
||||||
|
if (Window == ALL_WINDOWS || window[i]->Tiled())
|
||||||
|
window[i]->Clear();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cWindow *w = GetWindow(Window);
|
||||||
|
if (w)
|
||||||
|
w->Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDvbOsd::Fill(int x1, int y1, int x2, int y2, eDvbColor Color)
|
void cDvbOsd::Fill(int x1, int y1, int x2, int y2, eDvbColor Color, tWindowHandle Window)
|
||||||
{
|
{
|
||||||
cWindow *w = GetWindow(x1, y1);
|
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x1, y1) : GetWindow(Window);
|
||||||
if (w)
|
if (w)
|
||||||
w->Fill(x1, y1, x2, y2, Color);
|
w->Fill(x1, y1, x2, y2, Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDvbOsd::SetBitmap(int x, int y, const cBitmap &Bitmap)
|
void cDvbOsd::SetBitmap(int x, int y, const cBitmap &Bitmap, tWindowHandle Window)
|
||||||
{
|
{
|
||||||
cWindow *w = GetWindow(x, y);
|
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x, y) : GetWindow(Window);
|
||||||
if (w)
|
if (w)
|
||||||
w->SetBitmap(x, y, Bitmap);
|
w->SetBitmap(x, y, Bitmap);
|
||||||
}
|
}
|
||||||
@ -458,10 +524,44 @@ eDvbFont cDvbOsd::SetFont(eDvbFont Font)
|
|||||||
return oldFont;
|
return oldFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDvbOsd::Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground)
|
void cDvbOsd::Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground, tWindowHandle Window)
|
||||||
{
|
{
|
||||||
cWindow *w = GetWindow(x, y);
|
cWindow *w = (Window == ALL_TILED_WINDOWS) ? GetWindow(x, y) : GetWindow(Window);
|
||||||
if (w)
|
if (w)
|
||||||
w->Text(x, y, s, ColorFg, ColorBg);
|
w->Text(x, y, s, ColorFg, ColorBg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cDvbOsd::Relocate(tWindowHandle Window, int x, int y, int NewWidth, int NewHeight)
|
||||||
|
{
|
||||||
|
cWindow *w = GetWindow(Window);
|
||||||
|
if (w) {
|
||||||
|
SetWindow(w);
|
||||||
|
if (NewWidth > 0 && NewHeight > 0) {
|
||||||
|
if ((NewWidth & 0x03) != 0) {
|
||||||
|
NewWidth += 4 - (NewWidth & 0x03);
|
||||||
|
esyslog(LOG_ERR, "ERROR: OSD window width must be a multiple of 4 - increasing to %d", NewWidth);
|
||||||
|
}
|
||||||
|
Cmd(OSD_Close);
|
||||||
|
window[w->Handle()] = new cWindow(w->Handle(), x, y, NewWidth, NewHeight, w->Bpp(), w->ClearWithBackground(), w->Tiled());
|
||||||
|
delete w;
|
||||||
|
Cmd(OSD_Open, 2, x0 + x, y0 + y, x0 + x + NewWidth - 1, y0 + y + NewHeight - 1, (void *)1); // initially hidden!
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
w->Relocate(x, y);
|
||||||
|
Cmd(OSD_MoveWindow, 0, x0 + x, y0 + y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cDvbOsd::Hide(tWindowHandle Window)
|
||||||
|
{
|
||||||
|
if (SetWindow(GetWindow(Window)))
|
||||||
|
Cmd(OSD_Hide, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cDvbOsd::Show(tWindowHandle Window)
|
||||||
|
{
|
||||||
|
if (SetWindow(GetWindow(Window)))
|
||||||
|
Cmd(OSD_Show, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
71
dvbosd.h
71
dvbosd.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: dvbosd.h 1.8 2001/07/28 16:22:32 kls Exp $
|
* $Id: dvbosd.h 1.9 2002/01/13 15:48:00 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DVBOSD_H
|
#ifndef __DVBOSD_H
|
||||||
@ -75,6 +75,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground = true);
|
cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground = true);
|
||||||
virtual ~cBitmap();
|
virtual ~cBitmap();
|
||||||
|
bool ClearWithBackground(void) { return clearWithBackground; }
|
||||||
eDvbFont SetFont(eDvbFont Font);
|
eDvbFont SetFont(eDvbFont Font);
|
||||||
bool Dirty(int &x1, int &y1, int &x2, int &y2);
|
bool Dirty(int &x1, int &y1, int &x2, int &y2);
|
||||||
void SetPixel(int x, int y, eDvbColor Color);
|
void SetPixel(int x, int y, eDvbColor Color);
|
||||||
@ -93,26 +94,84 @@ public:
|
|||||||
|
|
||||||
class cWindow;
|
class cWindow;
|
||||||
|
|
||||||
|
typedef int tWindowHandle;
|
||||||
|
|
||||||
|
// '-1' is used as an error return value!
|
||||||
|
#define ALL_WINDOWS (-2)
|
||||||
|
#define ALL_TILED_WINDOWS (-3)
|
||||||
|
#define LAST_CREATED_WINDOW (-4)
|
||||||
|
|
||||||
class cDvbOsd {
|
class cDvbOsd {
|
||||||
private:
|
private:
|
||||||
int videoDev;
|
int videoDev;
|
||||||
int numWindows;
|
int numWindows;
|
||||||
int x0, y0;
|
int x0, y0;
|
||||||
cWindow *window[MAXNUMWINDOWS];
|
cWindow *window[MAXNUMWINDOWS];
|
||||||
|
bool SetWindow(cWindow *Window);
|
||||||
void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL);
|
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);
|
cWindow *GetWindow(int x, int y);
|
||||||
|
cWindow *GetWindow(tWindowHandle Window);
|
||||||
public:
|
public:
|
||||||
cDvbOsd(int VideoDev, int x, int y, int w = -1, int h = -1, int Bpp = -1);
|
cDvbOsd(int VideoDev, int x, int y, int w = -1, int h = -1, int Bpp = -1);
|
||||||
|
// Initializes the OSD on the given VideoDev, starting at screen coordinates
|
||||||
|
// (x, y). If w, h and Bpp are given, one window with that width, height and
|
||||||
|
// color depth will be created - otherwise the actual windows will have to
|
||||||
|
// be created by separate calls to Create().
|
||||||
~cDvbOsd();
|
~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);
|
// Destroys all windows and shuts down the OSD.
|
||||||
|
tWindowHandle Create(int x, int y, int w, int h, int Bpp, bool ClearWithBackground = true, bool Tiled = true);
|
||||||
|
// Creates a window at coordinates (x, y), which are relative to the OSD's
|
||||||
|
// origin given in the constructor, with the given width, height and color
|
||||||
|
// depth. ClearWithBackground controls whether the window will be filled with
|
||||||
|
// clrBackground when it is cleared. Setting this to 'false' may be useful
|
||||||
|
// for windows that don't need clrBackground but want to save this color
|
||||||
|
// palette entry for a different color. Tiled controls whether this will
|
||||||
|
// be part of a multi section OSD (with several windows that all have
|
||||||
|
// different color depths and palettes and form one large OSD area), or
|
||||||
|
// whether this is a "standalone" window that will be drawn "in front"
|
||||||
|
// of any windows defined *after* this one (this can be used for highlighting
|
||||||
|
// certain parts of the OSD, as would be done in a 'cursor').
|
||||||
|
// Returns a handle that can be used to identify this window.
|
||||||
|
void AddColor(eDvbColor Color, tWindowHandle Window = LAST_CREATED_WINDOW);
|
||||||
|
// Adds the Color to the color palette of the given window if it is not
|
||||||
|
// already contained in the palette (and if the palette still has free
|
||||||
|
// slots for new colors). The default value LAST_CREATED_WINDOW will
|
||||||
|
// access the most recently created window, without the need of explicitly
|
||||||
|
// using a window handle.
|
||||||
void Flush(void);
|
void Flush(void);
|
||||||
void Clear(void);
|
// Actually commits all data of all windows to the OSD.
|
||||||
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color);
|
void Clear(tWindowHandle Window = ALL_TILED_WINDOWS);
|
||||||
void SetBitmap(int x, int y, const cBitmap &Bitmap);
|
// Clears the given window. If ALL_TILED_WINDOWS is given, only the tiled
|
||||||
|
// windows will be cleared, leaving the standalone windows untouched. If
|
||||||
|
// ALL_WINDOWS is given, the standalone windows will also be cleared.
|
||||||
|
void Fill(int x1, int y1, int x2, int y2, eDvbColor Color, tWindowHandle Window = ALL_TILED_WINDOWS);
|
||||||
|
// Fills the rectangle defined by the upper left (x1, y2) and lower right
|
||||||
|
// (x2, y2) corners with the given Color. If a specific window is given,
|
||||||
|
// the coordinates are relative to that window's upper left corner.
|
||||||
|
// Otherwise they are relative to the upper left corner of the entire OSD.
|
||||||
|
// If all tiled windows are selected, only that window which contains the
|
||||||
|
// point (x1, y1) will actually be filled.
|
||||||
|
void SetBitmap(int x, int y, const cBitmap &Bitmap, tWindowHandle Window = ALL_TILED_WINDOWS);
|
||||||
|
// Sets the pixels within the given window with the data from the given
|
||||||
|
// Bitmap. See Fill() for details about the coordinates.
|
||||||
int Width(unsigned char c);
|
int Width(unsigned char c);
|
||||||
|
// Returns the width (in pixels) of the given character in the current font.
|
||||||
int Width(const char *s);
|
int Width(const char *s);
|
||||||
|
// Returns the width (in pixels) of the given string in the current font.
|
||||||
eDvbFont SetFont(eDvbFont Font);
|
eDvbFont SetFont(eDvbFont Font);
|
||||||
void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground);
|
// Sets the current font for subsequent Width() and Text() operations.
|
||||||
|
void Text(int x, int y, const char *s, eDvbColor ColorFg = clrWhite, eDvbColor ColorBg = clrBackground, tWindowHandle Window = ALL_TILED_WINDOWS);
|
||||||
|
// Writes the given string at coordinates (x, y) with the given foreground
|
||||||
|
// and background color into the given window (see Fill() for details
|
||||||
|
// about the coordinates).
|
||||||
|
void Relocate(tWindowHandle Window, int x, int y, int NewWidth = -1, int NewHeight = -1);
|
||||||
|
// Moves the given window to the new location at (x, y). If NewWidth and
|
||||||
|
// NewHeight are also given, the window will also be resized to the new
|
||||||
|
// width and height.
|
||||||
|
void Hide(tWindowHandle Window);
|
||||||
|
// Hides the given window.
|
||||||
|
void Show(tWindowHandle Window);
|
||||||
|
// Shows the given window.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__DVBOSD_H
|
#endif //__DVBOSD_H
|
||||||
|
Loading…
Reference in New Issue
Block a user