vdr 2.7.5
cPixmapMemory Class Reference

#include <osd.h>

Public Member Functions

 cPixmapMemory (void)
 cPixmapMemory (int Layer, const cRect &ViewPort, const cRect &DrawPort=cRect::Null)
virtual ~cPixmapMemory () override
const uint8_t * Data (void)
virtual void Clear (void) override
virtual void Fill (tColor Color) override
virtual void DrawImage (const cPoint &Point, const cImage &Image) override
virtual void DrawImage (const cPoint &Point, int ImageHandle) override
virtual void DrawScaledImage (const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias=false) override
virtual void DrawScaledImage (const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias=false) override
virtual void DrawPixel (const cPoint &Point, tColor Color) override
virtual void DrawBlendedPixel (const cPoint &Point, tColor Color, uint8_t AlphaLayer=ALPHA_OPAQUE) override
virtual void DrawBitmap (const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false) override
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) override
virtual void DrawRectangle (const cRect &Rect, tColor Color) override
virtual void DrawEllipse (const cRect &Rect, tColor Color, int Quadrants=0) override
virtual void DrawSlope (const cRect &Rect, tColor Color, int Type) override
virtual void Render (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) override
virtual void Copy (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) override
virtual void Scroll (const cPoint &Dest, const cRect &Source=cRect::Null) override
virtual void Pan (const cPoint &Dest, const cRect &Source=cRect::Null) override
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 712 of file osd.h.

Constructor & Destructor Documentation

◆ cPixmapMemory() [1/2]

cPixmapMemory::cPixmapMemory ( void )

Definition at line 1187 of file osd.c.

References data, and panning.

Referenced by Copy(), and Render().

◆ cPixmapMemory() [2/2]

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

◆ ~cPixmapMemory()

cPixmapMemory::~cPixmapMemory ( )
overridevirtual

Definition at line 1200 of file osd.c.

References data.

Member Function Documentation

◆ Clear()

void cPixmapMemory::Clear ( void )
overridevirtual

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 1205 of file osd.c.

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

◆ Copy()

void cPixmapMemory::Copy ( const cPixmap * Pixmap,
const cRect & Source,
const cPoint & Dest )
overridevirtual

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 1819 of file osd.c.

References cPixmap::cPixmap(), cPixmapMemory(), 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().

◆ Data()

const uint8_t * cPixmapMemory::Data ( void )
inline

Definition at line 720 of file osd.h.

References data.

◆ DrawBitmap()

void cPixmapMemory::DrawBitmap ( const cPoint & Point,
const cBitmap & Bitmap,
tColor ColorFg = 0,
tColor ColorBg = 0,
bool Overlay = false )
overridevirtual

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 1357 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().

◆ DrawBlendedPixel()

void cPixmapMemory::DrawBlendedPixel ( const cPoint & Point,
tColor Color,
uint8_t AlphaLayer = ALPHA_OPAQUE )
overridevirtual

Like DrawPixel(), but with an additional AlphaLayer, and works on any pixmap, not only the background.

The default implementation just calls DrawPixel(), ignoring AlphaLayer.

Reimplemented from cPixmap.

Definition at line 1339 of file osd.c.

References cPixmap::Alpha(), ALPHA_OPAQUE, AlphaBlend(), clrTransparent, data, cPixmap::DrawPort(), cPixmap::Lock(), cPixmap::MarkDrawPortDirty(), cPixmap::Unlock(), cRect::Width(), cPoint::X(), and cPoint::Y().

Referenced by DrawEllipse(), and DrawSlope().

◆ DrawEllipse()

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

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 1460 of file osd.c.

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

◆ DrawImage() [1/2]

void cPixmapMemory::DrawImage ( const cPoint & Point,
const cImage & Image )
overridevirtual

◆ DrawImage() [2/2]

void cPixmapMemory::DrawImage ( const cPoint & Point,
int ImageHandle )
overridevirtual

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 1297 of file osd.c.

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

◆ DrawPixel()

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

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

ImageHandle must be a value that has previously been returned by a call to cOsdProvider::StoreImage(). If ImageHandle has an invalid value, nothing happens. If AntiAlias is true and either of the factors is greater than 1.0, anti-aliasing is applied. This function should be 'pure', just like all the others. However, since it was introduced when this class was already in widespread use, the default was made empty, so that existing code will still compile. 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 1325 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().

◆ DrawRectangle()

void cPixmapMemory::DrawRectangle ( const cRect & Rect,
tColor Color )
overridevirtual

Draws a filled rectangle with the given Color.

Implements cPixmap.

Definition at line 1433 of file osd.c.

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

Referenced by DrawEllipse(), DrawSlope(), and DrawText().

◆ DrawScaledImage() [1/2]

void cPixmapMemory::DrawScaledImage ( const cPoint & Point,
const cImage & Image,
double FactorX,
double FactorY,
bool AntiAlias = false )
overridevirtual

Reimplemented from cPixmap.

Definition at line 1305 of file osd.c.

References DoubleEqual(), DrawImage(), cPixmap::Lock(), cImage::Scaled(), and cPixmap::Unlock().

Referenced by DrawScaledImage().

◆ DrawScaledImage() [2/2]

void cPixmapMemory::DrawScaledImage ( const cPoint & Point,
int ImageHandle,
double FactorX,
double FactorY,
bool AntiAlias = false )
overridevirtual

Draws the given Image into this pixmap at the given Point and scales it.

If AntiAlias is true and either of the factors is greater than 1.0, anti-aliasing is applied. This function should be 'pure', just like all the others. However, since it was introduced when this class was already in widespread use, the default was made empty, so that existing code will still compile.

Reimplemented from cPixmap.

Definition at line 1317 of file osd.c.

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

◆ DrawSlope()

void cPixmapMemory::DrawSlope ( const cRect & Rect,
tColor Color,
int Type )
overridevirtual

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 1684 of file osd.c.

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

◆ DrawText()

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 )
overridevirtual

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 1384 of file osd.c.

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

◆ Fill()

void cPixmapMemory::Fill ( tColor Color)
overridevirtual

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

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

Implements cPixmap.

Definition at line 1213 of file osd.c.

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

Referenced by cOsd::RenderPixmaps().

◆ Pan()

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

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 1880 of file osd.c.

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

◆ Render()

void cPixmapMemory::Render ( const cPixmap * Pixmap,
const cRect & Source,
const cPoint & Dest )
overridevirtual

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 1784 of file osd.c.

References cPixmap::Alpha(), ALPHA_TRANSPARENT, AlphaBlend(), cPixmap::cPixmap(), cPixmapMemory(), 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().

◆ Scroll()

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

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 1846 of file osd.c.

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

Referenced by Pan().

Member Data Documentation

◆ data

◆ panning

bool cPixmapMemory::panning
private

Definition at line 715 of file osd.h.

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


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