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

#include <osd.h>

Public Member Functions

 cPixmapMemory (void)
 
 cPixmapMemory (int Layer, const cRect &ViewPort, const cRect &DrawPort=cRect::Null)
 
virtual ~cPixmapMemory ()
 
const uint8_t * Data (void)
 
virtual void Clear (void)
 
virtual void Fill (tColor Color)
 
virtual void DrawImage (const cPoint &Point, const cImage &Image)
 
virtual void DrawImage (const cPoint &Point, int ImageHandle)
 
virtual void DrawPixel (const cPoint &Point, tColor Color)
 
virtual void DrawBitmap (const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false)
 
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)
 
virtual void DrawRectangle (const cRect &Rect, tColor Color)
 
virtual void DrawEllipse (const cRect &Rect, tColor Color, int Quadrants=0)
 
virtual void DrawSlope (const cRect &Rect, tColor Color, int Type)
 
virtual void Render (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)
 
virtual void Copy (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)
 
virtual void Scroll (const cPoint &Dest, const cRect &Source=cRect::Null)
 
virtual void Pan (const cPoint &Dest, const cRect &Source=cRect::Null)
 
- Public Member Functions inherited from cPixmap
 cPixmap (void)
 
 cPixmap (int Layer, const cRect &ViewPort, const cRect &DrawPort=cRect::Null)
 
int Layer (void) const
 
int Alpha (void) const
 
bool Tile (void) const
 
const cRectViewPort (void) const
 
const cRectDrawPort (void) const
 
const cRectDirtyViewPort (void) const
 
const cRectDirtyDrawPort (void) const
 
virtual void SetLayer (int Layer)
 
virtual void SetAlpha (int Alpha)
 
virtual void SetTile (bool Tile)
 
virtual void SetViewPort (const cRect &Rect)
 
virtual void SetDrawPortPoint (const cPoint &Point, bool Dirty=true)
 

Private Attributes

tColordata
 
bool panning
 

Additional Inherited Members

- Static Public Member Functions inherited from cPixmap
static void Lock (void)
 
static void Unlock (void)
 
- Protected Member Functions inherited from cPixmap
virtual ~cPixmap ()
 
void MarkViewPortDirty (const cRect &Rect)
 
void MarkViewPortDirty (const cPoint &Point)
 
void MarkDrawPortDirty (const cRect &Rect)
 
void MarkDrawPortDirty (const cPoint &Point)
 
void SetClean (void)
 
virtual void DrawPixmap (const cPixmap *Pixmap, const cRect &Dirty)
 

Detailed Description

Definition at line 682 of file osd.h.

Constructor & Destructor Documentation

cPixmapMemory::cPixmapMemory ( void  )

Definition at line 1142 of file osd.c.

Referenced by cOsd::CreatePixmap(), and cOsd::SaveRegion().

cPixmapMemory::cPixmapMemory ( int  Layer,
const cRect ViewPort,
const cRect DrawPort = cRect::Null 
)

Definition at line 1148 of file osd.c.

References data, cPixmap::DrawPort(), MALLOC, and panning.

cPixmapMemory::~cPixmapMemory ( )
virtual

Definition at line 1155 of file osd.c.

References data.

Member Function Documentation

void cPixmapMemory::Clear ( void  )
virtual

Clears the pixmap's draw port by setting all pixels to be fully transparent.

A derived class must call Lock()/Unlock().

Implements cPixmap.

Definition at line 1160 of file osd.c.

References data, cPixmap::DrawPort(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), and cPixmap::Unlock().

void cPixmapMemory::Copy ( const cPixmap Pixmap,
const cRect Source,
const cPoint Dest 
)
virtual

Copies the part of the given Pixmap covered by Source into this pixmap at location Dest.

The Source rectangle is relative to the given Pixmap's draw port. The data from Pixmap is copied as is, no alpha handling of any kind takes place.

Implements cPixmap.

Definition at line 1556 of file osd.c.

References data, cPixmap::DrawPort(), cRect::Height(), cRect::Intersected(), cRect::IsEmpty(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cRect::Point(), cRect::Shifted(), cRect::Top(), cPixmap::Unlock(), and cRect::Width().

Referenced by cPixmap::DrawPixmap().

const uint8_t* cPixmapMemory::Data ( void  )
inline

Definition at line 690 of file osd.h.

References cPalette::Color(), DrawEllipse(), DrawSlope(), Font, cRect::Null, and taDefault.

void cPixmapMemory::DrawBitmap ( const cPoint Point,
const cBitmap Bitmap,
tColor  ColorFg = 0,
tColor  ColorBg = 0,
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 Point.

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). If Overlay is true, any pixel in Bitmap that has color index 0 will not overwrite the corresponding pixel in the target area. This function is mainly for compatibility with skins or plugins that draw bitmaps onto the OSD.

Implements cPixmap.

Definition at line 1274 of file osd.c.

References cRect::Bottom(), cPalette::Color(), cBitmap::Data(), data, cPixmap::DrawPort(), cBitmap::Height(), cRect::Intersected(), cRect::IsEmpty(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cRect::Right(), cRect::Top(), cPixmap::Unlock(), cBitmap::Width(), cRect::Width(), cPoint::X(), and cPoint::Y().

Referenced by cOsd::DrawBitmap(), cOsd::DrawScaledBitmap(), and cOsd::RestoreRegion().

void cPixmapMemory::DrawEllipse ( const cRect Rect,
tColor  Color,
int  Quadrants = 0 
)
virtual

Draws a filled ellipse with the given Color that fits into the given rectangle.

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!

Implements cPixmap.

Definition at line 1377 of file osd.c.

References cRect::Bottom(), DrawRectangle(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), max(), cRect::Right(), cRect::Top(), and cPixmap::Unlock().

Referenced by cOsd::DrawEllipse().

void cPixmapMemory::DrawImage ( const cPoint Point,
const cImage Image 
)
virtual
void cPixmapMemory::DrawImage ( const cPoint Point,
int  ImageHandle 
)
virtual

Draws the image referenced by the given ImageHandle into this pixmap at the given Point.

ImageHandle must be a value that has previously been returned by a call to cOsdProvider::StoreImage(). If ImageHandle has an invalid value, nothing happens.

Implements cPixmap.

Definition at line 1252 of file osd.c.

References DrawImage(), cOsdProvider::GetImageData(), cPixmap::Lock(), and cPixmap::Unlock().

void cPixmapMemory::DrawPixel ( const cPoint Point,
tColor  Color 
)
virtual

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

If the alpha value of Color is not 0xFF (fully opaque), and this is the background pixmap (layer 0), the pixel is alpha blended with the existing color at the given position in this pixmap.

Implements cPixmap.

Definition at line 1260 of file osd.c.

References AlphaBlend(), data, cPixmap::DrawPort(), IS_OPAQUE, cPixmap::Layer(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cPixmap::Unlock(), cRect::Width(), cPoint::X(), and cPoint::Y().

Referenced by cOsd::DrawPixel().

void cPixmapMemory::DrawRectangle ( const cRect Rect,
tColor  Color 
)
virtual
void cPixmapMemory::DrawSlope ( const cRect Rect,
tColor  Color,
int  Type 
)
virtual

Draws a "slope" with the given Color into the given rectangle.

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

Implements cPixmap.

Definition at line 1479 of file osd.c.

References cRect::Bottom(), DrawRectangle(), cRect::Height(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cRect::Right(), cRect::Top(), cPixmap::Unlock(), and cRect::Width().

Referenced by cOsd::DrawSlope().

void cPixmapMemory::DrawText ( const cPoint Point,
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 Point 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.

Implements cPixmap.

Definition at line 1301 of file osd.c.

References clrTransparent, DrawRectangle(), cFont::DrawText(), cFont::Height(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), max(), taBorder, taBottom, taLeft, taRight, taTop, TEXT_ALIGN_BORDER, cPixmap::Unlock(), cFont::Width(), cPoint::X(), and cPoint::Y().

Referenced by cOsd::DrawText(), cTextScroller::Scroll(), and cTextScroller::Set().

void cPixmapMemory::Fill ( tColor  Color)
virtual

Fills the pixmap's draw port with the given Color.

A derived class must call Lock()/Unlock().

Implements cPixmap.

Definition at line 1168 of file osd.c.

References data, cPixmap::DrawPort(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), and cPixmap::Unlock().

Referenced by cOsd::RenderPixmaps().

void cPixmapMemory::Pan ( const cPoint Dest,
const cRect Source = cRect::Null 
)
virtual

Does the same as Scroll(), but also shifts the draw port accordingly, so that the view port doesn't get dirty if the scrolled rectangle covers the entire view port.

This may be of advantage if, e.g., there is a draw port that holds, say, 11 lines of text, while the view port displays only 10 lines. By Pan()'ing the draw port up one line, a new bottom line can be written into the draw port (without being seen through the view port), and later the draw port can be shifted smoothly, resulting in a smooth scrolling. It is the caller's responsibility to make sure that Source and Dest are given in such a way that the view port will not get dirty. No check is done whether this condition actually holds true.

Implements cPixmap.

Definition at line 1617 of file osd.c.

References cPixmap::Lock(), panning, Scroll(), and cPixmap::Unlock().

void cPixmapMemory::Render ( const cPixmap Pixmap,
const cRect Source,
const cPoint Dest 
)
virtual

Renders the part of the given Pixmap covered by Source into this pixmap at location Dest.

The Source rectangle is relative to the given Pixmap's draw port. The Pixmap's alpha value is to be used when rendering.

Implements cPixmap.

Definition at line 1521 of file osd.c.

References cPixmap::Alpha(), ALPHA_TRANSPARENT, AlphaBlend(), data, cPixmap::DrawPort(), cRect::Height(), cRect::Intersected(), cRect::IsEmpty(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cRect::Point(), cRect::Shifted(), cRect::Size(), cRect::Top(), cPixmap::Unlock(), and cRect::Width().

Referenced by cPixmap::DrawPixmap().

void cPixmapMemory::Scroll ( const cPoint Dest,
const cRect Source = cRect::Null 
)
virtual

Scrolls the data in the pixmap's draw port to the given Dest point.

If Source is given, only the data within that rectangle is scrolled. Source and Dest are relative to this pixmap's draw port.

Implements cPixmap.

Definition at line 1583 of file osd.c.

References data, cPixmap::DrawPort(), cRect::Height(), cRect::Intersected(), cRect::IsEmpty(), cRect::Left(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), panning, cRect::Point(), cPixmap::SetDrawPortPoint(), cRect::Shifted(), cRect::Top(), cPixmap::Unlock(), and cRect::Width().

Referenced by Pan().

Member Data Documentation

tColor* cPixmapMemory::data
private
bool cPixmapMemory::panning
private

Definition at line 685 of file osd.h.

Referenced by cPixmapMemory(), Pan(), and Scroll().


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