10 #include <vdr/plugin.h>
13 static const char *
DESCRIPTION =
"Demo of arbitrary OSD setup";
28 int xb = Osd->
Width() - 1;
29 int yb = Osd->
Height() - 1;
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;
38 int y2 = (y0 + y4) / 2;
39 int y1 = (y0 + y2) / 2;
40 int y3 = (y2 + y4) / 2;
70 int xb = Osd->
Width() - 1;
71 int yb = Osd->
Height() - 1;
74 int x2 = (x0 + x4) / 2;
75 int x1 = (x0 + x2) / 2;
76 int x3 = (x2 + x4) / 2;
79 int y2 = (y0 + y3) / 2;
80 int y1 = (y0 + y2) / 2;
100 #define NUMOSDIMAGES 16
101 #define NUMOSDIMAGEVARIANTS 8
111 for (
int x = 0; x < images[i]->
Width(); x++) {
112 for (
int y = 0; y < images[i]->
Height(); y++) {
113 images[i]->SetPixel(
cPoint(x, y),
114 (!x || !y || x == images[i]->Width() - 1 || y == images[i]->Height() - 1) ?
clrWhite :
115 (x > images[i]->Width() / 2 ?
150 virtual void Show(
void);
172 while (x1 > 0 && y1 > 0) {
173 tArea Area = { 0, 0, x1, y1, 4 };
208 default:
return state;
228 virtual void Action(
void);
233 virtual void Show(
void);
280 int ScrollWaitTime = 1000;
281 int ScrollLineTime = 200;
282 int ScrollTotalTime = 8000;
284 uint64_t ScrollStartTime = 0;
285 int ScrollLineNumber = 0;
286 cPoint MoveStart, MoveEnd;
287 cPoint TileStart, TileEnd;
288 cPoint ScrollStart, ScrollEnd;
290 int StartLine = Line;
295 bool Animated =
false;
298 double t =
min(
double(Now -
Start) / FadeTime, 1.0);
306 double t =
min(
double(Now -
Start) / FadeTime, 1.0);
310 FadeOutPixmap = NULL;
314 double t =
min(
double(Now -
Start) / MoveTime, 1.0);
315 int x = MoveStart.
X() + t * (MoveEnd.
X() - MoveStart.
X());
316 int y = MoveStart.
Y() + t * (MoveEnd.
Y() - MoveStart.
Y());
317 cRect r = MovePixmap->ViewPort();
325 double t =
min(
double(Now -
Start) / TileTime, 1.0);
326 int x = TileStart.
X() + t * (TileEnd.
X() - TileStart.
X());
327 int y = TileStart.
Y() + t * (TileEnd.
Y() - TileStart.
Y());
336 if (
int(Now -
Start) > ScrollWaitTime) {
337 if (ScrollStartTime) {
338 double t =
min(
double(Now - ScrollStartTime) / ScrollLineTime, 1.0);
339 int x = ScrollStart.
X() + t * (ScrollEnd.
X() - ScrollStart.
X());
340 int y = ScrollStart.
Y() + t * (ScrollEnd.
Y() - ScrollStart.
Y());
343 if (
int(Now -
Start) < ScrollTotalTime) {
344 cRect r = ScrollPixmap->DrawPort();
348 ScrollPixmap->
DrawRectangle(
cRect(0, ScrollPixmap->ViewPort().Height(), ScrollPixmap->DrawPort().Width(), ScrollPixmap->DrawPort().Height()),
clrTransparent);
350 ScrollStartTime = Now;
353 FadeOutPixmap = ScrollPixmap;
360 ScrollStartTime = Now;
365 int d = AnimPixmap->ViewPort().Height();
368 cPoint p = AnimPixmap->DrawPort().Point().Shifted(0, d);
369 if (
clockwise && p.
Y() <= -AnimPixmap->DrawPort().Height())
372 p.
SetY(-(AnimPixmap->DrawPort().Height() - AnimPixmap->ViewPort().Height()));
380 Line += FadeInPixmap->DrawPort().Height();
388 Line += FadeInPixmap->DrawPort().Height();
396 Line += FadeInPixmap->DrawPort().Height();
404 FadeInPixmap = NextPixmap;
407 Line += NextPixmap->DrawPort().Height();
417 for (
int y = 0; y < h; y++) {
418 for (
int x = 0; x < w; x++)
419 Image.SetPixel(
cPoint(x, y),
HsvToColor(360 *
double(x) / w, 1 -
double(y) / h, 1) | 0xDF000000);
422 Pixmap->DrawImage(
cPoint(0, 0), Image);
430 MovePixmap = NextPixmap;
431 MoveStart = MovePixmap->ViewPort().Point();
432 MoveEnd.
Set(
osd->
Width() - MovePixmap->ViewPort().Width(),
osd->
Height() - MovePixmap->ViewPort().Height());
441 TilePixmap->
SetViewPort(TilePixmap->ViewPort().Grown(TilePixmap->DrawPort().Width(), TilePixmap->DrawPort().Height()));
444 TileStart = TilePixmap->DrawPort().Point();
445 TileEnd = TileStart.
Shifted(TilePixmap->ViewPort().Width(), TilePixmap->ViewPort().Height());
446 MovePixmap = TilePixmap;
447 MoveStart = MovePixmap->ViewPort().Point();
448 MoveEnd.
Set(10,
osd->
Height() - MovePixmap->ViewPort().Height() - 10);
455 const char *Text =
"Scrolling Pixmaps";
456 int w = OsdFont->
Width(Text);
457 int h = OsdFont->
Height();
463 ScrollPixmap = Pixmap;
464 ScrollStart.
Set(0, 0);
465 ScrollEnd.
Set(0, -h);
472 const char *Text =
"Animation";
473 const int Size = SmlFont->
Width(Text) + 10;
474 const int NumDots = 12;
475 const int AnimFrames = NumDots;
477 int Cols = (AnimFrames + Rows - 1) / Rows;
483 const int Diameter = Size / 5;
484 for (
int Frame = 0; Frame < AnimFrames; Frame++) {
485 int x0 = Frame / Rows * Size;
486 int y0 = Frame % Rows * Size;
488 int xc = x0 + Size / 2 - Diameter / 2;
489 int yc = y0 + Size / 2 - Diameter / 2;
491 int Delta = Color / NumDots / 3;
492 for (
int a = 0; a < NumDots; a++) {
493 double t = 2 * M_PI * (Frame + a) / NumDots;
494 int x = xc + ((Size - Diameter) / 2 - 5) * cos(t);
495 int y = yc + ((Size - Diameter) / 2 - 5) * sin(t);
502 FadeInPixmap = AnimPixmap;
504 OldCursor =
cursor = AnimPixmap->ViewPort().Point();
516 if (
cursor != OldCursor) {
517 MovePixmap = AnimPixmap;
518 MoveStart = MovePixmap->ViewPort().Point();
519 MoveEnd = OldCursor =
cursor;
530 if (Delta < FrameTime)
595 default:
return state;
614 virtual bool Start(
void);