vdr  2.2.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
cHdffOsd Class Reference

Public Member Functions

 cHdffOsd (int Left, int Top, HDFF::cHdffCmdIf *pHdffCmdIf, uint Level)
 
virtual ~cHdffOsd ()
 
virtual eOsdError CanHandleAreas (const tArea *Areas, int NumAreas)
 
virtual eOsdError SetAreas (const tArea *Areas, int NumAreas)
 
virtual void SaveRegion (int x1, int y1, int x2, int y2)
 
virtual void RestoreRegion (void)
 
virtual void DrawPixel (int x, int y, tColor Color)
 
virtual void DrawBitmap (int x, int y, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool ReplacePalette=false, bool Overlay=false)
 
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)
 
virtual void DrawRectangle (int x1, int y1, int x2, int y2, tColor Color)
 
virtual void DrawEllipse (int x1, int y1, int x2, int y2, tColor Color, int Quadrants=0)
 
virtual void DrawSlope (int x1, int y1, int x2, int y2, tColor Color, int Type)
 
virtual void Flush (void)
 
- Public Member Functions inherited from cOsd
virtual ~cOsd ()
 
bool IsTrueColor (void) const
 
int Left (void)
 
int Top (void)
 
int Width (void)
 
int Height (void)
 
void SetAntiAliasGranularity (uint FixedColors, uint BlendColors)
 
cBitmapGetBitmap (int Area)
 
virtual cPixmapCreatePixmap (int Layer, const cRect &ViewPort, const cRect &DrawPort=cRect::Null)
 
virtual void DestroyPixmap (cPixmap *Pixmap)
 
virtual void DrawImage (const cPoint &Point, const cImage &Image)
 
virtual void DrawImage (const cPoint &Point, int ImageHandle)
 
virtual eOsdError SetPalette (const cPalette &Palette, int Area)
 
virtual void DrawScaledBitmap (int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias=false)
 

Protected Member Functions

virtual void SetActive (bool On)
 
- Protected Member Functions inherited from cOsd
 cOsd (int Left, int Top, uint Level)
 
bool Active (void)
 
cPixmapAddPixmap (cPixmap *Pixmap)
 
cPixmapRenderPixmaps (void)
 

Private Attributes

HDFF::cHdffCmdIfmHdffCmdIf
 
int mLeft
 
int mTop
 
int mDispWidth
 
int mDispHeight
 
bool mChanged
 
uint32_t mDisplay
 
tFontFace mFontFaces [MAX_NUM_FONTFACES]
 
tFont mFonts [MAX_NUM_FONTS]
 
uint32_t mBitmapPalette
 
uint32_t mBitmapColors [256]
 
bool mSupportsUtf8Text
 

Additional Inherited Members

- Static Public Member Functions inherited from cOsd
static int OsdLeft (void)
 
static int OsdTop (void)
 
static int OsdWidth (void)
 
static int OsdHeight (void)
 
static void SetOsdPosition (int Left, int Top, int Width, int Height)
 
static int IsOpen (void)
 

Detailed Description

Definition at line 31 of file hdffosd.c.

Constructor & Destructor Documentation

cHdffOsd::cHdffOsd ( int  Left,
int  Top,
HDFF::cHdffCmdIf pHdffCmdIf,
uint  Level 
)
cHdffOsd::~cHdffOsd ( )
virtual

Member Function Documentation

eOsdError cHdffOsd::CanHandleAreas ( const tArea Areas,
int  NumAreas 
)
virtual

Checks whether the OSD can display the given set of sub-areas.

The return value indicates whether a call to SetAreas() with this set of areas will succeed. CanHandleAreas() may be called with an OSD that is already in use with other areas and will not interfere with the current operation of the OSD. A derived class must first call the base class CanHandleAreas() to check the basic conditions, like not overlapping etc.

Reimplemented from cOsd.

Definition at line 131 of file hdffosd.c.

References cOsd::CanHandleAreas(), oeBppNotSupported, and oeOk.

void cHdffOsd::DrawBitmap ( int  x,
int  y,
const cBitmap Bitmap,
tColor  ColorFg = 0,
tColor  ColorBg = 0,
bool  ReplacePalette = false,
bool  Overlay = false 
)
virtual

Sets the pixels in the OSD with the data from the given Bitmap, putting the upper left corner of the Bitmap at (x, y).

If ColorFg or ColorBg is given, the first palette entry of the Bitmap will be mapped to ColorBg and the second palette entry will be mapped to ColorFg (palette indexes are defined so that 0 is the background and 1 is the foreground color). ReplacePalette controls whether the target area shall have its palette replaced with the one from Bitmap. If Overlay is true, any pixel in Bitmap that has color index 0 will not overwrite the corresponding pixel in the target area. If this is a true color OSD, ReplacePalette has no meaning.

Reimplemented from cOsd.

Definition at line 204 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdCreatePalette(), HDFF::cHdffCmdIf::CmdOsdDrawBitmap(), HDFF::cHdffCmdIf::CmdOsdSetPaletteColors(), cPalette::Colors(), cBitmap::Data(), HDFF_COLOR_FORMAT_ARGB, HDFF_COLOR_TYPE_CLUT8, HDFF_INVALID_HANDLE, cBitmap::Height(), cOsd::height, MAX_BITMAP_SIZE, mBitmapColors, mBitmapPalette, mChanged, mDisplay, mHdffCmdIf, mLeft, mTop, cBitmap::Width(), and cOsd::width.

Referenced by Flush().

void cHdffOsd::DrawEllipse ( int  x1,
int  y1,
int  x2,
int  y2,
tColor  Color,
int  Quadrants = 0 
)
virtual

Draws a filled ellipse defined by the upper left (x1, y1) and lower right (x2, y2) corners with the given Color.

Quadrants controls which parts of the ellipse are actually drawn: 0 draws the entire ellipse 1..4 draws only the first, second, third or fourth quadrant, respectively 5..8 draws the right, top, left or bottom half, respectively -1..-4 draws the inverted part of the given quadrant If Quadrants is not 0, the coordinates are those of the actual area, not the full circle!

Reimplemented from cOsd.

Definition at line 417 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdDrawEllipse(), HDFF_DRAW_FULL, HDFF_DRAW_HALF_BOTTOM, HDFF_DRAW_HALF_LEFT, HDFF_DRAW_HALF_RIGHT, HDFF_DRAW_HALF_TOP, HDFF_DRAW_QUARTER_BOTTOM_LEFT, HDFF_DRAW_QUARTER_BOTTOM_LEFT_INVERTED, HDFF_DRAW_QUARTER_BOTTOM_RIGHT, HDFF_DRAW_QUARTER_BOTTOM_RIGHT_INVERTED, HDFF_DRAW_QUARTER_TOP_LEFT, HDFF_DRAW_QUARTER_TOP_LEFT_INVERTED, HDFF_DRAW_QUARTER_TOP_RIGHT, HDFF_DRAW_QUARTER_TOP_RIGHT_INVERTED, mChanged, mDisplay, mHdffCmdIf, mLeft, and mTop.

void cHdffOsd::DrawPixel ( int  x,
int  y,
tColor  Color 
)
virtual

Sets the pixel at the given coordinates to the given Color, which is a full 32 bit ARGB value.

If the OSD area has been divided into separate sub-areas, and the given coordinates don't fall into any of these sub-areas, no pixel will be set.

Reimplemented from cOsd.

Definition at line 199 of file hdffosd.c.

void cHdffOsd::DrawRectangle ( int  x1,
int  y1,
int  x2,
int  y2,
tColor  Color 
)
virtual

Draws a filled rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the given Color.

Reimplemented from cOsd.

Definition at line 411 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdDrawRectangle(), mChanged, mDisplay, mHdffCmdIf, mLeft, and mTop.

void cHdffOsd::DrawSlope ( int  x1,
int  y1,
int  x2,
int  y2,
tColor  Color,
int  Type 
)
virtual

Draws a "slope" into the rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the given Color.

Type controls the direction of the slope and which side of it will be drawn: 0: horizontal, rising, lower 1: horizontal, rising, upper 2: horizontal, falling, lower 3: horizontal, falling, upper 4: vertical, rising, lower 5: vertical, rising, upper 6: vertical, falling, lower 7: vertical, falling, upper

Reimplemented from cOsd.

Definition at line 507 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdDrawSlope(), mChanged, mDisplay, mHdffCmdIf, mLeft, and mTop.

void cHdffOsd::DrawText ( int  x,
int  y,
const char *  s,
tColor  ColorFg,
tColor  ColorBg,
const cFont Font,
int  Width = 0,
int  Height = 0,
int  Alignment = taDefault 
)
virtual

Draws the given string at coordinates (x, y) with the given foreground and background color and font.

If Width and Height are given, the text will be drawn into a rectangle with the given size and the given Alignment (default is top-left). If ColorBg is clrTransparent, no background pixels will be drawn, which allows drawing "transparent" text.

Reimplemented from cOsd.

Definition at line 249 of file hdffosd.c.

References clrTransparent, HDFF::cHdffCmdIf::CmdOsdCreateFont(), HDFF::cHdffCmdIf::CmdOsdCreateFontFace(), HDFF::cHdffCmdIf::CmdOsdDrawRectangle(), HDFF::cHdffCmdIf::CmdOsdDrawTextW(), HDFF::cHdffCmdIf::CmdOsdDrawUtf8Text(), HDFF::cHdffCmdIf::CmdOsdSetDisplayClippingArea(), cFont::FontName(), _tFontFace::Handle, _tFont::Handle, HDFF_INVALID_HANDLE, cFont::Height(), _tFont::hFontFace, max(), MAX_NUM_FONTFACES, MAX_NUM_FONTS, mChanged, mDisplay, mFontFaces, mFonts, mHdffCmdIf, mLeft, mSupportsUtf8Text, mTop, _tFontFace::Name, _tFont::Size, cFont::Size(), taBorder, taBottom, taLeft, taRight, taTop, TEXT_ALIGN_BORDER, Utf8CharGet(), SI::Utf8CharLen(), and cFont::Width().

void cHdffOsd::Flush ( void  )
virtual

Actually commits all data to the OSD hardware.

Flush() should return as soon as possible. For a true color OSD using the default implementation with in memory pixmaps, the Flush() function should basically do something like this:

LOCK_PIXMAPS; while (cPixmapMemory *pm = dynamic_cast<cPixmapMemory *>(RenderPixmaps())) { int w = pm->ViewPort().Width(); int h = pm->ViewPort().Height(); int d = w * sizeof(tColor); MyOsdDrawPixmap(Left() + pm->ViewPort().X(), Top() + pm->ViewPort().Y(), pm->Data(), w, h, h * d); DestroyPixmap(pm); }

If a plugin uses a derived cPixmap implementation, it needs to use that type instead of cPixmapMemory.

Reimplemented from cOsd.

Definition at line 515 of file hdffosd.c.

References cOsd::Active(), cBitmap::Clean(), HDFF::cHdffCmdIf::CmdOsdRenderDisplay(), cBitmap::Dirty(), DrawBitmap(), cOsd::GetBitmap(), mChanged, mDisplay, and mHdffCmdIf.

Referenced by SetActive().

void cHdffOsd::RestoreRegion ( void  )
virtual

Restores the region previously saved by a call to SaveRegion().

If SaveRegion() has not been called before, nothing will happen.

Reimplemented from cOsd.

Definition at line 193 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdRestoreRegion(), mChanged, mDisplay, and mHdffCmdIf.

void cHdffOsd::SaveRegion ( int  x1,
int  y1,
int  x2,
int  y2 
)
virtual

Saves the region defined by the given coordinates for later restoration through RestoreRegion().

Only one saved region can be active at any given time.

Reimplemented from cOsd.

Definition at line 187 of file hdffosd.c.

References HDFF::cHdffCmdIf::CmdOsdSaveRegion(), mChanged, mDisplay, mHdffCmdIf, mLeft, and mTop.

void cHdffOsd::SetActive ( bool  On)
protectedvirtual

Sets this OSD to be the active one.

A derived class must call cOsd::SetActive(On).

Reimplemented from cOsd.

Definition at line 169 of file hdffosd.c.

References cOsd::Active(), HDFF::cHdffCmdIf::CmdOsdDrawRectangle(), HDFF::cHdffCmdIf::CmdOsdRenderDisplay(), Flush(), cOsd::GetBitmap(), HDFF_INVALID_HANDLE, mDispHeight, mDisplay, mDispWidth, mHdffCmdIf, and cOsd::SetActive().

Referenced by ~cHdffOsd().

eOsdError cHdffOsd::SetAreas ( const tArea Areas,
int  NumAreas 
)
virtual

Sets the sub-areas to the given areas.

The return value indicates whether the operation was successful. If an error is reported, nothing will have changed and the previous OSD (if any) will still be displayed as before. If the OSD has been divided into several sub-areas, all areas that are part of the rectangle that surrounds a given drawing operation will be drawn into, with the proper offsets. A new call overwrites any previous settings To set up a true color OSD, exactly one area must be requested, with its coordinates set to the full area the OSD shall cover, and the bpp value set to 32.

Reimplemented from cOsd.

Definition at line 145 of file hdffosd.c.

References cOsd::Active(), cBitmap::Clean(), HDFF::cHdffCmdIf::CmdOsdDrawRectangle(), HDFF::cHdffCmdIf::CmdOsdRenderDisplay(), cOsd::GetBitmap(), HDFF_INVALID_HANDLE, mDispHeight, mDisplay, mDispWidth, mHdffCmdIf, and cOsd::SetAreas().

Member Data Documentation

uint32_t cHdffOsd::mBitmapColors[256]
private

Definition at line 44 of file hdffosd.c.

Referenced by DrawBitmap().

uint32_t cHdffOsd::mBitmapPalette
private

Definition at line 43 of file hdffosd.c.

Referenced by cHdffOsd(), DrawBitmap(), and ~cHdffOsd().

bool cHdffOsd::mChanged
private
int cHdffOsd::mDispHeight
private

Definition at line 38 of file hdffosd.c.

Referenced by cHdffOsd(), SetActive(), SetAreas(), and ~cHdffOsd().

uint32_t cHdffOsd::mDisplay
private
int cHdffOsd::mDispWidth
private

Definition at line 37 of file hdffosd.c.

Referenced by cHdffOsd(), SetActive(), SetAreas(), and ~cHdffOsd().

tFontFace cHdffOsd::mFontFaces[MAX_NUM_FONTFACES]
private

Definition at line 41 of file hdffosd.c.

Referenced by cHdffOsd(), DrawText(), and ~cHdffOsd().

tFont cHdffOsd::mFonts[MAX_NUM_FONTS]
private

Definition at line 42 of file hdffosd.c.

Referenced by cHdffOsd(), DrawText(), and ~cHdffOsd().

HDFF::cHdffCmdIf* cHdffOsd::mHdffCmdIf
private
int cHdffOsd::mLeft
private

Definition at line 35 of file hdffosd.c.

Referenced by cHdffOsd(), DrawBitmap(), DrawEllipse(), DrawRectangle(), DrawSlope(), DrawText(), and SaveRegion().

bool cHdffOsd::mSupportsUtf8Text
private

Definition at line 46 of file hdffosd.c.

Referenced by cHdffOsd(), and DrawText().

int cHdffOsd::mTop
private

Definition at line 36 of file hdffosd.c.

Referenced by cHdffOsd(), DrawBitmap(), DrawEllipse(), DrawRectangle(), DrawSlope(), DrawText(), and SaveRegion().


The documentation for this class was generated from the following file: