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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/***************************************************************************
dxr3colormanager.h - description
-------------------
begin : Tue Oct 22 2002
copyright : (C) 2002 by Stefan Schluenss
email : vdr@schluenss.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _DXR3COLORMANAGER_H_
#define _DXR3COLORMANAGER_H_
/*
// ==================================
struct rectangular_area
{
rectangular_area() : m_startrow(0), m_endrow(0), m_startcol(0), m_endcol(0) {}
private:
size_t m_startrow;
size_t m_endrow;
size_t m_startcol;
size_t m_endcol;
unsigned int Colors[4];
unsigned int Opac[4];
}
*/
/**SPU-ColorManager
*@author Stefan Schluenss
*/
#include <stdio.h>
#define OSD_SPU_CM_DUMP 0
#define MAX_NO_OF_SECTIONS 15
#define MAX_NO_OF_REGIONS 30
// ==================================
class xSection
{
public:
xSection(int x);
bool HasColor(unsigned int color, unsigned char &ColorIndex);
unsigned char AddColor(unsigned int color);
bool AllColorsUsed() {/*DIAG("AllColorsUsed: %d\n",NrOfColors)*/;if(NrOfColors >= 4) return(true); else return (false); };
int X1;
int X2;
int NrOfColors;
unsigned int Colors[4];
unsigned int Opac[4];
};
// ==================================
class yRegion
{
public:
yRegion(): Y1(0), Y2(0), N(0) {}
/** No descriptions */
void AddSection(int first, int last, unsigned int color, unsigned int opac);
int Y1;
int Y2;
int N;
xSection* Section[MAX_NO_OF_SECTIONS];
};
// ==================================
class cColorManager
{
public:
cColorManager();
~cColorManager();
void EncodeColors(int width, int height, unsigned char* smap, unsigned char* dmap);
/** Sets a new color on the OSD */
unsigned char AddColor(int x, int y, unsigned char color, unsigned char &ColorIndex);
/** encodes the color information as highlight spu data*/
unsigned char* GetSpuData(int &len);
/** Adds a new highlight region beginning from FIRST to LAST column */
// void AddRegion(int first, int last, unsigned int color, unsigned int opac=0xFFFF);
/** No descriptions */
void SetBgColor(unsigned int bgColor);
private: // Private attributes
yRegion *hlr[MAX_NO_OF_REGIONS];
int NrOfRegions;
bool isopen;
unsigned char spudata[2*4096];
unsigned int BgCol;
int MaxY;
/** Opens a new highlight region */
void OpenRegion(int y, int NrOfSecToCopy = 0);
/** Closes the spu-highlight region */
void CloseRegion(int y);
xSection* NewSection(int x);
xSection *GetSection(int x, int &n);
};
#endif /*_DXR3COLORMANAGER_H_*/
|