8 #include <linux/dvb/osd.h>
14 #define MAX_NUM_FONTFACES 8
15 #define MAX_NUM_FONTS 8
16 #define MAX_BITMAP_SIZE (1024*1024)
56 virtual void SaveRegion(
int x1,
int y1,
int x2,
int y2);
59 virtual void DrawBitmap(
int x,
int y,
const cBitmap &Bitmap,
tColor ColorFg = 0,
tColor ColorBg = 0,
bool ReplacePalette =
false,
bool Overlay =
false);
62 virtual void DrawEllipse(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Quadrants = 0);
63 virtual void DrawSlope(
int x1,
int y1,
int x2,
int y2,
tColor Color,
int Type);
64 virtual void Flush(
void);
68 :
cOsd(Left, Top, Level)
84 memset(&config, 0,
sizeof(config));
137 for (
int i = 0; i < NumAreas; i++)
139 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
151 for (
int i = 0; i < NumAreas; i++)
162 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
212 for (i = 0; i < numColors; i++)
215 if (ColorFg || ColorBg)
238 for (
int yc = 0; yc <
height; yc += chunk)
241 if (yc + hc > height)
244 (uint8_t *) Bitmap.
Data(0, yc),
width, hc,
252 int w = Font->
Width(s);
254 int cw = Width ? Width : w;
255 int ch = Height ? Height : h;
257 int size = Font->
Size();
279 if (pFontFace == NULL)
281 if (i < MAX_NUM_FONTFACES)
284 FILE *
fp = fopen(fontFileName,
"rb");
287 fseek(fp, 0, SEEK_END);
288 long fileSize = ftell(fp);
289 fseek(fp, 0, SEEK_SET);
292 uint8_t * buffer =
new uint8_t[fileSize];
295 if (fread(buffer, fileSize, 1, fp) == 1)
311 if (pFontFace == NULL)
329 if (i < MAX_NUM_FONTS)
349 if ((Alignment &
taLeft) != 0)
351 #if (APIVERSNUM >= 10728)
356 else if ((Alignment &
taRight) != 0)
360 #if (APIVERSNUM >= 10728)
368 x += (Width - w) / 2;
373 if ((Alignment &
taTop) != 0)
375 else if ((Alignment &
taBottom) != 0)
383 y += (Height - h) / 2;
397 while (*s && (len < (
sizeof(tmp) - 1)))
426 switch (abs(Quadrants))
512 x2 - x1 + 1, y2 - y1 + 1, Color, Type);
524 for (
int i = 0; (Bitmap =
GetBitmap(i)) != NULL; i++)
531 if (Bitmap->
Dirty(x1, y1, x2, y2))
567 virtual void Flush(
void);
571 :
cOsd(Left, Top, Level)
639 for (
int i = 0; i < NumAreas; i++)
641 if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8
651 for (
int i = 0; i < NumAreas; i++)
679 int w = pm->ViewPort().Width();
680 int h = pm->ViewPort().Height();
681 int d = w *
sizeof(
tColor);
685 for (
int y = 0; y < h; y += Chunk)
691 Left() + pm->ViewPort().X(),
Top() + pm->ViewPort().Y() + y,
692 pm->Data() + y * d, w, hc, hc * d,
705 for (
int i = 0; (bitmap =
GetBitmap(i)) != NULL; i++)
707 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
712 x2 = bitmap->
Width() - 1;
713 y2 = bitmap->
Height() - 1;
720 for (
int c = 0; c < numColors; c++)
734 int width = x2 - x1 + 1;
739 for (
int y = 0; y <
height; y += chunk)
744 for (
int r = 0; r < hc; r++)
745 memcpy(buffer + r * width, bitmap->
Data(x1, y1 + y + r),
width);
747 Left() + bitmap->
X0() + x1,
Top() + bitmap->
Y0() + y1 + y,
uint32_t CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size)
void CmdOsdRenderDisplay(uint32_t hDisplay)
virtual bool ProvidesTrueColor(void)
Returns true if this OSD provider is able to handle a true color OSD.
void CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t *pBitmap, int BmpWidth, int BmpHeight, int BmpSize, HdffColorType_t ColorType, uint32_t hPalette)
void Clean(void)
Marks the dirty area as clean.
cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf *pHdffCmdIf, uint Level)
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
virtual void SetActive(bool On)
Sets this OSD to be the active one.
uint32_t CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat, uint32_t NumColors, const uint32_t *pColors)
uint32_t CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType)
const tColor * Colors(int &NumColors) const
Returns a pointer to the complete color table and stores the number of valid entries in NumColors...
virtual void DrawPixel(int x, int y, tColor Color)
Sets the pixel at the given coordinates to the given Color, which is a full 32 bit ARGB value...
#define HDFF_INVALID_HANDLE
void CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat, uint8_t StartColor, uint32_t NumColors, const uint32_t *pColors)
uint32_t mBitmapNumColors
void CmdOsdDeletePalette(uint32_t hPalette)
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
void CmdOsdRestoreRegion(uint32_t hDisplay)
virtual void Flush(void)
Actually commits all data to the OSD hardware.
virtual void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type)
Draws a "slope" into the rectangle defined by the upper left (x1, y1) and lower right (x2...
virtual void Flush(void)
Actually commits all data to the OSD hardware.
uint32_t mBitmapNumColors
cPixmapMemory * RenderPixmaps(void)
Renders the dirty part of all pixmaps into a resulting pixmap that shall be displayed on the OSD...
void CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY, uint32_t Color, uint32_t Flags)
tFont mFonts[MAX_NUM_FONTS]
void CmdOsdDrawSlope(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color, uint32_t Type)
uint32_t mBitmapColors[256]
void CmdOsdDeleteFont(uint32_t hFont)
uint32_t CmdOsdCreateFontFace(const uint8_t *pFontData, uint32_t DataSize)
virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants=0)
Draws a filled ellipse defined by the upper left (x1, y1) and lower right (x2, y2) corners with the g...
#define HDFF_SIZE_FULL_SCREEN
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
virtual int Height(void) const =0
Returns the height of this font in pixel (all characters have the same height).
virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
Draws a filled rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the...
virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool ReplacePalette=false, bool Overlay=false)
Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the ...
bool Dirty(int &x1, int &y1, int &x2, int &y2)
Tells whether there is a dirty area and returns the bounding rectangle of that area (relative to the ...
virtual void RestoreRegion(void)
Restores the region previously saved by a call to SaveRegion().
#define MAX_NUM_FONTFACES
uint32_t CmdGetFirmwareVersion(char *pString, uint32_t MaxLength)
virtual const char * FontName(void) const
Returns the font name.
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
void CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height)
struct _tFontFace tFontFace
static const cCursesFont Font
The cOsd class is the interface to the "On Screen Display".
void CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
void CmdOsdDeleteFontFace(uint32_t hFontFace)
virtual void DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width=0, int Height=0, int Alignment=taDefault)
Draws the given string at coordinates (x, y) with the given foreground and background color and font...
static int Utf8CharLen(const char *s)
uint32_t mBitmapColors[256]
void CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
virtual cOsd * CreateOsd(int Left, int Top, uint Level)
Returns a pointer to a newly created cOsd object, which will be located at the given coordinates...
void CmdOsdDeleteDisplay(uint32_t hDisplay)
virtual void SaveRegion(int x1, int y1, int x2, int y2)
Saves the region defined by the given coordinates for later restoration through RestoreRegion().
void GetOsdSize(int &Width, int &Height, double &PixelAspect)
const tIndex * Data(int x, int y) const
Returns the address of the index byte at the given coordinates.
void CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color)
#define TEXT_ALIGN_BORDER
virtual int Size(void) const
Returns the original size as requested when the font was created.
virtual void SetActive(bool On)
Sets this OSD to be the active one.
cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf *pHdffCmdIf, uint Level)
virtual void SetActive(bool On)
Sets this OSD to be the active one.
void CmdOsdConfigure(const HdffOsdConfig_t *pConfig)
HDFF::cHdffCmdIf * mHdffCmdIf
virtual int Width(uint c) const =0
Returns the width of the given character in pixel.
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
tFontFace mFontFaces[MAX_NUM_FONTFACES]
bool IsTrueColor(void) const
Returns 'true' if this is a true color OSD (providing full 32 bit color depth).
cHdffOsdProvider(HDFF::cHdffCmdIf *pHdffCmdIf)
HDFF::cHdffCmdIf * mHdffCmdIf
cBitmap * GetBitmap(int Area)
Returns a pointer to the bitmap for the given Area, or NULL if no such bitmap exists.
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
HDFF::cHdffCmdIf * mHdffCmdIf
void CmdOsdDrawUtf8Text(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char *pText, uint32_t Color)
void CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t *pText, uint32_t Color)