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;
104 virtual void Show(
void);
126 while (x1 > 0 && y1 > 0) {
127 tArea Area = { 0, 0, x1, y1, 4 };
162 default:
return state;
182 virtual void Action(
void);
187 virtual void Show(
void);
207 const int h = Font->
Height(s);
208 int w = Font->
Width(s);
234 int ScrollWaitTime = 1000;
235 int ScrollLineTime = 200;
236 int ScrollTotalTime = 8000;
238 uint64_t ScrollStartTime = 0;
239 int ScrollLineNumber = 0;
240 cPoint MoveStart, MoveEnd;
241 cPoint TileStart, TileEnd;
242 cPoint ScrollStart, ScrollEnd;
244 int StartLine = Line;
249 bool Animated =
false;
252 double t =
min(
double(Now - Start) / FadeTime, 1.0);
260 double t =
min(
double(Now - Start) / FadeTime, 1.0);
264 FadeOutPixmap = NULL;
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());
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());
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());
297 if (
int(Now - Start) < ScrollTotalTime) {
304 ScrollStartTime = Now;
307 FadeOutPixmap = ScrollPixmap;
314 ScrollStartTime = Now;
358 FadeInPixmap = NextPixmap;
371 for (
int y = 0; y < h; y++) {
372 for (
int x = 0; x < w; x++)
376 Pixmap->DrawImage(
cPoint(0, 0), Image);
384 MovePixmap = NextPixmap;
400 MovePixmap = TilePixmap;
409 const char *Text =
"Scrolling Pixmaps";
410 int w = OsdFont->
Width(Text);
411 int h = OsdFont->
Height();
417 ScrollPixmap = Pixmap;
418 ScrollStart.
Set(0, 0);
419 ScrollEnd.
Set(0, -h);
426 const char *Text =
"Animation";
427 const int Size = SmlFont->
Width(Text) + 10;
428 const int NumDots = 12;
429 const int AnimFrames = NumDots;
435 const int Diameter = Size / 5;
436 int xc = Size / 2 - Diameter / 2;
437 for (
int Frame = 0; Frame < AnimFrames; Frame++) {
439 int yc = Frame * Size + Size / 2 - Diameter / 2;
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);
452 FadeInPixmap = AnimPixmap;
466 if (
cursor != OldCursor) {
467 MovePixmap = AnimPixmap;
469 MoveEnd = OldCursor =
cursor;
480 if (Delta < FrameTime)
539 default:
return state;
558 virtual bool Start(
void);