vdr  2.2.0
osddemo.c
Go to the documentation of this file.
1 /*
2  * osddemo.c: A plugin for the Video Disk Recorder
3  *
4  * See the README file for copyright information and how to reach the author.
5  *
6  * $Id: osddemo.c 3.4 2015/02/17 13:12:36 kls Exp $
7  */
8 
9 #include <vdr/osd.h>
10 #include <vdr/plugin.h>
11 
12 static const char *VERSION = "2.2.0";
13 static const char *DESCRIPTION = "Demo of arbitrary OSD setup";
14 static const char *MAINMENUENTRY = "Osd Demo";
15 
16 // --- DrawEllipses ----------------------------------------------------------
17 
18 void DrawEllipse(cOsd *Osd, int x1, int y1, int x2, int y2, int Quadrants)
19 {
20  Osd->DrawRectangle(x1 + 2, y1 + 2, x2 - 2, y2 - 2, clrGreen);
21  Osd->DrawEllipse(x1 + 3, y1 + 3, x2 - 3, y2 - 3, clrRed, Quadrants);
22 }
23 
24 void DrawEllipses(cOsd *Osd)
25 {
26  int xa = 0;
27  int ya = 0;
28  int xb = Osd->Width() - 1;
29  int yb = Osd->Height() - 1;
30  int x0 = xa;
31  int x5 = xb;
32  int x1 = x0 + (xb - xa) / 5;
33  int x2 = x0 + (xb - xa) * 2 / 5;
34  int x3 = x0 + (xb - xa) * 3 / 5;
35  int x4 = x0 + (xb - xa) * 4 / 5;
36  int y0 = ya;
37  int y4 = yb;
38  int y2 = (y0 + y4) / 2;
39  int y1 = (y0 + y2) / 2;
40  int y3 = (y2 + y4) / 2;
41  Osd->DrawRectangle(xa, ya, xb, yb, clrGray50);
42  DrawEllipse(Osd, x4, y0, x5, y4, 0);
43  DrawEllipse(Osd, x2, y1, x3, y2, 1);
44  DrawEllipse(Osd, x1, y1, x2, y2, 2);
45  DrawEllipse(Osd, x1, y2, x2, y3, 3);
46  DrawEllipse(Osd, x2, y2, x3, y3, 4);
47  DrawEllipse(Osd, x3, y1, x4, y3, 5);
48  DrawEllipse(Osd, x1, y0, x3, y1, 6);
49  DrawEllipse(Osd, x0, y1, x1, y3, 7);
50  DrawEllipse(Osd, x1, y3, x3, y4, 8);
51  DrawEllipse(Osd, x3, y0, x4, y1, -1);
52  DrawEllipse(Osd, x0, y0, x1, y1, -2);
53  DrawEllipse(Osd, x0, y3, x1, y4, -3);
54  DrawEllipse(Osd, x3, y3, x4, y4, -4);
55  Osd->Flush();
56 }
57 
58 // --- DrawSlopes ------------------------------------------------------------
59 
60 void DrawSlope(cOsd *Osd, int x1, int y1, int x2, int y2, int Type)
61 {
62  Osd->DrawRectangle(x1 + 2, y1 + 2, x2 - 2, y2 - 2, clrGreen);
63  Osd->DrawSlope(x1 + 3, y1 + 3, x2 - 3, y2 - 3, clrRed, Type);
64 }
65 
66 void DrawSlopes(cOsd *Osd)
67 {
68  int xa = 0;
69  int ya = 0;
70  int xb = Osd->Width() - 1;
71  int yb = Osd->Height() - 1;
72  int x0 = xa;
73  int x4 = xb;
74  int x2 = (x0 + x4) / 2;
75  int x1 = (x0 + x2) / 2;
76  int x3 = (x2 + x4) / 2;
77  int y0 = ya;
78  int y3 = yb;
79  int y2 = (y0 + y3) / 2;
80  int y1 = (y0 + y2) / 2;
81  Osd->DrawRectangle(xa, ya, xb, yb, clrGray50);
82  DrawSlope(Osd, x0, y0, x2, y1, 0);
83  DrawSlope(Osd, x2, y0, x4, y1, 1);
84  DrawSlope(Osd, x0, y1, x2, y2, 2);
85  DrawSlope(Osd, x2, y1, x4, y2, 3);
86  DrawSlope(Osd, x0, y2, x1, y3, 4);
87  DrawSlope(Osd, x1, y2, x2, y3, 5);
88  DrawSlope(Osd, x2, y2, x3, y3, 6);
89  DrawSlope(Osd, x3, y2, x4, y3, 7);
90  Osd->Flush();
91 }
92 
93 // --- cLineGame -------------------------------------------------------------
94 
95 class cLineGame : public cOsdObject {
96 private:
98  int x;
99  int y;
101 public:
102  cLineGame(void);
103  virtual ~cLineGame();
104  virtual void Show(void);
105  virtual eOSState ProcessKey(eKeys Key);
106  };
107 
109 {
110  osd = NULL;
111  x = y = 0;
112  color = clrRed;
113 }
114 
116 {
117  delete osd;
118 }
119 
120 void cLineGame::Show(void)
121 {
123  if (osd) {
124  int x1 = cOsd::OsdWidth() - 1;
125  int y1 = cOsd::OsdHeight() - 1;
126  while (x1 > 0 && y1 > 0) {
127  tArea Area = { 0, 0, x1, y1, 4 };
128  if (osd->CanHandleAreas(&Area, 1) == oeOk) {
129  osd->SetAreas(&Area, 1);
130  osd->DrawRectangle(0, 0, osd->Width() - 1, osd->Height() - 1, clrGray50);
131  osd->Flush();
132  x = osd->Width() / 2;
133  y = osd->Height() / 2;
134  break;
135  }
136  x1 = x1 * 9 / 10;
137  y1 = y1 * 9 / 10;
138  }
139  }
140 }
141 
143 {
144  eOSState state = cOsdObject::ProcessKey(Key);
145  if (state == osUnknown) {
146  const int d = 4;
147  switch (Key & ~k_Repeat) {
148  case kUp: y = max(0, y - d); break;
149  case kDown: y = min(osd->Height() - d, y + d); break;
150  case kLeft: x = max(0, x - d); break;
151  case kRight: x = min(osd->Width() - d, x + d); break;
152  case kRed: color = clrRed; break;
153  case kGreen: color = clrGreen; break;
154  case kYellow: color = clrYellow; break;
155  case kBlue: color = clrBlue; break;
156  case k1: DrawEllipses(osd);
157  return osContinue;
158  case k2: DrawSlopes(osd);
159  return osContinue;
160  case kBack:
161  case kOk: return osEnd;
162  default: return state;
163  }
164  osd->DrawRectangle(x, y, x + d - 1, y + d - 1, color);
165  osd->Flush();
166  state = osContinue;
167  }
168  return state;
169 }
170 
171 // --- cTrueColorDemo --------------------------------------------------------
172 
173 class cTrueColorDemo : public cOsdObject, public cThread {
174 private:
178  bool clockwise;
181  bool SetArea(void);
182  virtual void Action(void);
183  cPixmap *CreateTextPixmap(const char *s, int Line, int Layer, tColor ColorFg, tColor ColorBg, const cFont *Font);
184 public:
185  cTrueColorDemo(void);
186  virtual ~cTrueColorDemo();
187  virtual void Show(void);
188  virtual eOSState ProcessKey(eKeys Key);
189  };
190 
192 {
193  osd = NULL;
194  clockwise = true;
195  destroyablePixmap = NULL;
196  toggleablePixmap = NULL;
197 }
198 
200 {
201  Cancel(3);
202  delete osd;
203 }
204 
205 cPixmap *cTrueColorDemo::CreateTextPixmap(const char *s, int Line, int Layer, tColor ColorFg, tColor ColorBg, const cFont *Font)
206 {
207  const int h = Font->Height(s);
208  int w = Font->Width(s);
209  cPixmap *Pixmap = osd->CreatePixmap(Layer, cRect((osd->Width() - w) / 2, Line, w, h));
210  if (Pixmap) {
211  Pixmap->Clear();
212  Pixmap->SetAlpha(0);
213  Pixmap->DrawText(cPoint(0, 0), s, ColorFg, ColorBg, Font);
214  }
215  return Pixmap;
216 }
217 
219 {
220  cPixmap *FadeInPixmap = NULL;
221  cPixmap *FadeOutPixmap = NULL;
222  cPixmap *MovePixmap = NULL;
223  cPixmap *NextPixmap = NULL;
224  cPixmap *TilePixmap = NULL;
225  cPixmap *ScrollPixmap = NULL;
226  cPixmap *AnimPixmap = NULL;
229  cFont *LrgFont = cFont::CreateFont(Setup.FontOsd, osd->Height() / 10);
230  int FrameTime = 40; // ms
231  int FadeTime = 1000; // ms
232  int MoveTime = 4000; // ms
233  int TileTime = 6000; // ms
234  int ScrollWaitTime = 1000; // ms
235  int ScrollLineTime = 200; // ms
236  int ScrollTotalTime = 8000; // ms
237  uint64_t Start = 0;
238  uint64_t ScrollStartTime = 0;
239  int ScrollLineNumber = 0;
240  cPoint MoveStart, MoveEnd;
241  cPoint TileStart, TileEnd;
242  cPoint ScrollStart, ScrollEnd;
243  int Line = osd->Height() / 20;
244  int StartLine = Line;
245  cPoint OldCursor;
246  int State = 0;
247  while (Running()) {
248  cPixmap::Lock();
249  bool Animated = false;
250  uint64_t Now = cTimeMs::Now();
251  if (FadeInPixmap) {
252  double t = min(double(Now - Start) / FadeTime, 1.0);
253  int Alpha = t * ALPHA_OPAQUE;
254  FadeInPixmap->SetAlpha(Alpha);
255  if (t >= 1)
256  FadeInPixmap = NULL;
257  Animated = true;
258  }
259  if (FadeOutPixmap) {
260  double t = min(double(Now - Start) / FadeTime, 1.0);
261  int Alpha = ALPHA_OPAQUE - t * ALPHA_OPAQUE;
262  FadeOutPixmap->SetAlpha(Alpha);
263  if (t >= 1)
264  FadeOutPixmap = NULL;
265  Animated = true;
266  }
267  if (MovePixmap) {
268  double t = min(double(Now - Start) / MoveTime, 1.0);
269  int x = MoveStart.X() + t * (MoveEnd.X() - MoveStart.X());
270  int y = MoveStart.Y() + t * (MoveEnd.Y() - MoveStart.Y());
271  cRect r = MovePixmap->ViewPort();
272  r.SetPoint(x, y);
273  MovePixmap->SetViewPort(r);
274  if (t >= 1)
275  MovePixmap = NULL;
276  Animated = true;
277  }
278  if (TilePixmap) {
279  double t = min(double(Now - Start) / TileTime, 1.0);
280  int x = TileStart.X() + t * (TileEnd.X() - TileStart.X());
281  int y = TileStart.Y() + t * (TileEnd.Y() - TileStart.Y());
282  TilePixmap->SetDrawPortPoint(cPoint(x, y));
283  if (t >= 1) {
284  destroyablePixmap = TilePixmap;
285  TilePixmap = NULL;
286  }
287  Animated = true;
288  }
289  if (ScrollPixmap) {
290  if (int(Now - Start) > ScrollWaitTime) {
291  if (ScrollStartTime) {
292  double t = min(double(Now - ScrollStartTime) / ScrollLineTime, 1.0);
293  int x = ScrollStart.X() + t * (ScrollEnd.X() - ScrollStart.X());
294  int y = ScrollStart.Y() + t * (ScrollEnd.Y() - ScrollStart.Y());
295  ScrollPixmap->SetDrawPortPoint(cPoint(x, y));
296  if (t >= 1) {
297  if (int(Now - Start) < ScrollTotalTime) {
298  cRect r = ScrollPixmap->DrawPort();
299  r.SetPoint(-r.X(), -r.Y());
300  ScrollPixmap->Pan(cPoint(0, 0), r);
301  cString s = cString::sprintf("Line %d", ++ScrollLineNumber);
302  ScrollPixmap->DrawRectangle(cRect(0, ScrollPixmap->ViewPort().Height(), ScrollPixmap->DrawPort().Width(), ScrollPixmap->DrawPort().Height()), clrTransparent);
303  ScrollPixmap->DrawText(cPoint(0, ScrollPixmap->ViewPort().Height()), s, clrYellow, clrTransparent, OsdFont);
304  ScrollStartTime = Now;
305  }
306  else {
307  FadeOutPixmap = ScrollPixmap;
308  ScrollPixmap = NULL;
309  Start = cTimeMs::Now();
310  }
311  }
312  }
313  else
314  ScrollStartTime = Now;
315  }
316  Animated = true;
317  }
318  if (AnimPixmap) {
319  int d = AnimPixmap->ViewPort().Height();
320  if (clockwise)
321  d = -d;
322  cPoint p = AnimPixmap->DrawPort().Point().Shifted(0, d);
323  if (clockwise && p.Y() <= -AnimPixmap->DrawPort().Height())
324  p.SetY(0);
325  else if (!clockwise && p.Y() > 0)
326  p.SetY(-(AnimPixmap->DrawPort().Height() - AnimPixmap->ViewPort().Height()));
327  AnimPixmap->SetDrawPortPoint(p);
328  }
329  if (!Animated) {
330  switch (State) {
331  case 0: {
332  FadeInPixmap = CreateTextPixmap("VDR", Line, 1, clrYellow, clrTransparent, LrgFont);
333  if (FadeInPixmap)
334  Line += FadeInPixmap->DrawPort().Height();
335  Start = cTimeMs::Now();
336  State++;
337  }
338  break;
339  case 1: {
340  FadeInPixmap = CreateTextPixmap("Video Disk Recorder", Line, 3, clrYellow, clrTransparent, OsdFont);
341  if (FadeInPixmap)
342  Line += FadeInPixmap->DrawPort().Height();
343  Start = cTimeMs::Now();
344  State++;
345  }
346  break;
347  case 2: {
348  FadeInPixmap = CreateTextPixmap("True Color OSD Demo", Line, 1, clrYellow, clrTransparent, OsdFont);
349  if (FadeInPixmap)
350  Line += FadeInPixmap->DrawPort().Height();
351  Start = cTimeMs::Now();
352  State++;
353  }
354  break;
355  case 3: {
356  NextPixmap = CreateTextPixmap("Millions of colors", Line, 1, clrYellow, clrTransparent, LrgFont);
357  if (NextPixmap) {
358  FadeInPixmap = NextPixmap;
359  Start = cTimeMs::Now();
360  StartLine = Line;
361  Line += NextPixmap->DrawPort().Height();
362  }
363  State++;
364  }
365  break;
366  case 4: {
367  Line += osd->Height() / 10;
368  int w = osd->Width() / 2;
369  int h = osd->Height() - Line - osd->Height() / 10;
370  cImage Image(cSize(w, h));
371  for (int y = 0; y < h; y++) {
372  for (int x = 0; x < w; x++)
373  Image.SetPixel(cPoint(x, y), HsvToColor(360 * double(x) / w, 1 - double(y) / h, 1) | 0xDF000000);
374  }
375  if (cPixmap *Pixmap = osd->CreatePixmap(2, cRect((osd->Width() - w) / 2, Line, w, h))) {
376  Pixmap->DrawImage(cPoint(0, 0), Image);
377  toggleablePixmap = Pixmap;
378  }
379  State++;
380  }
381  break;
382  case 5: {
383  if (NextPixmap) {
384  MovePixmap = NextPixmap;
385  MoveStart = MovePixmap->ViewPort().Point();
386  MoveEnd.Set(osd->Width() - MovePixmap->ViewPort().Width(), osd->Height() - MovePixmap->ViewPort().Height());
387  Start = cTimeMs::Now();
388  }
389  State++;
390  }
391  break;
392  case 6: {
393  TilePixmap = CreateTextPixmap("Tiled Pixmaps", StartLine, 1, clrRed, clrWhite, OsdFont);
394  if (TilePixmap) {
395  TilePixmap->SetViewPort(TilePixmap->ViewPort().Grown(TilePixmap->DrawPort().Width(), TilePixmap->DrawPort().Height()));
396  TilePixmap->SetAlpha(200);
397  TilePixmap->SetTile(true);
398  TileStart = TilePixmap->DrawPort().Point();
399  TileEnd = TileStart.Shifted(TilePixmap->ViewPort().Width(), TilePixmap->ViewPort().Height());
400  MovePixmap = TilePixmap;
401  MoveStart = MovePixmap->ViewPort().Point();
402  MoveEnd.Set(10, osd->Height() - MovePixmap->ViewPort().Height() - 10);
403  Start = cTimeMs::Now();
404  }
405  State++;
406  }
407  break;
408  case 7: {
409  const char *Text = "Scrolling Pixmaps";
410  int w = OsdFont->Width(Text);
411  int h = OsdFont->Height();
412  if (cPixmap *Pixmap = osd->CreatePixmap(2, cRect((osd->Width() - w) / 2, StartLine, w, 2 * h), cRect(0, 0, w, 3 * h))) {
413  Pixmap->Clear();
414  Pixmap->DrawText(cPoint(0, 0), Text, clrYellow, clrTransparent, OsdFont);
415  cString s = cString::sprintf("Line %d", ++ScrollLineNumber);
416  Pixmap->DrawText(cPoint(0, Pixmap->ViewPort().Height()), s, clrYellow, clrTransparent, OsdFont);
417  ScrollPixmap = Pixmap;
418  ScrollStart.Set(0, 0);
419  ScrollEnd.Set(0, -h);
420  Start = cTimeMs::Now();
421  }
422  State++;
423  }
424  break;
425  case 8: {
426  const char *Text = "Animation";
427  const int Size = SmlFont->Width(Text) + 10;
428  const int NumDots = 12;
429  const int AnimFrames = NumDots;
430  // Temporarily using pixmap layer 0 to have the text alpha blended:
431  AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size, Size * AnimFrames));
432  if (AnimPixmap) {
433  AnimPixmap->SetAlpha(0);
434  AnimPixmap->Clear();
435  const int Diameter = Size / 5;
436  int xc = Size / 2 - Diameter / 2;
437  for (int Frame = 0; Frame < AnimFrames; Frame++) {
438  AnimPixmap->DrawEllipse(cRect(0, Frame * Size, Size, Size), 0xDDFFFFFF);
439  int yc = Frame * Size + Size / 2 - Diameter / 2;
440  int Color = 0xFF;
441  int Delta = Color / NumDots / 3;
442  for (int a = 0; a < NumDots; a++) {
443  double t = 2 * M_PI * (Frame + a) / NumDots;
444  int x = xc + ((Size - Diameter) / 2 - 5) * cos(t);
445  int y = yc + ((Size - Diameter) / 2 - 5) * sin(t);
446  AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color));
447  Color -= Delta;
448  }
449  AnimPixmap->DrawText(cPoint(0, Frame * Size), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter);
450  }
451  AnimPixmap->SetLayer(3); // now setting the actual pixmap layer
452  FadeInPixmap = AnimPixmap;
453  LOCK_THREAD;
454  OldCursor = cursor = AnimPixmap->ViewPort().Point();
455  cursorLimits.Set(0, 0, osd->Width(), osd->Height());
456  cursorLimits.SetRight(cursorLimits.Right() - Size);
457  cursorLimits.SetBottom(cursorLimits.Bottom() - Size);
458  cursorLimits.Grow(-10, -10);
459  Start = cTimeMs::Now();
460  }
461  State++;
462  }
463  break;
464  case 9: {
465  LOCK_THREAD;
466  if (cursor != OldCursor) {
467  MovePixmap = AnimPixmap;
468  MoveStart = MovePixmap->ViewPort().Point();
469  MoveEnd = OldCursor = cursor;
470  MoveTime = 500;
471  Start = cTimeMs::Now();
472  }
473  }
474  break;
475  }
476  }
477  osd->Flush();
478  cPixmap::Unlock();
479  int Delta = cTimeMs::Now() - Now;
480  if (Delta < FrameTime)
481  cCondWait::SleepMs(FrameTime - Delta);
482  }
483  destroyablePixmap = NULL;
484  toggleablePixmap = NULL;
485  delete OsdFont;
486  delete SmlFont;
487  delete LrgFont;
488 }
489 
491 {
492  if (osd) {
493  tArea Area = { 0, 0, cOsd::OsdWidth() - 1, cOsd::OsdHeight() - 1, 32 };
494  return osd->SetAreas(&Area, 1) == oeOk;
495  }
496  return false;
497 }
498 
500 {
502  if (osd) {
503  if (SetArea()) {
504  osd->DrawRectangle(0, 0, osd->Width() - 1, osd->Height() - 1, clrGray50);
505  osd->Flush();
506  Start();
507  }
508  }
509 }
510 
512 {
513  eOSState state = cOsdObject::ProcessKey(Key);
514  if (state == osUnknown) {
515  LOCK_PIXMAPS;
516  LOCK_THREAD;
517  const int d = 80;
518  switch (Key & ~k_Repeat) {
519  case kUp: cursor.SetY(max(cursorLimits.Top(), cursor.Y() - d)); clockwise = false; break;
520  case kDown: cursor.SetY(min(cursorLimits.Bottom(), cursor.Y() + d)); clockwise = true; break;
521  case kLeft: cursor.SetX(max(cursorLimits.Left(), cursor.X() - d)); clockwise = false; break;
522  case kRight: cursor.SetX(min(cursorLimits.Right(), cursor.X() + d)); clockwise = true; break;
523  case kRed: if (destroyablePixmap) {
524  osd->DestroyPixmap(destroyablePixmap);
525  destroyablePixmap = NULL;
526  }
527  break;
528  case kGreen: if (toggleablePixmap)
529  toggleablePixmap->SetLayer(-toggleablePixmap->Layer());
530  break;
531  case k1: Cancel(3);
532  SetArea();
533  DrawEllipses(osd);
534  break;
535  case k2: Cancel(3);
536  SetArea();
537  DrawSlopes(osd);
538  break;
539  case kBack:
540  case kOk: return osEnd;
541  default: return state;
542  }
543  state = osContinue;
544  }
545  return state;
546 }
547 
548 // --- cPluginOsddemo --------------------------------------------------------
549 
550 class cPluginOsddemo : public cPlugin {
551 private:
552  // Add any member variables or functions you may need here.
553 public:
554  cPluginOsddemo(void);
555  virtual ~cPluginOsddemo();
556  virtual const char *Version(void) { return VERSION; }
557  virtual const char *Description(void) { return DESCRIPTION; }
558  virtual const char *CommandLineHelp(void);
559  virtual bool ProcessArgs(int argc, char *argv[]);
560  virtual bool Start(void);
561  virtual void Housekeeping(void);
562  virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
563  virtual cOsdObject *MainMenuAction(void);
564  virtual cMenuSetupPage *SetupMenu(void);
565  virtual bool SetupParse(const char *Name, const char *Value);
566  };
567 
569 {
570  // Initialize any member variables here.
571  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
572  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
573 }
574 
576 {
577  // Clean up after yourself!
578 }
579 
581 {
582  // Return a string that describes all known command line options.
583  return NULL;
584 }
585 
586 bool cPluginOsddemo::ProcessArgs(int argc, char *argv[])
587 {
588  // Implement command line argument processing here if applicable.
589  return true;
590 }
591 
593 {
594  // Start any background activities the plugin shall perform.
595  return true;
596 }
597 
599 {
600  // Perform any cleanup or other regular tasks.
601 }
602 
604 {
605  // Perform the action when selected from the main VDR menu.
607  return new cTrueColorDemo;
608  return new cLineGame;
609 }
610 
612 {
613  // Return a setup menu in case the plugin supports one.
614  return NULL;
615 }
616 
617 bool cPluginOsddemo::SetupParse(const char *Name, const char *Value)
618 {
619  // Parse your own setup parameters and store their values.
620  return false;
621 }
622 
623 VDRPLUGINCREATOR(cPluginOsddemo); // Don't touch this!
cLineGame(void)
Definition: osddemo.c:108
virtual eOSState ProcessKey(eKeys Key)
Definition: osddemo.c:142
static int OsdHeight(void)
Definition: osd.h:789
Definition: osd.h:36
virtual bool Start(void)
Definition: osddemo.c:592
Definition: osd.h:454
virtual const char * Version(void)
Definition: osddemo.c:556
void DrawSlopes(cOsd *Osd)
Definition: osddemo.c:66
virtual void Pan(const cPoint &Dest, const cRect &Source=cRect::Null)=0
Does the same as Scroll(), but also shifts the draw port accordingly, so that the view port doesn&#39;t g...
virtual void Housekeeping(void)
Definition: osddemo.c:598
virtual void SetViewPort(const cRect &Rect)
Sets the pixmap&#39;s view port to the given Rect.
Definition: osd.c:1066
virtual ~cTrueColorDemo()
Definition: osddemo.c:199
Definition: keys.h:23
cPoint cursor
Definition: osddemo.c:176
virtual bool SetupParse(const char *Name, const char *Value)
Definition: osddemo.c:617
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition: osd.c:1823
static const char * MAINMENUENTRY
Definition: osddemo.c:14
static cString sprintf(const char *fmt,...) __attribute__((format(printf
Definition: tools.c:1080
const cRect & DrawPort(void) const
Returns the pixmap&#39;s draw port, which is relative to the view port.
Definition: osd.h:539
Definition: osd.h:419
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: osd.c:1962
Definition: plugin.h:20
int Width(void) const
Definition: osd.h:367
Definition: keys.h:17
Definition: keys.h:61
int X(void) const
Definition: osd.h:318
virtual const char * Description(void)
Definition: osddemo.c:557
cPixmap * CreateTextPixmap(const char *s, int Line, int Layer, tColor ColorFg, tColor ColorBg, const cFont *Font)
Definition: osddemo.c:205
cPluginOsddemo(void)
Definition: osddemo.c:568
char FontSml[MAXFONTNAME]
Definition: config.h:325
Definition: osd.h:306
T max(T a, T b)
Definition: tools.h:55
virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty=true)
Sets the pixmap&#39;s draw port to the given Point.
Definition: osd.c:1083
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: osd.c:1952
Definition: keys.h:27
virtual eOSState ProcessKey(eKeys Key)
Definition: osddemo.c:511
virtual bool ProcessArgs(int argc, char *argv[])
Definition: osddemo.c:586
Definition: keys.h:25
T min(T a, T b)
Definition: tools.h:54
virtual void SetAlpha(int Alpha)
Sets the alpha value of this pixmap to the given value.
Definition: osd.c:1044
virtual void Flush(void)
Actually commits all data to the OSD hardware.
Definition: osd.c:1982
#define LOCK_PIXMAPS
Definition: osd.h:677
Definition: osd.h:158
static void Lock(void)
All public member functions of cPixmap set locks as necessary to make sure they are thread-safe (unle...
Definition: osd.h:525
Definition: osd.h:34
virtual void Show(void)
Definition: osddemo.c:120
const cRect & ViewPort(void) const
Returns the pixmap&#39;s view port, which is relative to the OSD&#39;s origin.
Definition: osd.h:535
cOsd * osd
Definition: osddemo.c:97
eOSState
Definition: osdbase.h:18
Definition: osd.h:33
void SetPoint(int X, int Y)
Definition: osd.h:377
virtual void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width=0, int Height=0, int Alignment=taDefault)=0
Draws the given string at Point with the given foreground and background color and font...
void DrawEllipse(cOsd *Osd, int x1, int y1, int x2, int y2, int Quadrants)
Definition: osddemo.c:18
int y
Definition: osddemo.c:99
void DrawEllipses(cOsd *Osd)
Definition: osddemo.c:24
static int OsdWidth(void)
Definition: osd.h:788
Definition: osdbase.h:35
cRect cursorLimits
Definition: osddemo.c:177
virtual void DestroyPixmap(cPixmap *Pixmap)
Destroys the given Pixmap, which has previously been created by a call to CreatePixmap().
Definition: osd.c:1720
Definition: osd.h:37
Definition: osd.h:39
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition: osd.c:1801
Definition: osd.h:352
virtual const char * MainMenuEntry(void)
Definition: osddemo.c:562
char FontOsd[MAXFONTNAME]
Definition: config.h:324
cOsd * osd
Definition: osddemo.c:175
static void SleepMs(int TimeoutMs)
Creates a cCondWait object and uses it to sleep for TimeoutMs milliseconds, immediately giving up the...
Definition: thread.c:57
Definition: keys.h:18
virtual ~cPluginOsddemo()
Definition: osddemo.c:575
static const cCursesFont Font
Definition: skincurses.c:30
bool clockwise
Definition: osddemo.c:178
Definition: keys.h:28
The cOsd class is the interface to the "On Screen Display".
Definition: osd.h:720
Definition: osd.h:330
cSetup Setup
Definition: config.c:373
Definition: keys.h:20
tColor color
Definition: osddemo.c:100
virtual ~cLineGame()
Definition: osddemo.c:115
static cFont * CreateFont(const char *Name, int CharHeight, int CharWidth=0)
Creates a new font object with the given Name and makes its characters CharHeight pixels high...
Definition: font.c:423
static const char * VERSION
Definition: osddemo.c:12
Definition: keys.h:26
virtual void SetTile(bool Tile)
Sets the tile property of this pixmap to the given value.
Definition: osd.c:1055
static int OsdTop(void)
Definition: osd.h:787
const cPoint & Point(void) const
Definition: osd.h:373
void DrawSlope(cOsd *Osd, int x1, int y1, int x2, int y2, int Type)
Definition: osddemo.c:60
int Height(void)
Definition: osd.h:803
static int OsdLeft(void)
Definition: osd.h:786
Definition: osd.h:41
Definition: keys.h:21
tColor ArgbToColor(uint8_t A, uint8_t R, uint8_t G, uint8_t B)
Definition: osd.h:58
void Set(int X, int Y)
Definition: osd.h:322
virtual cPixmap * CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort=cRect::Null)
Creates a new true color pixmap on this OSD (see cPixmap for details).
Definition: osd.c:1708
virtual eOSState ProcessKey(eKeys Key)
Definition: osdbase.h:83
virtual void Action(void)
A derived cThread class must implement the code it wants to execute as a separate thread in this func...
Definition: osddemo.c:218
virtual void Show(void)
Definition: osddemo.c:499
static bool SupportsTrueColor(void)
Returns true if the current OSD provider is able to handle a true color OSD.
Definition: osd.c:2061
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants=0)=0
Draws a filled ellipse with the given Color that fits into the given rectangle.
int Height(void) const
Definition: osd.h:368
Definition: osd.h:298
virtual int Width(uint c) const =0
Returns the width of the given character in pixel.
int Width(void)
Definition: osd.h:802
virtual cOsdObject * MainMenuAction(void)
Definition: osddemo.c:603
cPixmap * destroyablePixmap
Definition: osddemo.c:179
tColor HsvToColor(double H, double S, double V)
Converts the given Hue (0..360), Saturation (0..1) and Value (0..1) to an RGB tColor value...
Definition: osd.c:19
Definition: thread.h:77
int FontOsdSize
Definition: config.h:330
int Y(void) const
Definition: osd.h:319
Definition: osd.h:44
int x
Definition: osddemo.c:98
virtual void SetLayer(int Layer)
Sets the layer of this pixmap to the given value.
Definition: osd.c:1022
VDRPLUGINCREATOR(cPluginOsddemo)
void SetPixel(const cPoint &Point, tColor Color)
Sets the pixel at the given Point to Color.
Definition: osd.h:442
int X(void) const
Definition: osd.h:365
void SetY(int Y)
Definition: osd.h:321
static uint64_t Now(void)
Definition: tools.c:695
virtual int Height(void) const =0
Returns the height of this font in pixel (all characters have the same height).
virtual void Clear(void)=0
Clears the pixmap&#39;s draw port by setting all pixels to be fully transparent.
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: osd.c:1972
cTrueColorDemo(void)
Definition: osddemo.c:191
virtual const char * CommandLineHelp(void)
Definition: osddemo.c:580
cRect Grown(int Dw, int Dh) const
Definition: osd.h:396
static void Unlock(void)
Definition: osd.h:531
int FontSmlSize
Definition: config.h:331
Definition: keys.h:24
#define LOCK_THREAD
Definition: thread.h:165
cPoint Shifted(int Dx, int Dy) const
Definition: osd.h:326
int Y(void) const
Definition: osd.h:366
Definition: osd.h:35
eKeys
Definition: keys.h:16
Definition: font.h:37
virtual cMenuSetupPage * SetupMenu(void)
Definition: osddemo.c:611
bool SetArea(void)
Definition: osddemo.c:490
Definition: tools.h:168
virtual void DrawRectangle(const cRect &Rect, tColor Color)=0
Draws a filled rectangle with the given Color.
#define ALPHA_OPAQUE
Definition: osd.h:26
Definition: keys.h:28
cPixmap * toggleablePixmap
Definition: osddemo.c:180
static const char * DESCRIPTION
Definition: osddemo.c:13
uint32_t tColor
Definition: font.h:29
Definition: keys.h:22
static cOsd * NewOsd(int Left, int Top, uint Level=OSD_LEVEL_DEFAULT)
Returns a pointer to a newly created cOsd object, which will be located at the given coordinates...
Definition: osd.c:2006