vdr  2.0.7
hdffosd.c
Go to the documentation of this file.
1 /*
2  * hdffosd.c: Implementation of the DVB HD Full Featured On Screen Display
3  *
4  * See the README file for copyright information and how to reach the author.
5  */
6 
7 #include "hdffosd.h"
8 #include <linux/dvb/osd.h>
9 #include <sys/ioctl.h>
10 #include <sys/time.h>
11 #include "hdffcmd.h"
12 #include "setup.h"
13 
14 #define MAX_NUM_FONTFACES 8
15 #define MAX_NUM_FONTS 8
16 #define MAX_BITMAP_SIZE (1024*1024)
17 
18 typedef struct _tFontFace
19 {
21  uint32_t Handle;
22 } tFontFace;
23 
24 typedef struct _tFont
25 {
26  uint32_t hFontFace;
27  int Size;
28  uint32_t Handle;
29 } tFont;
30 
31 class cHdffOsd : public cOsd
32 {
33 private:
35  int mLeft;
36  int mTop;
39  bool mChanged;
40  uint32_t mDisplay;
43  uint32_t mBitmapPalette;
44  uint32_t mBitmapColors[256];
45  uint32_t mBitmapNumColors;
46 
48 
49 protected:
50  virtual void SetActive(bool On);
51 public:
52  cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level);
53  virtual ~cHdffOsd();
54  virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
55  virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
56  virtual void SaveRegion(int x1, int y1, int x2, int y2);
57  virtual void RestoreRegion(void);
58  virtual void DrawPixel(int x, int y, tColor Color);
59  virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false);
60  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);
61  virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
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);
65 };
66 
67 cHdffOsd::cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
68 : cOsd(Left, Top, Level)
69 {
70  double pixelAspect;
71  HdffOsdConfig_t config;
72 
73  //printf("cHdffOsd %d, %d, %d\n", Left, Top, Level);
74  mHdffCmdIf = pHdffCmdIf;
75  mLeft = Left;
76  mTop = Top;
77  mChanged = false;
79 
80  mSupportsUtf8Text = false;
81  if (mHdffCmdIf->CmdGetFirmwareVersion(NULL, 0) >= 0x309)
82  mSupportsUtf8Text = true;
83 
84  memset(&config, 0, sizeof(config));
85  config.FontKerning = true;
86  config.FontAntialiasing = Setup.AntiAlias ? true : false;
87  mHdffCmdIf->CmdOsdConfigure(&config);
88 
92  for (int i = 0; i < MAX_NUM_FONTFACES; i++)
93  {
94  mFontFaces[i].Name = "";
96  }
97  for (int i = 0; i < MAX_NUM_FONTS; i++)
98  {
100  mFonts[i].Size = 0;
102  }
103 }
104 
106 {
107  //printf("~cHdffOsd %d %d\n", mLeft, mTop);
108  if (Active()) {
111  }
112  SetActive(false);
113 
114  for (int i = 0; i < MAX_NUM_FONTS; i++)
115  {
116  if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
117  break;
118  mHdffCmdIf->CmdOsdDeleteFont(mFonts[i].Handle);
119  }
120  for (int i = 0; i < MAX_NUM_FONTFACES; i++)
121  {
122  if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
123  break;
125  }
126 
130 }
131 
132 eOsdError cHdffOsd::CanHandleAreas(const tArea *Areas, int NumAreas)
133 {
134  eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
135  if (Result == oeOk)
136  {
137  for (int i = 0; i < NumAreas; i++)
138  {
139  if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8)
140  return oeBppNotSupported;
141  }
142  }
143  return Result;
144 }
145 
146 eOsdError cHdffOsd::SetAreas(const tArea *Areas, int NumAreas)
147 {
148  eOsdError error;
149  cBitmap * bitmap;
150 
151  for (int i = 0; i < NumAreas; i++)
152  {
153  //printf("SetAreas %d: %d %d %d %d %d\n", i, Areas[i].x1, Areas[i].y1, Areas[i].x2, Areas[i].y2, Areas[i].bpp);
154  }
155  if (Active() && mDisplay != HDFF_INVALID_HANDLE)
156  {
159  }
160  error = cOsd::SetAreas(Areas, NumAreas);
161 
162  for (int i = 0; (bitmap = GetBitmap(i)) != NULL; i++)
163  {
164  bitmap->Clean();
165  }
166 
167  return error;
168 }
169 
170 void cHdffOsd::SetActive(bool On)
171 {
172  if (On != Active())
173  {
174  cOsd::SetActive(On);
175  if (On)
176  {
177  if (GetBitmap(0)) // only flush here if there are already bitmaps
178  Flush();
179  }
180  else if (mDisplay != HDFF_INVALID_HANDLE)
181  {
184  }
185  }
186 }
187 
188 void cHdffOsd::SaveRegion(int x1, int y1, int x2, int y2)
189 {
190  mHdffCmdIf->CmdOsdSaveRegion(mDisplay, mLeft + x1, mTop + y1, x2 - x1 + 1, y2 - y1 + 1);
191  mChanged = true;
192 }
193 
195 {
197  mChanged = true;
198 }
199 
200 void cHdffOsd::DrawPixel(int x, int y, tColor Color)
201 {
202  //printf("DrawPixel\n");
203 }
204 
205 void cHdffOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette, bool Overlay)
206 {
207  //printf("DrawBitmap %d %d %d x %d\n", x, y, Bitmap.Width(), Bitmap.Height());
208  int i;
209  int numColors;
210  const tColor * colors = Bitmap.Colors(numColors);
211 
212  for (i = 0; i < numColors; i++)
213  {
214  mBitmapColors[i] = colors[i];
215  if (ColorFg || ColorBg)
216  {
217  if (i == 0)
218  mBitmapColors[i] = ColorBg;
219  else if (i == 1)
220  mBitmapColors[i] = ColorFg;
221  }
222  }
224  {
227  }
228  else
229  {
231  HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
232  }
233  int width = Bitmap.Width();
234  int height = Bitmap.Height();
235  int chunk = MAX_BITMAP_SIZE / width;
236  if (chunk > height)
237  chunk = height;
238  for (int yc = 0; yc < height; yc += chunk)
239  {
240  int hc = chunk;
241  if (yc + hc > height)
242  hc = height - yc;
244  (uint8_t *) Bitmap.Data(0, yc), width, hc,
246  }
247  mChanged = true;
248 }
249 
250 void cHdffOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
251 {
252  int w = Font->Width(s);
253  int h = Font->Height();
254  int cw = Width ? Width : w;
255  int ch = Height ? Height : h;
256  int i;
257  int size = Font->Size();
258  tFontFace * pFontFace;
259  tFont * pFont;
260 
261  if (ColorBg != clrTransparent)
262  mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, mLeft + x, mTop + y, cw, ch, ColorBg);
263 
264  if (s == NULL)
265  return;
266 
267  pFontFace = NULL;
268  for (i = 0; i < MAX_NUM_FONTFACES; i++)
269  {
270  if (mFontFaces[i].Handle == HDFF_INVALID_HANDLE)
271  break;
272 
273  if (strcmp(mFontFaces[i].Name, Font->FontName()) == 0)
274  {
275  pFontFace = &mFontFaces[i];
276  break;
277  }
278  }
279  if (pFontFace == NULL)
280  {
281  if (i < MAX_NUM_FONTFACES)
282  {
283  cString fontFileName = Font->FontName();
284  FILE * fp = fopen(fontFileName, "rb");
285  if (fp)
286  {
287  fseek(fp, 0, SEEK_END);
288  long fileSize = ftell(fp);
289  fseek(fp, 0, SEEK_SET);
290  if (fileSize > 0)
291  {
292  uint8_t * buffer = new uint8_t[fileSize];
293  if (buffer)
294  {
295  if (fread(buffer, fileSize, 1, fp) == 1)
296  {
297  mFontFaces[i].Handle = mHdffCmdIf->CmdOsdCreateFontFace(buffer, fileSize);
298  if (mFontFaces[i].Handle != HDFF_INVALID_HANDLE)
299  {
300  mFontFaces[i].Name = Font->FontName();
301  pFontFace = &mFontFaces[i];
302  }
303  }
304  delete[] buffer;
305  }
306  }
307  fclose(fp);
308  }
309  }
310  }
311  if (pFontFace == NULL)
312  return;
313 
314  pFont = NULL;
315  for (i = 0; i < MAX_NUM_FONTS; i++)
316  {
317  if (mFonts[i].Handle == HDFF_INVALID_HANDLE)
318  break;
319 
320  if (mFonts[i].hFontFace == pFontFace->Handle
321  && mFonts[i].Size == size)
322  {
323  pFont = &mFonts[i];
324  break;
325  }
326  }
327  if (pFont == NULL)
328  {
329  if (i < MAX_NUM_FONTS)
330  {
331  mFonts[i].Handle = mHdffCmdIf->CmdOsdCreateFont(pFontFace->Handle, size);
332  if (mFonts[i].Handle != HDFF_INVALID_HANDLE)
333  {
334  mFonts[i].hFontFace = pFontFace->Handle;
335  mFonts[i].Size = size;
336  pFont = &mFonts[i];
337  }
338  }
339  }
340  if (pFont == NULL)
341  return;
342 
343  mHdffCmdIf->CmdOsdSetDisplayClippingArea(mDisplay, true, mLeft + x, mTop + y, cw, ch);
344 
345  if (Width || Height)
346  {
347  if (Width)
348  {
349  if ((Alignment & taLeft) != 0)
350  {
351 #if (APIVERSNUM >= 10728)
352  if ((Alignment & taBorder) != 0)
353  x += max(h / TEXT_ALIGN_BORDER, 1);
354 #endif
355  }
356  else if ((Alignment & taRight) != 0)
357  {
358  if (w < Width)
359  x += Width - w;
360 #if (APIVERSNUM >= 10728)
361  if ((Alignment & taBorder) != 0)
362  x -= max(h / TEXT_ALIGN_BORDER, 1);
363 #endif
364  }
365  else
366  { // taCentered
367  if (w < Width)
368  x += (Width - w) / 2;
369  }
370  }
371  if (Height)
372  {
373  if ((Alignment & taTop) != 0)
374  ;
375  else if ((Alignment & taBottom) != 0)
376  {
377  if (h < Height)
378  y += Height - h;
379  }
380  else
381  { // taCentered
382  if (h < Height)
383  y += (Height - h) / 2;
384  }
385  }
386  }
387 #if 0
388  if (mSupportsUtf8Text)
389  {
390  mHdffCmdIf->CmdOsdDrawUtf8Text(mDisplay, pFont->Handle, x + mLeft, y + mTop + h, s, ColorFg);
391  }
392  else
393 #endif
394  {
395  uint16_t tmp[1000];
396  uint16_t len = 0;
397  while (*s && (len < (sizeof(tmp) - 1)))
398  {
399  int sl = Utf8CharLen(s);
400  uint sym = Utf8CharGet(s, sl);
401  s += sl;
402  tmp[len] = sym;
403  len++;
404  }
405  tmp[len] = 0;
406  mHdffCmdIf->CmdOsdDrawTextW(mDisplay, pFont->Handle, x + mLeft, y + mTop + h, tmp, ColorFg);
407  }
408  mHdffCmdIf->CmdOsdSetDisplayClippingArea(mDisplay, false, 0, 0, 0, 0);
409  mChanged = true;
410 }
411 
412 void cHdffOsd::DrawRectangle(int x1, int y1, int x2, int y2, tColor Color)
413 {
414  mHdffCmdIf->CmdOsdDrawRectangle(mDisplay, mLeft + x1, mTop + y1, x2 - x1 + 1, y2 - y1 + 1, Color);
415  mChanged = true;
416 }
417 
418 void cHdffOsd::DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants)
419 {
420  uint32_t flags;
421  int cx;
422  int cy;
423  int rx;
424  int ry;
425 
426  switch (abs(Quadrants))
427  {
428  case 1:
429  if (Quadrants > 0)
431  else
433  cx = x1;
434  cy = y2;
435  rx = x2 - x1;
436  ry = y2 - y1;
437  break;
438  case 2:
439  if (Quadrants > 0)
441  else
443  cx = x2;
444  cy = y2;
445  rx = x2 - x1;
446  ry = y2 - y1;
447  break;
448  case 3:
449  if (Quadrants > 0)
451  else
453  cx = x2;
454  cy = y1;
455  rx = x2 - x1;
456  ry = y2 - y1;
457  break;
458  case 4:
459  if (Quadrants > 0)
461  else
463  cx = x1;
464  cy = y1;
465  rx = x2 - x1;
466  ry = y2 - y1;
467  break;
468  case 5:
469  flags = HDFF_DRAW_HALF_RIGHT;
470  cx = x1;
471  cy = (y1 + y2) / 2;
472  rx = x2 - x1;
473  ry = (y2 - y1) / 2;
474  break;
475  case 6:
476  flags = HDFF_DRAW_HALF_TOP;
477  cx = (x1 + x2) / 2;
478  cy = y2;
479  rx = (x2 - x1) / 2;
480  ry = y2 - y1;
481  break;
482  case 7:
483  flags = HDFF_DRAW_HALF_LEFT;
484  cx = x2;
485  cy = (y1 + y2) / 2;
486  rx = x2 - x1;
487  ry = (y2 - y1) / 2;
488  break;
489  case 8:
490  flags = HDFF_DRAW_HALF_BOTTOM;
491  cx = (x1 + x2) / 2;
492  cy = y1;
493  rx = (x2 - x1) / 2;
494  ry = y2 - y1;
495  break;
496  default:
497  flags = HDFF_DRAW_FULL;
498  cx = (x1 + x2) / 2;
499  cy = (y1 + y2) / 2;
500  rx = (x2 - x1) / 2;
501  ry = (y2 - y1) / 2;
502  break;
503  }
504  mHdffCmdIf->CmdOsdDrawEllipse(mDisplay, mLeft + cx, mTop + cy, rx, ry, Color, flags);
505  mChanged = true;
506 }
507 
508 void cHdffOsd::DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type)
509 {
510  //printf("DrawSlope\n");
512  x2 - x1 + 1, y2 - y1 + 1, Color, Type);
513  mChanged = true;
514 }
515 
516 void cHdffOsd::Flush(void)
517 {
518  if (!Active())
519  return;
520 
521  //printf("Flush\n");
522  cBitmap * Bitmap;
523 
524  for (int i = 0; (Bitmap = GetBitmap(i)) != NULL; i++)
525  {
526  int x1;
527  int y1;
528  int x2;
529  int y2;
530 
531  if (Bitmap->Dirty(x1, y1, x2, y2))
532  {
533  //printf("dirty %d %d, %d %d\n", x1, y1, x2, y2);
534  DrawBitmap(0, 0, *Bitmap);
535  Bitmap->Clean();
536  }
537  }
538 
539  if (!mChanged)
540  return;
541 
543 
544  mChanged = false;
545 }
546 
547 
548 class cHdffOsdRaw : public cOsd
549 {
550 private:
554  bool refresh;
555  uint32_t mDisplay;
556  uint32_t mBitmapPalette;
557  uint32_t mBitmapColors[256];
559 
560 protected:
561  virtual void SetActive(bool On);
562 public:
563  cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level);
564  virtual ~cHdffOsdRaw();
565  virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
566  virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
567  virtual void Flush(void);
568 };
569 
570 cHdffOsdRaw::cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf * pHdffCmdIf, uint Level)
571 : cOsd(Left, Top, Level)
572 {
573  double pixelAspect;
574 
575  //printf("cHdffOsdRaw %d, %d, %d\n", Left, Top, Level);
576  mHdffCmdIf = pHdffCmdIf;
577  refresh = true;
580 
582 }
583 
585 {
586  //printf("~cHdffOsdRaw %d %d\n", Left(), Top());
588  {
591  }
598 }
599 
601 {
602  if (On != Active())
603  {
604  cOsd::SetActive(On);
605  if (On)
606  {
608  {
612  }
613  refresh = true;
614  if (GetBitmap(0)) // only flush here if there are already bitmaps
615  Flush();
616  }
617  else
618  {
620  {
623  }
630  }
631  }
632 }
633 
634 eOsdError cHdffOsdRaw::CanHandleAreas(const tArea *Areas, int NumAreas)
635 {
636  eOsdError Result = cOsd::CanHandleAreas(Areas, NumAreas);
637  if (Result == oeOk)
638  {
639  for (int i = 0; i < NumAreas; i++)
640  {
641  if (Areas[i].bpp != 1 && Areas[i].bpp != 2 && Areas[i].bpp != 4 && Areas[i].bpp != 8
642  && (Areas[i].bpp != 32 || !gHdffSetup.TrueColorOsd))
643  return oeBppNotSupported;
644  }
645  }
646  return Result;
647 }
648 
649 eOsdError cHdffOsdRaw::SetAreas(const tArea *Areas, int NumAreas)
650 {
651  for (int i = 0; i < NumAreas; i++)
652  {
653  //printf("SetAreas %d: %d %d %d %d %d\n", i, Areas[i].x1, Areas[i].y1, Areas[i].x2, Areas[i].y2, Areas[i].bpp);
654  }
656  {
659  refresh = true;
660  }
661  return cOsd::SetAreas(Areas, NumAreas);
662 }
663 
665 {
666  if (!Active() || (mDisplay == HDFF_INVALID_HANDLE))
667  return;
668  //struct timeval start;
669  //struct timeval end;
670  //struct timezone timeZone;
671  //gettimeofday(&start, &timeZone);
672 
673  bool render = false;
674  if (IsTrueColor())
675  {
676  LOCK_PIXMAPS;
677  while (cPixmapMemory *pm = RenderPixmaps())
678  {
679  int w = pm->ViewPort().Width();
680  int h = pm->ViewPort().Height();
681  int d = w * sizeof(tColor);
682  int Chunk = MAX_BITMAP_SIZE / w / sizeof(tColor);
683  if (Chunk > h)
684  Chunk = h;
685  for (int y = 0; y < h; y += Chunk)
686  {
687  int hc = Chunk;
688  if (y + hc > h)
689  hc = h - y;
691  Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y() + y,
692  pm->Data() + y * d, w, hc, hc * d,
694  }
695  delete pm;
696  render = true;
697  }
698  }
699  else
700  {
701  uint8_t * buffer = new uint8_t[MAX_BITMAP_SIZE];
702  if (!buffer)
703  return;
704  cBitmap * bitmap;
705  for (int i = 0; (bitmap = GetBitmap(i)) != NULL; i++)
706  {
707  int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
708  if (refresh || bitmap->Dirty(x1, y1, x2, y2))
709  {
710  if (refresh)
711  {
712  x2 = bitmap->Width() - 1;
713  y2 = bitmap->Height() - 1;
714  }
715  // commit colors:
716  int numColors;
717  const tColor * colors = bitmap->Colors(numColors);
718  if (colors)
719  {
720  for (int c = 0; c < numColors; c++)
721  mBitmapColors[c] = colors[c];
723  {
726  }
727  else
728  {
730  HDFF_COLOR_FORMAT_ARGB, 0, numColors, mBitmapColors);
731  }
732  }
733  // commit modified data:
734  int width = x2 - x1 + 1;
735  int height = y2 - y1 + 1;
736  int chunk = MAX_BITMAP_SIZE / width;
737  if (chunk > height)
738  chunk = height;
739  for (int y = 0; y < height; y += chunk)
740  {
741  int hc = chunk;
742  if (y + hc > height)
743  hc = height - y;
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,
748  buffer, width, hc, hc * width,
750  }
751  render = true;
752  }
753  bitmap->Clean();
754  }
755  delete[] buffer;
756  }
757  if (render)
758  {
760  //gettimeofday(&end, &timeZone);
761  //int timeNeeded = end.tv_usec - start.tv_usec;
762  //timeNeeded += (end.tv_sec - start.tv_sec) * 1000000;
763  //printf("time = %d\n", timeNeeded);
764  }
765  refresh = false;
766 }
767 
768 
769 
770 
772 {
773  mHdffCmdIf = HdffCmdIf;
774 }
775 
776 cOsd *cHdffOsdProvider::CreateOsd(int Left, int Top, uint Level)
777 {
778  //printf("CreateOsd %d %d %d\n", Left, Top, Level);
780  return new cHdffOsd(Left, Top, mHdffCmdIf, Level);
781  else
782  return new cHdffOsdRaw(Left, Top, mHdffCmdIf, Level);
783 }
784 
786 {
788 }
uint32_t CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size)
Definition: hdffcmd.c:282
void CmdOsdRenderDisplay(uint32_t hDisplay)
Definition: hdffcmd.c:226
int AntiAlias
Definition: config.h:318
uint32_t hFontFace
Definition: hdffosd.c:26
uint32_t mBitmapPalette
Definition: hdffosd.c:43
virtual bool ProvidesTrueColor(void)
Returns true if this OSD provider is able to handle a true color OSD.
Definition: hdffosd.c:785
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)
Definition: hdffcmd.c:339
void Clean(void)
Marks the dirty area as clean.
Definition: osd.c:354
virtual ~cHdffOsdRaw()
Definition: hdffosd.c:584
cHdffOsd(int Left, int Top, HDFF::cHdffCmdIf *pHdffCmdIf, uint Level)
Definition: hdffosd.c:67
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition: osd.c:1800
virtual void SetActive(bool On)
Sets this OSD to be the active one.
Definition: osd.h:753
uint32_t CmdOsdCreatePalette(HdffColorType_t ColorType, HdffColorFormat_t ColorFormat, uint32_t NumColors, const uint32_t *pColors)
Definition: hdffcmd.c:232
uint32_t CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType)
Definition: hdffcmd.c:191
cHdffSetup gHdffSetup
Definition: setup.c:16
Definition: osd.h:163
const tColor * Colors(int &NumColors) const
Returns a pointer to the complete color table and stores the number of valid entries in NumColors...
Definition: osd.c:185
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...
Definition: hdffosd.c:200
#define HDFF_INVALID_HANDLE
Definition: hdffcmd_osd.h:28
void CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat, uint8_t StartColor, uint32_t NumColors, const uint32_t *pColors)
Definition: hdffcmd.c:256
uint32_t mBitmapNumColors
Definition: hdffosd.c:45
Definition: hdffosd.c:24
void CmdOsdDeletePalette(uint32_t hPalette)
Definition: hdffcmd.c:246
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition: hdffosd.c:634
bool Active(void)
Definition: osd.h:752
void CmdOsdRestoreRegion(uint32_t hDisplay)
Definition: hdffcmd.c:353
uint32_t Handle
Definition: hdffosd.c:28
T max(T a, T b)
Definition: tools.h:55
virtual void Flush(void)
Actually commits all data to the OSD hardware.
Definition: hdffosd.c:516
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...
Definition: hdffosd.c:508
bool mSupportsUtf8Text
Definition: hdffosd.c:47
virtual void Flush(void)
Actually commits all data to the OSD hardware.
Definition: hdffosd.c:664
int HighLevelOsd
Definition: setup.h:37
uint32_t mBitmapNumColors
Definition: hdffosd.c:558
cPixmapMemory * RenderPixmaps(void)
Renders the dirty part of all pixmaps into a resulting pixmap that shall be displayed on the OSD...
Definition: osd.c:1729
void CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY, uint32_t Color, uint32_t Flags)
Definition: hdffcmd.c:307
tFont mFonts[MAX_NUM_FONTS]
Definition: hdffosd.c:42
void CmdOsdDrawSlope(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color, uint32_t Type)
Definition: hdffcmd.c:314
uint32_t mBitmapColors[256]
Definition: hdffosd.c:557
int mDispWidth
Definition: hdffosd.c:37
#define MAX_NUM_FONTS
Definition: hdffosd.c:15
void CmdOsdDeleteFont(uint32_t hFont)
Definition: hdffcmd.c:295
uint32_t CmdOsdCreateFontFace(const uint8_t *pFontData, uint32_t DataSize)
Definition: hdffcmd.c:263
#define LOCK_PIXMAPS
Definition: osd.h:673
Definition: osd.h:169
int Width(void) const
Definition: osd.h:188
virtual ~cHdffOsd()
Definition: hdffosd.c:105
int TrueColorOsd
Definition: setup.h:38
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...
Definition: hdffosd.c:418
#define HDFF_SIZE_FULL_SCREEN
Definition: hdffcmd_osd.h:33
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition: hdffosd.c:132
Definition: osd.h:161
virtual int Height(void) const =0
Returns the height of this font in pixel (all characters have the same height).
int Top(void)
Definition: osd.h:796
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...
Definition: hdffosd.c:412
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 ...
Definition: hdffosd.c:205
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 ...
Definition: osd.c:342
virtual void RestoreRegion(void)
Restores the region previously saved by a call to SaveRegion().
Definition: hdffosd.c:194
int width
Definition: osd.h:728
#define MAX_NUM_FONTFACES
Definition: hdffosd.c:14
int Height(void) const
Definition: osd.h:189
uint32_t CmdGetFirmwareVersion(char *pString, uint32_t MaxLength)
Definition: hdffcmd.c:33
virtual const char * FontName(void) const
Returns the font name.
Definition: font.h:42
Definition: osd.h:162
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition: osd.c:1778
void CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height)
Definition: hdffcmd.c:348
Definition: osd.h:164
int mDispHeight
Definition: hdffosd.c:38
struct _tFontFace tFontFace
static const cCursesFont Font
Definition: skincurses.c:30
int mTop
Definition: hdffosd.c:36
The cOsd class is the interface to the "On Screen Display".
Definition: osd.h:716
int mDispHeight
Definition: hdffosd.c:553
void CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
Definition: hdffcmd.c:220
void CmdOsdDeleteFontFace(uint32_t hFontFace)
Definition: hdffcmd.c:276
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...
Definition: hdffosd.c:250
cSetup Setup
Definition: config.c:373
static int Utf8CharLen(const char *s)
Definition: si.c:409
uint32_t mBitmapColors[256]
Definition: hdffosd.c:44
void CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
Definition: hdffcmd.c:214
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...
Definition: hdffosd.c:776
void CmdOsdDeleteDisplay(uint32_t hDisplay)
Definition: hdffcmd.c:202
int Height(void)
Definition: osd.h:798
int Y0(void) const
Definition: osd.h:187
virtual void SaveRegion(int x1, int y1, int x2, int y2)
Saves the region defined by the given coordinates for later restoration through RestoreRegion().
Definition: hdffosd.c:188
void GetOsdSize(int &Width, int &Height, double &PixelAspect)
Definition: setup.c:62
const tIndex * Data(int x, int y) const
Returns the address of the index byte at the given coordinates.
Definition: osd.c:749
void CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color)
Definition: hdffcmd.c:301
uint32_t mBitmapPalette
Definition: hdffosd.c:556
#define TEXT_ALIGN_BORDER
Definition: osd.h:28
virtual int Size(void) const
Returns the original size as requested when the font was created.
Definition: font.h:44
struct _tFont tFont
Definition: osd.h:294
#define MAX_BITMAP_SIZE
Definition: hdffosd.c:16
virtual void SetActive(bool On)
Sets this OSD to be the active one.
Definition: hdffosd.c:600
int Width(void)
Definition: osd.h:797
eOsdError
Definition: osd.h:44
Definition: osd.h:159
cHdffOsdRaw(int Left, int Top, HDFF::cHdffCmdIf *pHdffCmdIf, uint Level)
Definition: hdffosd.c:570
bool mChanged
Definition: hdffosd.c:39
int Left(void)
Definition: osd.h:795
virtual void SetActive(bool On)
Sets this OSD to be the active one.
Definition: hdffosd.c:170
uint Utf8CharGet(const char *s, int Length)
Returns the UTF-8 symbol at the beginning of the given string.
Definition: tools.c:722
int height
Definition: osd.h:728
uint32_t Handle
Definition: hdffosd.c:21
uint32_t mDisplay
Definition: hdffosd.c:555
void CmdOsdConfigure(const HdffOsdConfig_t *pConfig)
Definition: hdffcmd.c:181
HDFF::cHdffCmdIf * mHdffCmdIf
Definition: hdffosd.c:551
Definition: osd.h:44
cString Name
Definition: hdffosd.c:20
Definition: osd.h:160
virtual int Width(uint c) const =0
Returns the width of the given character in pixel.
int Size
Definition: hdffosd.c:27
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition: hdffosd.c:146
uint32_t mDisplay
Definition: hdffosd.c:40
int mLeft
Definition: hdffosd.c:35
int X0(void) const
Definition: osd.h:186
tFontFace mFontFaces[MAX_NUM_FONTFACES]
Definition: hdffosd.c:41
bool IsTrueColor(void) const
Returns 'true' if this is a true color OSD (providing full 32 bit color depth).
Definition: osd.h:792
cHdffOsdProvider(HDFF::cHdffCmdIf *pHdffCmdIf)
Definition: hdffosd.c:771
HDFF::cHdffCmdIf * mHdffCmdIf
Definition: hdffosd.h:17
cBitmap * GetBitmap(int Area)
Returns a pointer to the bitmap for the given Area, or NULL if no such bitmap exists.
Definition: osd.c:1683
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition: hdffosd.c:649
Definition: font.h:37
bool refresh
Definition: hdffosd.c:554
int mDispWidth
Definition: hdffosd.c:552
Definition: tools.h:166
HDFF::cHdffCmdIf * mHdffCmdIf
Definition: hdffosd.c:34
void CmdOsdDrawUtf8Text(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char *pText, uint32_t Color)
Definition: hdffcmd.c:327
void CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t *pText, uint32_t Color)
Definition: hdffcmd.c:333
uint32_t tColor
Definition: font.h:29