vdr  2.6.9
osd.h
Go to the documentation of this file.
1 /*
2  * osd.h: Abstract On Screen Display layer
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: osd.h 5.2 2024/01/18 12:04:57 kls Exp $
8  */
9 
10 #ifndef __OSD_H
11 #define __OSD_H
12 
13 #include <limits.h>
14 #include <stdio.h>
15 #include <stdint.h>
16 #include "config.h"
17 #include "font.h"
18 #include "thread.h"
19 #include "tools.h"
20 
21 #define OSD_LEVEL_DEFAULT 0
22 #define OSD_LEVEL_SUBTITLES 10
23 
24 #define MAXNUMCOLORS 256
25 #define ALPHA_TRANSPARENT 0x00
26 #define ALPHA_OPAQUE 0xFF
27 #define IS_OPAQUE(c) ((c >> 24) == ALPHA_OPAQUE)
28 #define TEXT_ALIGN_BORDER 10 // fraction of the font height used for sizing border
29 
30 enum {
31  //AARRGGBB
32  clrTransparent = 0x00000000,
33  clrGray50 = 0x7F000000, // 50% gray
34  clrBlack = 0xFF000000,
35  clrRed = 0xFFFC1414,
36  clrGreen = 0xFF24FC24,
37  clrYellow = 0xFFFCC024,
38  clrMagenta = 0xFFB000FC,
39  clrBlue = 0xFF0000FC,
40  clrCyan = 0xFF00FCFC,
41  clrWhite = 0xFFFCFCFC,
42  };
43 
44 enum eOsdError { oeOk, // see also OsdErrorTexts in osd.c
53  };
54 
55 typedef uint32_t tColor; // see also font.h
56 typedef uint8_t tIndex;
57 
58 inline tColor ArgbToColor(uint8_t A, uint8_t R, uint8_t G, uint8_t B)
59 {
60  return (tColor(A) << 24) | (tColor(R) << 16) | (tColor(G) << 8) | B;
61 }
62 
63 inline tColor RgbToColor(uint8_t R, uint8_t G, uint8_t B)
64 {
65  return (tColor(R) << 16) | (tColor(G) << 8) | B;
66 }
67 
68 inline tColor RgbToColor(double R, double G, double B)
69 {
70  return RgbToColor(uint8_t(0xFF * R), uint8_t(0xFF * G), uint8_t(0xFF * B));
71 }
72 
73 tColor RgbShade(tColor Color, double Factor);
80 
81 tColor HsvToColor(double H, double S, double V);
85 
86 tColor AlphaBlend(tColor ColorFg, tColor ColorBg, uint8_t AlphaLayer = ALPHA_OPAQUE);
87 
88 class cPalette {
89 private:
91  int bpp;
93  bool modified;
95 protected:
97 public:
98  cPalette(int Bpp = 8);
100  virtual ~cPalette();
101  void SetAntiAliasGranularity(uint FixedColors, uint BlendColors);
111  int Bpp(void) const { return bpp; }
112  void Reset(void);
114  int Index(tColor Color);
119  tColor Color(int Index) const { return Index < maxColors ? color[Index] : 0; }
122  void SetBpp(int Bpp);
125  void SetColor(int Index, tColor Color);
129  const tColor *Colors(int &NumColors) const;
134  void Take(const cPalette &Palette, tIndexes *Indexes = NULL, tColor ColorFg = 0, tColor ColorBg = 0);
141  void Replace(const cPalette &Palette);
144  tColor Blend(tColor ColorFg, tColor ColorBg, uint8_t Level) const;
150  int ClosestColor(tColor Color, int MaxDiff = INT_MAX) const;
156  };
157 
158 enum eTextAlignment { taCenter = 0x00,
159  taLeft = 0x01,
160  taRight = 0x02,
161  taTop = 0x04,
162  taBottom = 0x08,
163  taBorder = 0x10, // keeps some distance from the left or right alignment edge
165  };
166 
167 class cFont;
168 
169 class cBitmap : public cPalette {
170 private:
172  int x0, y0;
173  int width, height;
175 public:
176  cBitmap(int Width, int Height, int Bpp, int X0 = 0, int Y0 = 0);
181  cBitmap(const char *FileName);
183  cBitmap(const char *const Xpm[]);
185  virtual ~cBitmap();
186  int X0(void) const { return x0; }
187  int Y0(void) const { return y0; }
188  int Width(void) const { return width; }
189  int Height(void) const { return height; }
190  void SetSize(int Width, int Height);
195  void SetOffset(int X0, int Y0) { x0 = X0; y0 = Y0; }
197  bool Contains(int x, int y) const;
199  bool Covers(int x1, int y1, int x2, int y2) const;
202  bool Intersects(int x1, int y1, int x2, int y2) const;
205  bool Dirty(int &x1, int &y1, int &x2, int &y2);
208  void Clean(void);
210  bool LoadXpm(const char *FileName);
213  bool SetXpm(const char *const Xpm[], bool IgnoreNone = false);
223  void SetIndex(int x, int y, tIndex Index);
226  void Fill(tIndex Index);
228  void DrawPixel(int x, int y, tColor Color);
232  void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false);
242  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);
248  void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
253  void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);
263  void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type);
275  const tIndex *Data(int x, int y) const;
277  tColor GetColor(int x, int y) const { return Color(*Data(x, y)); }
279  void ReduceBpp(const cPalette &Palette);
285  void ShrinkBpp(int NewBpp);
290  cBitmap *Scaled(double FactorX, double FactorY, bool AntiAlias = false) const;
296  };
297 
298 struct tArea {
299  int x1, y1, x2, y2;
300  int bpp;
301  int Width(void) const { return x2 - x1 + 1; }
302  int Height(void) const { return y2 - y1 + 1; }
303  bool Intersects(const tArea &Area) const { return !(x2 < Area.x1 || x1 > Area.x2 || y2 < Area.y1 || y1 > Area.y2); }
304  };
305 
306 class cPoint {
307 private:
308  int x;
309  int y;
310 public:
311  cPoint(void) { x = y = 0; }
312  cPoint(int X, int Y) { x = X; y = Y; }
313  cPoint(const cPoint &Point) { x = Point.X(); y = Point.Y(); }
314  bool operator==(const cPoint &Point) const { return x == Point.X() && y == Point.Y(); }
315  bool operator!=(const cPoint &Point) const { return !(*this == Point); }
316  cPoint operator-(void) const { return cPoint(-x, -y); }
317  cPoint operator-(const cPoint &Point) const { return cPoint(x - Point.X(), y - Point.Y()); }
318  int X(void) const { return x; }
319  int Y(void) const { return y; }
320  void SetX(int X) { x = X; }
321  void SetY(int Y) { y = Y; }
322  void Set(int X, int Y) { x = X; y = Y; }
323  void Set(const cPoint &Point) { x = Point.X(); y = Point.Y(); }
324  void Shift(int Dx, int Dy) { x += Dx; y += Dy; }
325  void Shift(const cPoint &Dp) { x += Dp.X(); y += Dp.Y(); }
326  cPoint Shifted(int Dx, int Dy) const { cPoint p(*this); p.Shift(Dx, Dy); return p; }
327  cPoint Shifted(const cPoint &Dp) const { cPoint p(*this); p.Shift(Dp); return p; }
328  };
329 
330 class cSize {
331 private:
332  int width;
333  int height;
334 public:
335  cSize(void) { width = height = 0; }
336  cSize(int Width, int Height) { width = Width; height = Height; }
337  cSize(const cSize &Size) { width = Size.Width(); height = Size.Height(); }
338  bool operator==(const cSize &Size) const { return width == Size.Width() && height == Size.Height(); }
339  bool operator!=(const cSize &Size) const { return !(*this == Size); }
340  bool operator<(const cSize &Size) const { return width < Size.Width() && height < Size.Height(); }
341  int Width(void) const { return width; }
342  int Height(void) const { return height; }
343  void SetWidth(int Width) { width = Width; }
344  void SetHeight(int Height) { height = Height; }
345  void Set(int Width, int Height) { width = Width; height = Height; }
346  void Set(const cSize &Size) { width = Size.Width(); height = Size.Height(); }
347  bool Contains(const cPoint &Point) const { return 0 <= Point.X() && 0 <= Point.Y() && Point.X() < width && Point.Y() < height; }
348  void Grow(int Dw, int Dh) { width += 2 * Dw; height += 2 * Dh; }
349  cSize Grown(int Dw, int Dh) const { cSize s(*this); s.Grow(Dw, Dh); return s; }
350  };
351 
352 class cRect {
353 private:
356 public:
357  static const cRect Null;
358  cRect(void): point(0, 0), size(0, 0) {}
359  cRect(int X, int Y, int Width, int Height): point(X, Y), size(Width, Height) {}
360  cRect(const cPoint &Point, const cSize &Size): point(Point), size(Size) {}
361  cRect(const cSize &Size): point(0, 0), size(Size) {}
362  cRect(const cRect &Rect): point(Rect.Point()), size(Rect.Size()) {}
363  bool operator==(const cRect &Rect) const { return point == Rect.Point() && size == Rect.Size(); }
364  bool operator!=(const cRect &Rect) const { return !(*this == Rect); }
365  int X(void) const { return point.X(); }
366  int Y(void) const { return point.Y(); }
367  int Width(void) const { return size.Width(); }
368  int Height(void) const { return size.Height(); }
369  int Left(void) const { return X(); }
370  int Top(void) const { return Y(); }
371  int Right(void) const { return X() + Width() - 1; }
372  int Bottom(void) const { return Y() + Height() - 1; }
373  const cPoint &Point(void) const { return point; }
374  const cSize &Size(void) const { return size; }
375  void Set(int X, int Y, int Width, int Height) { point.Set(X, Y); size.Set(Width, Height); }
377  void SetPoint(int X, int Y) { point.Set(X, Y); }
378  void SetPoint(const cPoint &Point) { point.Set(Point); }
379  void SetSize(int Width, int Height) { size.Set(Width, Height); }
380  void SetSize(const cSize &Size) { size.Set(Size); }
381  void SetX(int X) { point.SetX(X); }
382  void SetY(int Y) { point.SetY(Y); }
383  void SetWidth(int Width) { size.SetWidth(Width); }
385  void SetLeft(int Left) { SetWidth(Width() + X() - Left); SetX(Left); }
386  void SetTop(int Top) { SetHeight(Height() + Y() - Top); SetY(Top); }
387  void SetRight(int Right) { SetWidth(Right - X() + 1); }
388  void SetBottom(int Bottom) { SetHeight(Bottom - Y() + 1); }
389  void Shift(int Dx, int Dy) { point.Shift(Dx, Dy); }
390  void Shift(const cPoint &Dp) { point.Shift(Dp); }
391  cRect Shifted(int Dx, int Dy) const { cRect r(*this); r.Shift(Dx, Dy); return r; }
392  cRect Shifted(const cPoint &Dp) const { cRect r(*this); r.Shift(Dp); return r; }
393  void Grow(int Dx, int Dy);
396  cRect Grown(int Dw, int Dh) const { cRect r(*this); r.Grow(Dw, Dh); return r; }
397  bool Contains(const cPoint &Point) const;
399  bool Contains(const cRect &Rect) const;
401  bool Intersects(const cRect &Rect) const;
403  cRect Intersected(const cRect &Rect) const;
405  void Combine(const cRect &Rect);
407  cRect Combined(const cRect &Rect) const { cRect r(*this); r.Combine(Rect); return r; }
410  void Combine(const cPoint &Point);
412  cRect Combined(const cPoint &Point) const { cRect r(*this); r.Combine(Point); return r; }
415  bool IsEmpty(void) const { return Width() <= 0 || Height() <= 0; }
417  };
418 
419 class cImage {
420 private:
423 public:
424  cImage(void);
425  cImage(const cImage &Image);
426  cImage(const cSize &Size, const tColor *Data = NULL);
433  virtual ~cImage();
434  const cSize &Size(void) const { return size; }
435  int Width(void) const { return size.Width(); }
436  int Height(void) const { return size.Height(); }
437  const tColor *Data(void) const { return data; }
438  tColor GetPixel(const cPoint &Point) const { return data[size.Width() * Point.Y() + Point.X()]; }
442  void SetPixel(const cPoint &Point, tColor Color) { data[size.Width() * Point.Y() + Point.X()] = Color; }
446  void Clear(void);
448  void Fill(tColor Color);
450  cImage *Scaled(double FactorX, double FactorY, bool AntiAlias = false) const;
455  };
456 
457 #define MAXPIXMAPLAYERS 8
458 
459 class cPixmap {
460  friend class cOsd;
461  friend class cPixmapMutexLock;
462 private:
463  static cMutex mutex;
464  int layer;
465  int alpha;
466  bool tile;
471 protected:
472  virtual ~cPixmap() {}
473  void MarkViewPortDirty(const cRect &Rect);
477  void MarkViewPortDirty(const cPoint &Point);
481  void MarkDrawPortDirty(const cRect &Rect);
487  void MarkDrawPortDirty(const cPoint &Point);
493  void SetClean(void);
495  virtual void DrawPixmap(const cPixmap *Pixmap, const cRect &Dirty);
500 public:
501  cPixmap(void);
502  cPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
534  static void Lock(void) { mutex.Lock(); }
540  static void Unlock(void) { mutex.Unlock(); }
541  int Layer(void) const { return layer; }
542  int Alpha(void) const { return alpha; }
543  bool Tile(void) const { return tile; }
544  const cRect &ViewPort(void) const { return viewPort; }
548  const cRect &DrawPort(void) const { return drawPort; }
552  const cRect &DirtyViewPort(void) const { return dirtyViewPort; }
559  const cRect &DirtyDrawPort(void) const { return dirtyDrawPort; }
566  virtual void SetLayer(int Layer);
573  virtual void SetAlpha(int Alpha);
578  virtual void SetTile(bool Tile);
584  virtual void SetViewPort(const cRect &Rect);
588  virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty = true);
597  virtual void Clear(void) = 0;
600  virtual void Fill(tColor Color) = 0;
603  virtual void DrawImage(const cPoint &Point, const cImage &Image) = 0;
605  virtual void DrawImage(const cPoint &Point, int ImageHandle) = 0;
610  virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias = false) {};
617  virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias = false) {};
627  virtual void DrawPixel(const cPoint &Point, tColor Color) = 0;
632  virtual void DrawBlendedPixel(const cPoint &Point, tColor Color, uint8_t AlphaLayer = ALPHA_OPAQUE) { DrawPixel(Point, Color); }
636  virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false) = 0;
647  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;
653  virtual void DrawRectangle(const cRect &Rect, tColor Color) = 0;
655  virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0) = 0;
664  virtual void DrawSlope(const cRect &Rect, tColor Color, int Type) = 0;
675  virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) = 0;
679  virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) = 0;
684  virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null) = 0;
688  virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null) = 0;
700  };
701 
702 class cPixmapMutexLock : public cMutexLock {
703 public:
705  };
706 
707 #define LOCK_PIXMAPS cPixmapMutexLock PixmapMutexLock
708 
709 // cPixmapMemory is an implementation of cPixmap that uses an array of tColor
710 // values to store the pixmap.
711 
712 class cPixmapMemory : public cPixmap {
713 private:
715  bool panning;
716 public:
717  cPixmapMemory(void);
718  cPixmapMemory(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
719  virtual ~cPixmapMemory();
720  const uint8_t *Data(void) { return (uint8_t *)data; }
721  virtual void Clear(void);
722  virtual void Fill(tColor Color);
723  virtual void DrawImage(const cPoint &Point, const cImage &Image);
724  virtual void DrawImage(const cPoint &Point, int ImageHandle);
725  virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias = false);
726  virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias = false);
727  virtual void DrawPixel(const cPoint &Point, tColor Color);
728  virtual void DrawBlendedPixel(const cPoint &Point, tColor Color, uint8_t AlphaLayer = ALPHA_OPAQUE);
729  virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
730  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);
731  virtual void DrawRectangle(const cRect &Rect, tColor Color);
732  virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0);
733  virtual void DrawSlope(const cRect &Rect, tColor Color, int Type);
734  virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest);
735  virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest);
736  virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null);
737  virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null);
738  };
739 
740 #define MAXOSDAREAS 16
741 
752 
753 class cOsd {
754  friend class cOsdProvider;
755 private:
759  static cMutex mutex;
767  uint level;
768  bool active;
769 protected:
770  cOsd(int Left, int Top, uint Level);
790  bool Active(void) { return active; }
791  virtual void SetActive(bool On) { active = On; }
794  cPixmap *AddPixmap(cPixmap *Pixmap);
800  cPixmap *RenderPixmaps(void);
817  cBitmap *GetBitmap(int Area);
825 public:
826  virtual ~cOsd();
828  static int OsdLeft(void) { return osdLeft ? osdLeft : Setup.OSDLeft; }
829  static int OsdTop(void) { return osdTop ? osdTop : Setup.OSDTop; }
830  static int OsdWidth(void) { return osdWidth ? osdWidth : Setup.OSDWidth; }
831  static int OsdHeight(void) { return osdHeight ? osdHeight : Setup.OSDHeight; }
832  static void SetOsdPosition(int Left, int Top, int Width, int Height);
837  static int IsOpen(void) { return Osds.Size() && Osds[0]->level == OSD_LEVEL_DEFAULT; }
839  bool IsTrueColor(void) const { return isTrueColor; }
842  int Left(void) { return left; }
843  int Top(void) { return top; }
844  int Width(void) { return width; }
845  int Height(void) { return height; }
846  void SetAntiAliasGranularity(uint FixedColors, uint BlendColors);
857  virtual const cSize &MaxPixmapSize(void) const;
863  virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
870  virtual void DestroyPixmap(cPixmap *Pixmap);
875  virtual void DrawImage(const cPoint &Point, const cImage &Image);
878  virtual void DrawImage(const cPoint &Point, int ImageHandle);
884  virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias = false);
889  virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias = false);
897  virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas);
905  virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
917  virtual void SaveRegion(int x1, int y1, int x2, int y2);
921  virtual void RestoreRegion(void);
924  virtual eOsdError SetPalette(const cPalette &Palette, int Area);
927  virtual void DrawPixel(int x, int y, tColor Color);
933  virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false);
944  virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias = false);
949  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);
955  virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color);
958  virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0);
968  virtual void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type);
980  virtual void Flush(void);
997  };
998 
999 #define MAXOSDIMAGES 64
1000 
1002  friend class cPixmapMemory;
1003 private:
1005  static int oldWidth;
1006  static int oldHeight;
1007  static double oldAspect;
1009  static int osdState;
1010 protected:
1011  virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0;
1014  virtual bool ProvidesTrueColor(void) { return false; }
1016  virtual int StoreImageData(const cImage &Image);
1027  virtual void DropImageData(int ImageHandle);
1029  static const cImage *GetImageData(int ImageHandle);
1031 public:
1032  cOsdProvider(void);
1033  //XXX maybe parameter to make this one "sticky"??? (frame-buffer etc.)
1034  virtual ~cOsdProvider();
1035  static cOsd *NewOsd(int Left, int Top, uint Level = OSD_LEVEL_DEFAULT);
1041  static void UpdateOsdSize(bool Force = false);
1046  static bool OsdSizeChanged(int &State);
1052  static bool SupportsTrueColor(void);
1054  static int StoreImage(const cImage &Image);
1064  static void DropImage(int ImageHandle);
1067  static void Shutdown(void);
1069  };
1070 
1072 private:
1075  const cFont *font;
1079  void DrawText(void);
1080 public:
1081  cTextScroller(void);
1082  cTextScroller(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg);
1083  void Set(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg);
1084  void Reset(void);
1085  int Left(void) { return left; }
1086  int Top(void) { return top; }
1087  int Width(void) { return width; }
1088  int Height(void) { return height; }
1089  int Total(void) { return textWrapper.Lines(); }
1090  int Offset(void) { return offset; }
1091  int Shown(void) { return shown; }
1092  bool CanScroll(void) { return CanScrollUp() || CanScrollDown(); }
1093  bool CanScrollUp(void) { return offset > 0; }
1094  bool CanScrollDown(void) { return offset + shown < Total(); }
1095  void Scroll(bool Up, bool Page);
1096  };
1097 
1098 #endif //__OSD_H
Definition: osd.h:169
int y0
Definition: osd.h:172
void ShrinkBpp(int NewBpp)
Shrinks the color depth of the bitmap to NewBpp by keeping only the 2^NewBpp most frequently used col...
Definition: osd.c:796
void SetOffset(int X0, int Y0)
Sets the offset of this bitmap to the given values.
Definition: osd.h:195
int dirtyY2
Definition: osd.h:174
int width
Definition: osd.h:173
void ReduceBpp(const cPalette &Palette)
Reduces the color depth of the bitmap to that of the given Palette.
Definition: osd.c:765
int Height(void) const
Definition: osd.h:189
int height
Definition: osd.h:173
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
cBitmap * Scaled(double FactorX, double FactorY, bool AntiAlias=false) const
Creates a copy of this bitmap, scaled by the given factors.
Definition: osd.c:838
int X0(void) const
Definition: osd.h:186
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:727
tColor GetColor(int x, int y) const
Returns the color at the given coordinates.
Definition: osd.h:277
bool Contains(int x, int y) const
Returns true if this bitmap contains the point (x, y).
Definition: osd.c:317
void SetIndex(int x, int y, tIndex Index)
Sets the index at the given coordinates to Index.
Definition: osd.c:500
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:611
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: osd.c:526
bool Covers(int x1, int y1, int x2, int y2) const
Returns true if the rectangle defined by the given coordinates completely covers this bitmap.
Definition: osd.c:324
void Clean(void)
Marks the dirty area as clean.
Definition: osd.c:354
int dirtyX1
Definition: osd.h:174
tIndex * bitmap
Definition: osd.h:171
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 this bitmap with the data from the given Bitmap, putting the upper left corner of ...
Definition: osd.c:533
void SetSize(int Width, int Height)
Sets the size of this bitmap to the given values.
Definition: osd.c:294
void Fill(tIndex Index)
Fills the bitmap data with the given Index.
Definition: osd.c:515
int dirtyX2
Definition: osd.h:174
int dirtyY1
Definition: osd.h:174
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: osd.c:562
bool SetXpm(const char *const Xpm[], bool IgnoreNone=false)
Sets this bitmap to the given XPM data.
Definition: osd.c:428
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:632
bool LoadXpm(const char *FileName)
Calls SetXpm() with the data from the file FileName.
Definition: osd.c:362
virtual ~cBitmap()
Definition: osd.c:289
cBitmap(int Width, int Height, int Bpp, int X0=0, int Y0=0)
Creates a bitmap with the given Width, Height and color depth (Bpp).
Definition: osd.c:261
bool Intersects(int x1, int y1, int x2, int y2) const
Returns true if the rectangle defined by the given coordinates intersects with this bitmap.
Definition: osd.c:333
int Y0(void) const
Definition: osd.h:187
int x0
Definition: osd.h:172
int Width(void) const
Definition: osd.h:188
const tIndex * Data(int x, int y) const
Returns the address of the index byte at the given coordinates.
Definition: osd.c:760
Definition: font.h:37
Definition: osd.h:419
int Height(void) const
Definition: osd.h:436
const cSize & Size(void) const
Definition: osd.h:434
int Width(void) const
Definition: osd.h:435
cImage(void)
Definition: osd.c:1104
tColor * data
Definition: osd.h:422
void SetPixel(const cPoint &Point, tColor Color)
Sets the pixel at the given Point to Color.
Definition: osd.h:442
virtual ~cImage()
Definition: osd.c:1126
cSize size
Definition: osd.h:421
const tColor * Data(void) const
Definition: osd.h:437
cImage * Scaled(double FactorX, double FactorY, bool AntiAlias=false) const
Creates a copy of this image, scaled by the given factors.
Definition: osd.c:1142
tColor GetPixel(const cPoint &Point) const
Returns the pixel value at the given Point.
Definition: osd.h:438
void Clear(void)
Clears the image data by setting all pixels to be fully transparent.
Definition: osd.c:1131
void Fill(tColor Color)
Fills the image data with the given Color.
Definition: osd.c:1136
cMutex * mutex
Definition: thread.h:143
Definition: thread.h:67
void Lock(void)
Definition: thread.c:222
void Unlock(void)
Definition: thread.c:228
static int oldHeight
Definition: osd.h:1006
static int oldWidth
Definition: osd.h:1005
virtual bool ProvidesTrueColor(void)
Returns true if this OSD provider is able to handle a true color OSD.
Definition: osd.h:1014
static cImage * images[MAXOSDIMAGES]
Definition: osd.h:1008
static double oldAspect
Definition: osd.h:1007
static bool OsdSizeChanged(int &State)
Checks if the OSD size has changed and a currently displayed OSD needs to be redrawn.
Definition: osd.c:2337
static void DropImage(int ImageHandle)
Drops the image referenced by the given ImageHandle.
Definition: osd.c:2391
virtual ~cOsdProvider()
Definition: osd.c:2285
virtual int StoreImageData(const cImage &Image)
Copies the given Image and returns a handle for later reference.
Definition: osd.c:2355
virtual void DropImageData(int ImageHandle)
Drops the image data referenced by ImageHandle.
Definition: osd.c:2367
static cOsdProvider * osdProvider
Definition: osd.h:1004
static int osdState
Definition: osd.h:1009
static int StoreImage(const cImage &Image)
Stores the given Image for later use with DrawImage() on an OSD or pixmap.
Definition: osd.c:2384
cOsdProvider(void)
Definition: osd.c:2279
static void Shutdown(void)
Shuts down the OSD provider facility by deleting the current OSD provider.
Definition: osd.c:2397
static void UpdateOsdSize(bool Force=false)
Inquires the actual size of the video display and adjusts the OSD and font sizes accordingly.
Definition: osd.c:2310
virtual cOsd * CreateOsd(int Left, int Top, uint Level)=0
Returns a pointer to a newly created cOsd object, which will be located at the given coordinates.
static const cImage * GetImageData(int ImageHandle)
Gets the image data referenced by ImageHandle.
Definition: osd.c:2376
static bool SupportsTrueColor(void)
Returns true if the current OSD provider is able to handle a true color OSD.
Definition: osd.c:2345
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:2290
The cOsd class is the interface to the "On Screen Display".
Definition: osd.h:753
int numBitmaps
Definition: osd.h:763
cOsd(int Left, int Top, uint Level)
Initializes the OSD with the given coordinates.
Definition: osd.c:1911
virtual eOsdError SetPalette(const cPalette &Palette, int Area)
Sets the Palette for the given Area (the first area is numbered 0).
Definition: osd.c:2161
uint level
Definition: osd.h:767
bool IsTrueColor(void) const
Returns 'true' if this is a true color OSD (providing full 32 bit color depth).
Definition: osd.h:839
virtual const cSize & MaxPixmapSize(void) const
Returns the maximum possible size of a pixmap this OSD can create.
Definition: osd.c:1972
int top
Definition: osd.h:766
virtual void DrawImage(const cPoint &Point, const cImage &Image)
Draws the given Image on this OSD at the given Point.
Definition: osd.c:2172
static int osdHeight
Definition: osd.h:756
virtual void SetActive(bool On)
Sets this OSD to be the active one.
Definition: osd.h:791
int Width(void)
Definition: osd.h:844
static int OsdHeight(void)
Definition: osd.h:831
bool isTrueColor
Definition: osd.h:760
cVector< cPixmap * > pixmaps
Definition: osd.h:765
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas)
Sets the sub-areas to the given areas.
Definition: osd.c:2092
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: osd.c:2206
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:2246
cBitmap * GetBitmap(int Area)
Returns a pointer to the bitmap for the given Area, or NULL if no such bitmap exists.
Definition: osd.c:1967
virtual void DestroyPixmap(cPixmap *Pixmap)
Destroys the given Pixmap, which has previously been created by a call to CreatePixmap().
Definition: osd.c:1989
void SetAntiAliasGranularity(uint FixedColors, uint BlendColors)
Allows the system to optimize utilization of the limited color palette entries when generating blende...
Definition: osd.c:1959
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: osd.c:2196
bool active
Definition: osd.h:768
virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas)
Checks whether the OSD can display the given set of sub-areas.
Definition: osd.c:2070
static int osdWidth
Definition: osd.h:756
cPixmap * AddPixmap(cPixmap *Pixmap)
Adds the given Pixmap to the list of currently active pixmaps in this OSD.
Definition: osd.c:2006
cPixmap * RenderPixmaps(void)
Renders the dirty part of all pixmaps into a resulting pixmap that shall be displayed on the OSD.
Definition: osd.c:2019
static int OsdTop(void)
Definition: osd.h:829
static int osdLeft
Definition: osd.h:756
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:1977
static void SetOsdPosition(int Left, int Top, int Width, int Height)
Sets the position and size of the OSD to the given values.
Definition: osd.c:1951
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: osd.c:2127
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias=false)
Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the ...
Definition: osd.c:2216
virtual void Flush(void)
Actually commits all data to the OSD hardware.
Definition: osd.c:2266
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:2236
int Left(void)
Definition: osd.h:842
static int OsdLeft(void)
Definition: osd.h:828
cBitmap * bitmaps[MAXOSDAREAS]
Definition: osd.h:762
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:2256
static cMutex mutex
Definition: osd.h:759
int left
Definition: osd.h:766
cPixmapMemory * savedPixmap
Definition: osd.h:764
static int OsdWidth(void)
Definition: osd.h:830
int height
Definition: osd.h:766
static int osdTop
Definition: osd.h:756
int Top(void)
Definition: osd.h:843
virtual void RestoreRegion(void)
Restores the region previously saved by a call to SaveRegion().
Definition: osd.c:2143
static cVector< cOsd * > Osds
Definition: osd.h:757
cBitmap * savedBitmap
Definition: osd.h:761
static cSize maxPixmapSize
Definition: osd.h:758
virtual ~cOsd()
Shuts down the OSD.
Definition: osd.c:1932
bool Active(void)
Definition: osd.h:790
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias=false)
Draws the given Image on this OSD at the given Point and scales it.
Definition: osd.c:2184
int width
Definition: osd.h:766
int Height(void)
Definition: osd.h:845
static int IsOpen(void)
Returns true if there is currently a level 0 OSD open.
Definition: osd.h:837
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: osd.c:2226
Definition: osd.h:88
tColor Color(int Index) const
Returns the color at the given Index.
Definition: osd.h:119
tColor Blend(tColor ColorFg, tColor ColorBg, uint8_t Level) const
Determines a color that consists of a linear blend between ColorFg and ColorBg.
Definition: osd.c:216
void Reset(void)
Resets the palette, making it contain no colors.
Definition: osd.c:138
void Replace(const cPalette &Palette)
Replaces the colors of this palette with the colors from the given palette.
Definition: osd.c:208
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
int maxColors
Definition: osd.h:92
virtual ~cPalette()
Definition: osd.c:123
bool modified
Definition: osd.h:93
tIndex tIndexes[MAXNUMCOLORS]
Definition: osd.h:96
int bpp
Definition: osd.h:91
void SetBpp(int Bpp)
Sets the color depth of this palette to the given value.
Definition: osd.c:165
void SetColor(int Index, tColor Color)
Sets the palette entry at Index to Color.
Definition: osd.c:172
tColor color[MAXNUMCOLORS]
Definition: osd.h:90
void SetAntiAliasGranularity(uint FixedColors, uint BlendColors)
Allows the system to optimize utilization of the limited color palette entries when generating blende...
Definition: osd.c:127
int Index(tColor Color)
Returns the index of the given Color (the first color has index 0).
Definition: osd.c:144
int ClosestColor(tColor Color, int MaxDiff=INT_MAX) const
Returns the index of a color in this palette that is closest to the given Color.
Definition: osd.c:235
int numColors
Definition: osd.h:92
cPalette(int Bpp=8)
Initializes the palette with the given color depth.
Definition: osd.c:117
double antiAliasGranularity
Definition: osd.h:94
int Bpp(void) const
Definition: osd.h:111
void Take(const cPalette &Palette, tIndexes *Indexes=NULL, tColor ColorFg=0, tColor ColorBg=0)
Takes the colors from the given Palette and adds them to this palette, using existing entries if poss...
Definition: osd.c:191
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias=false)
Definition: osd.c:1305
virtual void Pan(const cPoint &Dest, const cRect &Source=cRect::Null)
Does the same as Scroll(), but also shifts the draw port accordingly, so that the view port doesn't g...
Definition: osd.c:1880
virtual void Scroll(const cPoint &Dest, const cRect &Source=cRect::Null)
Scrolls the data in the pixmap's draw port to the given Dest point.
Definition: osd.c:1846
virtual void Clear(void)
Clears the pixmap's draw port by setting all pixels to be fully transparent.
Definition: osd.c:1205
bool panning
Definition: osd.h:715
virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)
Copies the part of the given Pixmap covered by Source into this pixmap at location Dest.
Definition: osd.c:1819
cPixmapMemory(void)
Definition: osd.c:1187
virtual ~cPixmapMemory()
Definition: osd.c:1200
virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)
Renders the part of the given Pixmap covered by Source into this pixmap at location Dest.
Definition: osd.c:1784
const uint8_t * Data(void)
Definition: osd.h:720
virtual void DrawBlendedPixel(const cPoint &Point, tColor Color, uint8_t AlphaLayer=ALPHA_OPAQUE)
Like DrawPixel(), but with an additional AlphaLayer, and works on any pixmap, not only the background...
Definition: osd.c:1339
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type)
Draws a "slope" with the given Color into the given rectangle.
Definition: osd.c:1684
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false)
Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the ...
Definition: osd.c:1357
virtual void DrawImage(const cPoint &Point, const cImage &Image)
Draws the given Image into this pixmap at the given Point.
Definition: osd.c:1273
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)
Draws the given string at Point with the given foreground and background color and font.
Definition: osd.c:1384
virtual void Fill(tColor Color)
Fills the pixmap's draw port with the given Color.
Definition: osd.c:1213
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants=0)
Draws a filled ellipse with the given Color that fits into the given rectangle.
Definition: osd.c:1460
tColor * data
Definition: osd.h:714
virtual void DrawPixel(const cPoint &Point, tColor Color)
Draws the image referenced by the given ImageHandle into this pixmap at the given Point and scales it...
Definition: osd.c:1325
virtual void DrawRectangle(const cRect &Rect, tColor Color)
Draws a filled rectangle with the given Color.
Definition: osd.c:1433
cPixmapMutexLock(void)
Definition: osd.h:704
Definition: osd.h:459
virtual void DrawPixmap(const cPixmap *Pixmap, const cRect &Dirty)
Draws the Dirty part of the given Pixmap into this pixmap.
Definition: osd.c:1222
virtual ~cPixmap()
Definition: osd.h:472
virtual void DrawBlendedPixel(const cPoint &Point, tColor Color, uint8_t AlphaLayer=ALPHA_OPAQUE)
Like DrawPixel(), but with an additional AlphaLayer, and works on any pixmap, not only the background...
Definition: osd.h:632
const cRect & DrawPort(void) const
Returns the pixmap's draw port, which is relative to the view port.
Definition: osd.h:548
bool Tile(void) const
Definition: osd.h:543
int alpha
Definition: osd.h:465
virtual void SetViewPort(const cRect &Rect)
Sets the pixmap's view port to the given Rect.
Definition: osd.c:1068
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias=false)
Definition: osd.h:610
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type)=0
Draws a "slope" with the given Color into the given rectangle.
cPixmap(void)
Definition: osd.c:962
static void Unlock(void)
Definition: osd.h:540
virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias=false)
Draws the given Image into this pixmap at the given Point and scales it.
Definition: osd.h:617
virtual void DrawImage(const cPoint &Point, int ImageHandle)=0
Draws the image referenced by the given ImageHandle into this pixmap at the given Point.
virtual void Clear(void)=0
Clears the pixmap's draw port by setting all pixels to be fully transparent.
void MarkViewPortDirty(const cRect &Rect)
Marks the given rectangle of the view port of this pixmap as dirty.
Definition: osd.c:987
cRect dirtyDrawPort
Definition: osd.h:470
cRect viewPort
Definition: osd.h:467
int Alpha(void) const
Definition: osd.h:542
virtual void DrawImage(const cPoint &Point, const cImage &Image)=0
Draws the given Image into this pixmap at the given Point.
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't g...
virtual void DrawRectangle(const cRect &Rect, tColor Color)=0
Draws a filled rectangle with the given Color.
virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty=true)
Sets the pixmap's draw port to the given Point.
Definition: osd.c:1085
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:534
static cMutex mutex
Definition: osd.h:463
virtual void SetLayer(int Layer)
Sets the layer of this pixmap to the given value.
Definition: osd.c:1024
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false)=0
Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the ...
const cRect & ViewPort(void) const
Returns the pixmap's view port, which is relative to the OSD's origin.
Definition: osd.h:544
void MarkDrawPortDirty(const cRect &Rect)
Marks the given rectangle of the draw port of this pixmap as dirty.
Definition: osd.c:999
void SetClean(void)
Resets the "dirty" rectangles of this pixmap.
Definition: osd.c:1019
virtual void DrawPixel(const cPoint &Point, tColor Color)=0
Draws the image referenced by the given ImageHandle into this pixmap at the given Point and scales it...
virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)=0
Copies the part of the given Pixmap covered by Source into this pixmap at location Dest.
virtual void Fill(tColor Color)=0
Fills the pixmap's draw port with the given Color.
const cRect & DirtyDrawPort(void) const
Returns the "dirty" rectangle in the draw port of this this pixmap.
Definition: osd.h:559
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.
bool tile
Definition: osd.h:466
cRect dirtyViewPort
Definition: osd.h:469
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.
virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)=0
Renders the part of the given Pixmap covered by Source into this pixmap at location Dest.
virtual void SetAlpha(int Alpha)
Sets the alpha value of this pixmap to the given value.
Definition: osd.c:1046
int layer
Definition: osd.h:464
const cRect & DirtyViewPort(void) const
Returns the "dirty" rectangle this pixmap causes on the OSD.
Definition: osd.h:552
cRect drawPort
Definition: osd.h:468
virtual void Scroll(const cPoint &Dest, const cRect &Source=cRect::Null)=0
Scrolls the data in the pixmap's draw port to the given Dest point.
virtual void SetTile(bool Tile)
Sets the tile property of this pixmap to the given value.
Definition: osd.c:1057
int Layer(void) const
Definition: osd.h:541
Definition: osd.h:306
cPoint(void)
Definition: osd.h:311
void SetY(int Y)
Definition: osd.h:321
cPoint operator-(void) const
Definition: osd.h:316
int Y(void) const
Definition: osd.h:319
int X(void) const
Definition: osd.h:318
cPoint operator-(const cPoint &Point) const
Definition: osd.h:317
cPoint(int X, int Y)
Definition: osd.h:312
cPoint(const cPoint &Point)
Definition: osd.h:313
bool operator!=(const cPoint &Point) const
Definition: osd.h:315
void Set(int X, int Y)
Definition: osd.h:322
void Set(const cPoint &Point)
Definition: osd.h:323
void SetX(int X)
Definition: osd.h:320
bool operator==(const cPoint &Point) const
Definition: osd.h:314
cPoint Shifted(int Dx, int Dy) const
Definition: osd.h:326
void Shift(int Dx, int Dy)
Definition: osd.h:324
int y
Definition: osd.h:309
int x
Definition: osd.h:308
cPoint Shifted(const cPoint &Dp) const
Definition: osd.h:327
void Shift(const cPoint &Dp)
Definition: osd.h:325
Definition: osd.h:352
static const cRect Null
Definition: osd.h:357
void Combine(const cRect &Rect)
Combines this rectangle with the given Rect.
Definition: osd.c:934
bool operator!=(const cRect &Rect) const
Definition: osd.h:364
int Top(void) const
Definition: osd.h:370
cRect(const cSize &Size)
Definition: osd.h:361
void SetHeight(int Height)
Definition: osd.h:384
cSize size
Definition: osd.h:355
void Set(cPoint Point, cSize Size)
Definition: osd.h:376
void SetSize(const cSize &Size)
Definition: osd.h:380
void Shift(const cPoint &Dp)
Definition: osd.h:390
bool Intersects(const cRect &Rect) const
Returns true if this rectangle intersects with Rect.
Definition: osd.c:914
bool Contains(const cPoint &Point) const
Returns true if this rectangle contains Point.
Definition: osd.c:898
void SetPoint(int X, int Y)
Definition: osd.h:377
cRect Intersected(const cRect &Rect) const
Returns the intersection of this rectangle and the given Rect.
Definition: osd.c:922
int Height(void) const
Definition: osd.h:368
int Left(void) const
Definition: osd.h:369
int Bottom(void) const
Definition: osd.h:372
void SetSize(int Width, int Height)
Definition: osd.h:379
int Y(void) const
Definition: osd.h:366
bool operator==(const cRect &Rect) const
Definition: osd.h:363
void SetRight(int Right)
Definition: osd.h:387
const cSize & Size(void) const
Definition: osd.h:374
int X(void) const
Definition: osd.h:365
void SetPoint(const cPoint &Point)
Definition: osd.h:378
void Grow(int Dx, int Dy)
Grows the rectangle by the given number of pixels in either direction.
Definition: osd.c:892
int Right(void) const
Definition: osd.h:371
void SetTop(int Top)
Definition: osd.h:386
void SetX(int X)
Definition: osd.h:381
void SetLeft(int Left)
Definition: osd.h:385
cRect Shifted(int Dx, int Dy) const
Definition: osd.h:391
void SetBottom(int Bottom)
Definition: osd.h:388
cPoint point
Definition: osd.h:354
void SetY(int Y)
Definition: osd.h:382
cRect(void)
Definition: osd.h:358
void Shift(int Dx, int Dy)
Definition: osd.h:389
cRect(const cRect &Rect)
Definition: osd.h:362
void SetWidth(int Width)
Definition: osd.h:383
int Width(void) const
Definition: osd.h:367
cRect Combined(const cRect &Rect) const
Returns the surrounding rectangle that contains this rectangle and the given Rect.
Definition: osd.h:407
cRect Grown(int Dw, int Dh) const
Definition: osd.h:396
const cPoint & Point(void) const
Definition: osd.h:373
cRect(int X, int Y, int Width, int Height)
Definition: osd.h:359
cRect Shifted(const cPoint &Dp) const
Definition: osd.h:392
cRect Combined(const cPoint &Point) const
Returns the surrounding rectangle that contains this rectangle and the given Point.
Definition: osd.h:412
cRect(const cPoint &Point, const cSize &Size)
Definition: osd.h:360
bool IsEmpty(void) const
Returns true if this rectangle is empty.
Definition: osd.h:415
void Set(int X, int Y, int Width, int Height)
Definition: osd.h:375
int OSDHeight
Definition: config.h:332
int OSDTop
Definition: config.h:332
int OSDLeft
Definition: config.h:332
int OSDWidth
Definition: config.h:332
Definition: osd.h:330
bool Contains(const cPoint &Point) const
Definition: osd.h:347
int width
Definition: osd.h:332
cSize(int Width, int Height)
Definition: osd.h:336
void Set(const cSize &Size)
Definition: osd.h:346
void Grow(int Dw, int Dh)
Definition: osd.h:348
void SetWidth(int Width)
Definition: osd.h:343
int Height(void) const
Definition: osd.h:342
int Width(void) const
Definition: osd.h:341
cSize(void)
Definition: osd.h:335
void Set(int Width, int Height)
Definition: osd.h:345
void SetHeight(int Height)
Definition: osd.h:344
int height
Definition: osd.h:333
bool operator!=(const cSize &Size) const
Definition: osd.h:339
cSize Grown(int Dw, int Dh) const
Definition: osd.h:349
bool operator==(const cSize &Size) const
Definition: osd.h:338
cSize(const cSize &Size)
Definition: osd.h:337
bool operator<(const cSize &Size) const
Definition: osd.h:340
int Height(void)
Definition: osd.h:1088
tColor colorBg
Definition: osd.h:1076
int Left(void)
Definition: osd.h:1085
void DrawText(void)
Definition: osd.c:2443
bool CanScroll(void)
Definition: osd.h:1092
int shown
Definition: osd.h:1077
int Total(void)
Definition: osd.h:1089
int height
Definition: osd.h:1074
cTextWrapper textWrapper
Definition: osd.h:1078
const cFont * font
Definition: osd.h:1075
cTextScroller(void)
Definition: osd.c:2405
void Scroll(bool Up, bool Page)
Definition: osd.c:2451
int Top(void)
Definition: osd.h:1086
int Offset(void)
Definition: osd.h:1090
void Set(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg)
Definition: osd.c:2421
void Reset(void)
Definition: osd.c:2438
tColor colorFg
Definition: osd.h:1076
int left
Definition: osd.h:1074
int width
Definition: osd.h:1074
int Shown(void)
Definition: osd.h:1091
cOsd * osd
Definition: osd.h:1073
int top
Definition: osd.h:1074
bool CanScrollDown(void)
Definition: osd.h:1094
int offset
Definition: osd.h:1077
int Width(void)
Definition: osd.h:1087
bool CanScrollUp(void)
Definition: osd.h:1093
int Lines(void)
Returns the actual number of lines needed to display the full wrapped text.
Definition: font.h:121
int Size(void) const
Definition: tools.h:767
cSetup Setup
Definition: config.c:372
uint32_t tColor
Definition: font.h:29
uint8_t tIndex
Definition: font.h:31
#define ALPHA_OPAQUE
Definition: osd.h:26
tColor AlphaBlend(tColor ColorFg, tColor ColorBg, uint8_t AlphaLayer=ALPHA_OPAQUE)
Definition: osd.c:81
eTextAlignment
Definition: osd.h:158
@ taCenter
Definition: osd.h:158
@ taBorder
Definition: osd.h:163
@ taTop
Definition: osd.h:161
@ taBottom
Definition: osd.h:162
@ taRight
Definition: osd.h:160
@ taDefault
Definition: osd.h:164
@ taLeft
Definition: osd.h:159
tColor RgbShade(tColor Color, double Factor)
Returns a brighter (Factor > 0) or darker (Factor < 0) version of the given Color.
Definition: osd.c:43
#define MAXNUMCOLORS
Definition: osd.h:24
eOsdError
Definition: osd.h:44
@ oeTooManyColors
Definition: osd.h:46
@ oeUnknown
Definition: osd.h:52
@ oeTooManyAreas
Definition: osd.h:45
@ oeWrongAreaSize
Definition: osd.h:51
@ oeAreasOverlap
Definition: osd.h:48
@ oeOutOfMemory
Definition: osd.h:50
@ oeWrongAlignment
Definition: osd.h:49
@ oeOk
Definition: osd.h:44
@ oeBppNotSupported
Definition: osd.h:47
tColor RgbToColor(uint8_t R, uint8_t G, uint8_t B)
Definition: osd.h:63
#define OSD_LEVEL_DEFAULT
Definition: osd.h:21
@ clrBlue
Definition: osd.h:39
@ clrWhite
Definition: osd.h:41
@ clrRed
Definition: osd.h:35
@ clrYellow
Definition: osd.h:37
@ clrCyan
Definition: osd.h:40
@ clrBlack
Definition: osd.h:34
@ clrMagenta
Definition: osd.h:38
@ clrGray50
Definition: osd.h:33
@ clrTransparent
Definition: osd.h:32
@ clrGreen
Definition: osd.h:36
tColor ArgbToColor(uint8_t A, uint8_t R, uint8_t G, uint8_t B)
Definition: osd.h:58
#define MAXOSDAREAS
Definition: osd.h:740
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
#define MAXOSDIMAGES
Definition: osd.h:999
uint32_t tColor
Definition: osd.h:55
uint8_t tIndex
Definition: osd.h:56
static const cCursesFont Font
Definition: skincurses.c:31
Definition: osd.h:298
int Width(void) const
Definition: osd.h:301
int bpp
Definition: osd.h:300
int x2
Definition: osd.h:299
int y1
Definition: osd.h:299
int x1
Definition: osd.h:299
int Height(void) const
Definition: osd.h:302
bool Intersects(const tArea &Area) const
Definition: osd.h:303
int y2
Definition: osd.h:299