vdr
1.7.27
|
00001 /* 00002 * osd.h: Abstract On Screen Display layer 00003 * 00004 * See the main source file 'vdr.c' for copyright information and 00005 * how to reach the author. 00006 * 00007 * $Id: osd.h 2.15 2011/12/04 13:38:17 kls Exp $ 00008 */ 00009 00010 #ifndef __OSD_H 00011 #define __OSD_H 00012 00013 #include <limits.h> 00014 #include <stdio.h> 00015 #include <stdint.h> 00016 #include "config.h" 00017 #include "font.h" 00018 #include "thread.h" 00019 #include "tools.h" 00020 00021 #define OSD_LEVEL_DEFAULT 0 00022 #define OSD_LEVEL_SUBTITLES 10 00023 00024 #define MAXNUMCOLORS 256 00025 #define ALPHA_TRANSPARENT 0x00 00026 #define ALPHA_OPAQUE 0xFF 00027 #define IS_OPAQUE(c) ((c >> 24) == ALPHA_OPAQUE) 00028 00029 enum { 00030 //AARRGGBB 00031 clrTransparent = 0x00000000, 00032 clrGray50 = 0x7F000000, // 50% gray 00033 clrBlack = 0xFF000000, 00034 clrRed = 0xFFFC1414, 00035 clrGreen = 0xFF24FC24, 00036 clrYellow = 0xFFFCC024, 00037 clrMagenta = 0xFFB000FC, 00038 clrBlue = 0xFF0000FC, 00039 clrCyan = 0xFF00FCFC, 00040 clrWhite = 0xFFFCFCFC, 00041 }; 00042 00043 enum eOsdError { oeOk, // see also OsdErrorTexts in osd.c 00044 oeTooManyAreas, 00045 oeTooManyColors, 00046 oeBppNotSupported, 00047 oeAreasOverlap, 00048 oeWrongAlignment, 00049 oeOutOfMemory, 00050 oeWrongAreaSize, 00051 oeUnknown, 00052 }; 00053 00054 typedef uint32_t tColor; // see also font.h 00055 typedef uint8_t tIndex; 00056 00057 inline tColor ArgbToColor(uint8_t A, uint8_t R, uint8_t G, uint8_t B) 00058 { 00059 return (tColor(A) << 24) | (tColor(R) << 16) | (tColor(G) << 8) | B; 00060 } 00061 00062 inline tColor RgbToColor(uint8_t R, uint8_t G, uint8_t B) 00063 { 00064 return (tColor(R) << 16) | (tColor(G) << 8) | B; 00065 } 00066 00067 inline tColor RgbToColor(double R, double G, double B) 00068 { 00069 return RgbToColor(uint8_t(0xFF * R), uint8_t(0xFF * G), uint8_t(0xFF * B)); 00070 } 00071 00072 tColor HsvToColor(double H, double S, double V); 00076 00077 tColor AlphaBlend(tColor ColorFg, tColor ColorBg, uint8_t AlphaLayer = ALPHA_OPAQUE); 00078 00079 class cPalette { 00080 private: 00081 tColor color[MAXNUMCOLORS]; 00082 int bpp; 00083 int maxColors, numColors; 00084 bool modified; 00085 double antiAliasGranularity; 00086 protected: 00087 typedef tIndex tIndexes[MAXNUMCOLORS]; 00088 public: 00089 cPalette(int Bpp = 8); 00091 virtual ~cPalette(); 00092 void SetAntiAliasGranularity(uint FixedColors, uint BlendColors); 00102 int Bpp(void) const { return bpp; } 00103 void Reset(void); 00105 int Index(tColor Color); 00110 tColor Color(int Index) const { return Index < maxColors ? color[Index] : 0; } 00113 void SetBpp(int Bpp); 00116 void SetColor(int Index, tColor Color); 00120 const tColor *Colors(int &NumColors) const; 00125 void Take(const cPalette &Palette, tIndexes *Indexes = NULL, tColor ColorFg = 0, tColor ColorBg = 0); 00132 void Replace(const cPalette &Palette); 00135 tColor Blend(tColor ColorFg, tColor ColorBg, uint8_t Level) const; 00141 int ClosestColor(tColor Color, int MaxDiff = INT_MAX) const; 00147 }; 00148 00149 enum eTextAlignment { taCenter = 0x00, 00150 taLeft = 0x01, 00151 taRight = 0x02, 00152 taTop = 0x04, 00153 taBottom = 0x08, 00154 taDefault = taTop | taLeft 00155 }; 00156 00157 class cFont; 00158 00159 class cBitmap : public cPalette { 00160 private: 00161 tIndex *bitmap; 00162 int x0, y0; 00163 int width, height; 00164 int dirtyX1, dirtyY1, dirtyX2, dirtyY2; 00165 public: 00166 cBitmap(int Width, int Height, int Bpp, int X0 = 0, int Y0 = 0); 00171 cBitmap(const char *FileName); 00173 cBitmap(const char *const Xpm[]); 00175 virtual ~cBitmap(); 00176 int X0(void) const { return x0; } 00177 int Y0(void) const { return y0; } 00178 int Width(void) const { return width; } 00179 int Height(void) const { return height; } 00180 void SetSize(int Width, int Height); 00185 bool Contains(int x, int y) const; 00187 bool Covers(int x1, int y1, int x2, int y2) const; 00190 bool Intersects(int x1, int y1, int x2, int y2) const; 00193 bool Dirty(int &x1, int &y1, int &x2, int &y2); 00196 void Clean(void); 00198 bool LoadXpm(const char *FileName); 00201 bool SetXpm(const char *const Xpm[], bool IgnoreNone = false); 00211 void SetIndex(int x, int y, tIndex Index); 00214 void DrawPixel(int x, int y, tColor Color); 00218 void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false); 00228 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); 00234 void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color); 00239 void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0); 00249 void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type); 00261 const tIndex *Data(int x, int y) const; 00263 tColor GetColor(int x, int y) const { return Color(*Data(x, y)); } 00265 void ReduceBpp(const cPalette &Palette); 00271 void ShrinkBpp(int NewBpp); 00276 cBitmap *Scaled(double FactorX, double FactorY, bool AntiAlias = false); 00282 }; 00283 00284 struct tArea { 00285 int x1, y1, x2, y2; 00286 int bpp; 00287 int Width(void) const { return x2 - x1 + 1; } 00288 int Height(void) const { return y2 - y1 + 1; } 00289 bool Intersects(const tArea &Area) const { return !(x2 < Area.x1 || x1 > Area.x2 || y2 < Area.y1 || y1 > Area.y2); } 00290 }; 00291 00292 class cPoint { 00293 private: 00294 int x; 00295 int y; 00296 public: 00297 cPoint(void) { x = y = 0; } 00298 cPoint(int X, int Y) { x = X; y = Y; } 00299 cPoint(const cPoint &Point) { x = Point.X(); y = Point.Y(); } 00300 bool operator==(const cPoint &Point) const { return x == Point.X() && y == Point.Y(); } 00301 bool operator!=(const cPoint &Point) const { return !(*this == Point); } 00302 cPoint operator-(void) const { return cPoint(-x, -y); } 00303 cPoint operator-(const cPoint &Point) const { return cPoint(x - Point.X(), y - Point.Y()); } 00304 int X(void) const { return x; } 00305 int Y(void) const { return y; } 00306 void SetX(int X) { x = X; } 00307 void SetY(int Y) { y = Y; } 00308 void Set(int X, int Y) { x = X; y = Y; } 00309 void Set(const cPoint &Point) { x = Point.X(); y = Point.Y(); } 00310 void Shift(int Dx, int Dy) { x += Dx; y += Dy; } 00311 void Shift(const cPoint &Dp) { x += Dp.X(); y += Dp.Y(); } 00312 cPoint Shifted(int Dx, int Dy) const { cPoint p(*this); p.Shift(Dx, Dy); return p; } 00313 cPoint Shifted(const cPoint &Dp) const { cPoint p(*this); p.Shift(Dp); return p; } 00314 }; 00315 00316 class cSize { 00317 private: 00318 int width; 00319 int height; 00320 public: 00321 cSize(void) { width = height = 0; } 00322 cSize(int Width, int Height) { width = Width; height = Height; } 00323 cSize(const cSize &Size) { width = Size.Width(); height = Size.Height(); } 00324 bool operator==(const cSize &Size) const { return width == Size.Width() && height == Size.Height(); } 00325 bool operator!=(const cSize &Size) const { return !(*this == Size); } 00326 bool operator<(const cSize &Size) const { return width < Size.Width() && height < Size.Height(); } 00327 int Width(void) const { return width; } 00328 int Height(void) const { return height; } 00329 void SetWidth(int Width) { width = Width; } 00330 void SetHeight(int Height) { height = Height; } 00331 void Set(int Width, int Height) { width = Width; height = Height; } 00332 void Set(const cSize &Size) { width = Size.Width(); height = Size.Height(); } 00333 bool Contains(const cPoint &Point) const { return 0 <= Point.X() && 0 <= Point.Y() && Point.X() < width && Point.Y() < height; } 00334 void Grow(int Dw, int Dh) { width += 2 * Dw; height += 2 * Dh; } 00335 cSize Grown(int Dw, int Dh) const { cSize s(*this); s.Grow(Dw, Dh); return s; } 00336 }; 00337 00338 class cRect { 00339 private: 00340 cPoint point; 00341 cSize size; 00342 public: 00343 static const cRect Null; 00344 cRect(void): point(0, 0), size(0, 0) {} 00345 cRect(int X, int Y, int Width, int Height): point(X, Y), size(Width, Height) {} 00346 cRect(const cPoint &Point, const cSize &Size): point(Point), size(Size) {} 00347 cRect(const cSize &Size): point(0, 0), size(Size) {} 00348 cRect(const cRect &Rect): point(Rect.Point()), size(Rect.Size()) {} 00349 bool operator==(const cRect &Rect) const { return point == Rect.Point() && size == Rect.Size(); } 00350 bool operator!=(const cRect &Rect) const { return !(*this == Rect); } 00351 int X(void) const { return point.X(); } 00352 int Y(void) const { return point.Y(); } 00353 int Width(void) const { return size.Width(); } 00354 int Height(void) const { return size.Height(); } 00355 int Left(void) const { return X(); } 00356 int Top(void) const { return Y(); } 00357 int Right(void) const { return X() + Width() - 1; } 00358 int Bottom(void) const { return Y() + Height() - 1; } 00359 const cPoint &Point(void) const { return point; } 00360 const cSize &Size(void) const { return size; } 00361 void Set(int X, int Y, int Width, int Height) { point.Set(X, Y); size.Set(Width, Height); } 00362 void Set(cPoint Point, cSize Size) { point.Set(Point); size.Set(Size); } 00363 void SetPoint(int X, int Y) { point.Set(X, Y); } 00364 void SetPoint(const cPoint &Point) { point.Set(Point); } 00365 void SetSize(int Width, int Height) { size.Set(Width, Height); } 00366 void SetSize(const cSize &Size) { size.Set(Size); } 00367 void SetX(int X) { point.SetX(X); } 00368 void SetY(int Y) { point.SetY(Y); } 00369 void SetWidth(int Width) { size.SetWidth(Width); } 00370 void SetHeight(int Height) { size.SetHeight(Height); } 00371 void SetLeft(int Left) { SetWidth(Width() + X() - Left); SetX(Left); } 00372 void SetTop(int Top) { SetHeight(Height() + Y() - Top); SetY(Top); } 00373 void SetRight(int Right) { SetWidth(Right - X() + 1); } 00374 void SetBottom(int Bottom) { SetHeight(Bottom - Y() + 1); } 00375 void Shift(int Dx, int Dy) { point.Shift(Dx, Dy); } 00376 void Shift(const cPoint &Dp) { point.Shift(Dp); } 00377 cRect Shifted(int Dx, int Dy) const { cRect r(*this); r.Shift(Dx, Dy); return r; } 00378 cRect Shifted(const cPoint &Dp) const { cRect r(*this); r.Shift(Dp); return r; } 00379 void Grow(int Dx, int Dy); 00382 cRect Grown(int Dw, int Dh) const { cRect r(*this); r.Grow(Dw, Dh); return r; } 00383 bool Contains(const cPoint &Point) const; 00385 bool Contains(const cRect &Rect) const; 00387 bool Intersects(const cRect &Rect) const; 00389 cRect Intersected(const cRect &Rect) const; 00391 void Combine(const cRect &Rect); 00393 cRect Combined(const cRect &Rect) const { cRect r(*this); r.Combine(Rect); return r; } 00396 void Combine(const cPoint &Point); 00398 cRect Combined(const cPoint &Point) const { cRect r(*this); r.Combine(Point); return r; } 00401 bool IsEmpty(void) const { return Width() <= 0 || Height() <= 0; } 00403 }; 00404 00405 class cImage { 00406 private: 00407 cSize size; 00408 tColor *data; 00409 public: 00410 cImage(void); 00411 cImage(const cImage &Image); 00412 cImage(const cSize &Size, const tColor *Data = NULL); 00419 virtual ~cImage(); 00420 const cSize &Size(void) const { return size; } 00421 int Width(void) const { return size.Width(); } 00422 int Height(void) const { return size.Height(); } 00423 const tColor *Data(void) const { return data; } 00424 tColor GetPixel(const cPoint &Point) const { return data[size.Width() * Point.Y() + Point.X()]; } 00428 void SetPixel(const cPoint &Point, tColor Color) { data[size.Width() * Point.Y() + Point.X()] = Color; } 00432 void Clear(void); 00434 void Fill(tColor Color); 00436 }; 00437 00438 #define MAXPIXMAPLAYERS 8 00439 00440 class cPixmap { 00441 friend class cOsd; 00442 friend class cPixmapMutexLock; 00443 private: 00444 static cMutex mutex; 00445 int layer; 00446 int alpha; 00447 bool tile; 00448 cRect viewPort; 00449 cRect drawPort; 00450 cRect dirtyViewPort; 00451 cRect dirtyDrawPort; 00452 protected: 00453 virtual ~cPixmap() {} 00454 void MarkViewPortDirty(const cRect &Rect); 00458 void MarkViewPortDirty(const cPoint &Point); 00462 void MarkDrawPortDirty(const cRect &Rect); 00468 void MarkDrawPortDirty(const cPoint &Point); 00474 void SetClean(void); 00476 virtual void DrawPixmap(const cPixmap *Pixmap, const cRect &Dirty); 00481 public: 00482 cPixmap(void); 00483 cPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); 00511 static void Lock(void) { mutex.Lock(); } 00517 static void Unlock(void) { mutex.Unlock(); } 00518 int Layer(void) const { return layer; } 00519 int Alpha(void) const { return alpha; } 00520 bool Tile(void) const { return tile; } 00521 const cRect &ViewPort(void) const { return viewPort; } 00525 const cRect &DrawPort(void) const { return drawPort; } 00529 const cRect &DirtyViewPort(void) const { return dirtyViewPort; } 00536 const cRect &DirtyDrawPort(void) const { return dirtyDrawPort; } 00543 virtual void SetLayer(int Layer); 00550 virtual void SetAlpha(int Alpha); 00555 virtual void SetTile(bool Tile); 00561 virtual void SetViewPort(const cRect &Rect); 00565 virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty = true); 00574 virtual void Clear(void) = 0; 00577 virtual void Fill(tColor Color) = 0; 00580 virtual void DrawImage(const cPoint &Point, const cImage &Image) = 0; 00582 virtual void DrawImage(const cPoint &Point, int ImageHandle) = 0; 00587 virtual void DrawPixel(const cPoint &Point, tColor Color) = 0; 00592 virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false) = 0; 00603 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; 00609 virtual void DrawRectangle(const cRect &Rect, tColor Color) = 0; 00611 virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0) = 0; 00620 virtual void DrawSlope(const cRect &Rect, tColor Color, int Type) = 0; 00631 virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) = 0; 00635 virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) = 0; 00640 virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null) = 0; 00644 virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null) = 0; 00656 }; 00657 00658 class cPixmapMutexLock : public cMutexLock { 00659 public: 00660 cPixmapMutexLock(void): cMutexLock(&cPixmap::mutex) {} 00661 }; 00662 00663 #define LOCK_PIXMAPS cPixmapMutexLock PixmapMutexLock 00664 00665 // cPixmapMemory is an implementation of cPixmap that uses an array of tColor 00666 // values to store the pixmap. 00667 00668 class cPixmapMemory : public cPixmap { 00669 private: 00670 tColor *data; 00671 bool panning; 00672 public: 00673 cPixmapMemory(void); 00674 cPixmapMemory(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); 00675 virtual ~cPixmapMemory(); 00676 const uint8_t *Data(void) { return (uint8_t *)data; } 00677 virtual void Clear(void); 00678 virtual void Fill(tColor Color); 00679 virtual void DrawImage(const cPoint &Point, const cImage &Image); 00680 virtual void DrawImage(const cPoint &Point, int ImageHandle); 00681 virtual void DrawPixel(const cPoint &Point, tColor Color); 00682 virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false); 00683 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); 00684 virtual void DrawRectangle(const cRect &Rect, tColor Color); 00685 virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0); 00686 virtual void DrawSlope(const cRect &Rect, tColor Color, int Type); 00687 virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest); 00688 virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest); 00689 virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null); 00690 virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null); 00691 }; 00692 00693 #define MAXOSDAREAS 16 00694 #define MAXOSDPIXMAPS 64 00695 00706 00707 class cOsd { 00708 friend class cOsdProvider; 00709 private: 00710 static int osdLeft, osdTop, osdWidth, osdHeight; 00711 static cVector<cOsd *> Osds; 00712 static cMutex mutex; 00713 bool isTrueColor; 00714 cBitmap *savedBitmap; 00715 cBitmap *bitmaps[MAXOSDAREAS]; 00716 int numBitmaps; 00717 cPixmapMemory *savedPixmap; 00718 cPixmap *pixmaps[MAXOSDPIXMAPS]; 00719 int numPixmaps; 00720 int left, top, width, height; 00721 uint level; 00722 bool active; 00723 protected: 00724 cOsd(int Left, int Top, uint Level); 00744 bool Active(void) { return active; } 00745 virtual void SetActive(bool On) { active = On; } 00748 const cPixmap * const *Pixmaps(void) { return pixmaps; } 00750 int NumPixmaps(void) { return numPixmaps; } 00752 cPixmap *AddPixmap(cPixmap *Pixmap); 00758 cPixmapMemory *RenderPixmaps(void); 00774 public: 00775 virtual ~cOsd(); 00777 static int OsdLeft(void) { return osdLeft ? osdLeft : Setup.OSDLeft; } 00778 static int OsdTop(void) { return osdTop ? osdTop : Setup.OSDTop; } 00779 static int OsdWidth(void) { return osdWidth ? osdWidth : Setup.OSDWidth; } 00780 static int OsdHeight(void) { return osdHeight ? osdHeight : Setup.OSDHeight; } 00781 static void SetOsdPosition(int Left, int Top, int Width, int Height); 00786 static int IsOpen(void) { return Osds.Size() && Osds[0]->level == OSD_LEVEL_DEFAULT; } 00788 bool IsTrueColor(void) const { return isTrueColor; } 00791 int Left(void) { return left; } 00792 int Top(void) { return top; } 00793 int Width(void) { return width; } 00794 int Height(void) { return height; } 00795 void SetAntiAliasGranularity(uint FixedColors, uint BlendColors); 00806 cBitmap *GetBitmap(int Area); 00812 virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); 00818 virtual void DestroyPixmap(cPixmap *Pixmap); 00823 virtual void DrawImage(const cPoint &Point, const cImage &Image); 00826 virtual void DrawImage(const cPoint &Point, int ImageHandle); 00832 virtual eOsdError CanHandleAreas(const tArea *Areas, int NumAreas); 00840 virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); 00852 virtual void SaveRegion(int x1, int y1, int x2, int y2); 00856 virtual void RestoreRegion(void); 00859 virtual eOsdError SetPalette(const cPalette &Palette, int Area); 00862 virtual void DrawPixel(int x, int y, tColor Color); 00868 virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = false); 00879 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); 00885 virtual void DrawRectangle(int x1, int y1, int x2, int y2, tColor Color); 00888 virtual void DrawEllipse(int x1, int y1, int x2, int y2, tColor Color, int Quadrants = 0); 00898 virtual void DrawSlope(int x1, int y1, int x2, int y2, tColor Color, int Type); 00910 virtual void Flush(void); 00924 }; 00925 00926 #define MAXOSDIMAGES 64 00927 00928 class cOsdProvider { 00929 friend class cPixmapMemory; 00930 private: 00931 static cOsdProvider *osdProvider; 00932 static int oldWidth; 00933 static int oldHeight; 00934 static double oldAspect; 00935 static cImage *images[MAXOSDIMAGES]; 00936 protected: 00937 virtual cOsd *CreateOsd(int Left, int Top, uint Level) = 0; 00940 virtual bool ProvidesTrueColor(void) { return false; } 00942 virtual int StoreImageData(const cImage &Image); 00953 virtual void DropImageData(int ImageHandle); 00955 static const cImage *GetImageData(int ImageHandle); 00957 public: 00958 cOsdProvider(void); 00959 //XXX maybe parameter to make this one "sticky"??? (frame-buffer etc.) 00960 virtual ~cOsdProvider(); 00961 static cOsd *NewOsd(int Left, int Top, uint Level = OSD_LEVEL_DEFAULT); 00967 static void UpdateOsdSize(bool Force = false); 00972 static bool SupportsTrueColor(void); 00974 static int StoreImage(const cImage &Image); 00984 static void DropImage(int ImageHandle); 00987 static void Shutdown(void); 00989 }; 00990 00991 class cTextScroller { 00992 private: 00993 cOsd *osd; 00994 int left, top, width, height; 00995 const cFont *font; 00996 tColor colorFg, colorBg; 00997 int offset, shown; 00998 cTextWrapper textWrapper; 00999 void DrawText(void); 01000 public: 01001 cTextScroller(void); 01002 cTextScroller(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg); 01003 void Set(cOsd *Osd, int Left, int Top, int Width, int Height, const char *Text, const cFont *Font, tColor ColorFg, tColor ColorBg); 01004 void Reset(void); 01005 int Left(void) { return left; } 01006 int Top(void) { return top; } 01007 int Width(void) { return width; } 01008 int Height(void) { return height; } 01009 int Total(void) { return textWrapper.Lines(); } 01010 int Offset(void) { return offset; } 01011 int Shown(void) { return shown; } 01012 bool CanScroll(void) { return CanScrollUp() || CanScrollDown(); } 01013 bool CanScrollUp(void) { return offset > 0; } 01014 bool CanScrollDown(void) { return offset + shown < Total(); } 01015 void Scroll(bool Up, bool Page); 01016 }; 01017 01018 #endif //__OSD_H