vdr 2.7.2
|
#include <osd.h>
Public Member Functions | |
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 cRect & | ViewPort (void) const |
const cRect & | DrawPort (void) const |
const cRect & | DirtyViewPort (void) const |
const cRect & | DirtyDrawPort (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) |
virtual void | Clear (void)=0 |
virtual void | Fill (tColor Color)=0 |
virtual void | DrawImage (const cPoint &Point, const cImage &Image)=0 |
virtual void | DrawImage (const cPoint &Point, int ImageHandle)=0 |
virtual void | DrawScaledImage (const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias=false) |
virtual void | DrawScaledImage (const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias=false) |
virtual void | DrawPixel (const cPoint &Point, tColor Color)=0 |
virtual void | DrawBlendedPixel (const cPoint &Point, tColor Color, uint8_t AlphaLayer=ALPHA_OPAQUE) |
virtual void | DrawBitmap (const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool Overlay=false)=0 |
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 |
virtual void | DrawRectangle (const cRect &Rect, tColor Color)=0 |
virtual void | DrawEllipse (const cRect &Rect, tColor Color, int Quadrants=0)=0 |
virtual void | DrawSlope (const cRect &Rect, tColor Color, int Type)=0 |
virtual void | Render (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)=0 |
virtual void | Copy (const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest)=0 |
virtual void | Scroll (const cPoint &Dest, const cRect &Source=cRect::Null)=0 |
virtual void | Pan (const cPoint &Dest, const cRect &Source=cRect::Null)=0 |
Static Public Member Functions | |
static void | Lock (void) |
static void | Unlock (void) |
Protected Member Functions | |
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) |
Private Attributes | |
int | layer |
int | alpha |
bool | tile |
cRect | viewPort |
cRect | drawPort |
cRect | dirtyViewPort |
cRect | dirtyDrawPort |
Static Private Attributes | |
static cMutex | mutex |
Friends | |
class | cOsd |
class | cPixmapMutexLock |
cPixmap::cPixmap | ( | void | ) |
cPixmap::cPixmap | ( | int | Layer, |
const cRect & | ViewPort, | ||
const cRect & | DrawPort = cRect::Null ) |
Creates a pixmap in the given Layer.
When rendering the final OSD, pixmaps are handled in ascending order of their individual layer. This is important if pixmaps overlap each other. The one with the highest layer is rendered last. The actual value of Layer doesn't matter, it is only used for defining the rendering sequence. If Layer is less than zero, this pixmap will not be rendered into the final OSD (it can be activated by a later call to SetLayer()). The value 0 is reserved for the background pixmap and shall not be used otherwise (with the sole exception of temporarily using layer 0 to have a text with transparent background rendered with alpha blending into that pixmap; see also DrawPixel()). If there are several pixmaps with the same value of Layer, their rendering sequence within that layer is undefined. In order to allow devices that can handle only a limited number of layers, the Layer parameter must be less than 8 (MAXPIXMAPLAYERS). ViewPort defines the rectangle in which this pixmap will be rendered on the OSD. The coordinate (0, 0) corresponds to the upper left corner of the OSD. If no DrawPort is given, it defaults to the same size as the ViewPort, with its upper left corner set to (0, 0). The DrawPort's origin is relative to the ViewPort's origin. All drawing operations will be executed relative to the origin of the DrawPort rectangle, and will be clipped to the size of this rectangle. The DrawPort may have a different size than the ViewPort. If it is smaller than the ViewPort, the rest of the ViewPort is treated as fully transparent (unless this is a tiled pixmap, in which case the DrawPort is repeated horizontally and vertically to fill the entire ViewPort). If the DrawPort is larger than the ViewPort, only that portion of the DrawPort that intersects with the ViewPort will be visible on the OSD. The drawing area of a newly created cPixmap is not initialized and may contain random data. See cOsd::MaxPixmapSize() for information on the maximum size of pixmaps supported by the system.
Definition at line 969 of file osd.c.
References alpha, ALPHA_OPAQUE, DrawPort(), drawPort, esyslog, cRect::IsEmpty(), Layer(), layer, MAXPIXMAPLAYERS, cRect::SetPoint(), tile, ViewPort(), and viewPort.
|
inline |
Definition at line 542 of file osd.h.
References alpha.
Referenced by cPixmapMemory::DrawBlendedPixel(), cPixmapMemory::Render(), and SetAlpha().
|
pure virtual |
Clears the pixmap's draw port by setting all pixels to be fully transparent.
A derived class must call Lock()/Unlock().
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action(), cTrueColorDemo::CreateTextPixmap(), cOsd::RenderPixmaps(), and cOsd::SetAreas().
|
pure 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.
Implemented in cPixmapMemory.
Referenced by DrawPixmap().
|
inline |
Returns the "dirty" rectangle in the draw port of this this pixmap.
This is the surrounding rectangle around all pixels that have been modified since the last time this pixmap has been rendered to the OSD. The rectangle is relative to the draw port's origin. Since this function returns a reference to a data member, the caller must use Lock()/Unlock() to make sure the data doesn't change while it is used.
Definition at line 559 of file osd.h.
References dirtyDrawPort.
|
inline |
Returns the "dirty" rectangle this pixmap causes on the OSD.
This is the surrounding rectangle around all pixels that have been modified since the last time this pixmap has been rendered to the OSD. The rectangle is relative to the OSD's origin. Since this function returns a reference to a data member, the caller must use Lock()/Unlock() to make sure the data doesn't change while it is used.
Definition at line 552 of file osd.h.
References dirtyViewPort.
|
pure 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.
Implemented in cPixmapMemory.
|
inlinevirtual |
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 in cPixmapMemory.
Definition at line 632 of file osd.h.
References DrawPixel().
|
pure 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!
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action().
Draws the given Image into this pixmap at the given Point.
Implemented in cPixmapMemory.
|
pure 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.
Implemented in cPixmapMemory.
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.
Implemented in cPixmapMemory.
Referenced by DrawBlendedPixel(), and cFreetypeFont::DrawText().
Draws the Dirty part of the given Pixmap into this pixmap.
If the Pixmap's layer is 0, it is copied, otherwise it is rendered into this pixmap. This function is used only to implement the tile handling in the final rendering to the OSD.
Definition at line 1222 of file osd.c.
References cRect::Bottom(), Copy(), DrawPort(), cRect::Height(), cRect::Intersected(), cRect::IsEmpty(), Layer(), cRect::Left(), cRect::Point(), Render(), cRect::Right(), cRect::SetPoint(), cPoint::SetX(), cPoint::Shift(), cRect::Shift(), cPoint::Shifted(), cRect::Size(), Tile(), cRect::Top(), ViewPort(), cRect::Width(), cPoint::X(), and cPoint::Y().
Referenced by cOsd::RenderPixmaps().
|
inline |
Returns the pixmap's draw port, which is relative to the view port.
Since this function returns a reference to a data member, the caller must use Lock()/Unlock() to make sure the data doesn't change while it is used.
Definition at line 548 of file osd.h.
References drawPort.
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmap(), cPixmapMemory::cPixmapMemory(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawBlendedPixel(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), DrawPixmap(), cPixmapMemory::DrawRectangle(), cFreetypeFont::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Render(), cOsd::RenderPixmaps(), cOsd::RestoreRegion(), and cPixmapMemory::Scroll().
Draws a filled rectangle with the given Color.
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action().
|
inlinevirtual |
Reimplemented in cPixmapMemory.
|
inlinevirtual |
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 in cPixmapMemory.
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
Implemented in cPixmapMemory.
|
pure 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.
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action(), and cTrueColorDemo::CreateTextPixmap().
|
pure virtual |
Fills the pixmap's draw port with the given Color.
A derived class must call Lock()/Unlock().
Implemented in cPixmapMemory.
|
inline |
Definition at line 541 of file osd.h.
References layer.
Referenced by cPixmap(), cOsd::DestroyPixmap(), cPixmapMemory::DrawPixel(), DrawPixmap(), cTrueColorDemo::ProcessKey(), and SetLayer().
|
inlinestatic |
All public member functions of cPixmap set locks as necessary to make sure they are thread-safe (unless noted otherwise).
If several cPixmap member functions need to be called in a row, the caller must surround these calls with proper Lock()/Unlock() calls. See the LOCK_PIXMAPS macro for a convenient way of doing this.
Definition at line 534 of file osd.h.
References cMutex::Lock(), and mutex.
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawBlendedPixel(), cPixmapMemory::DrawEllipse(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), cPixmapMemory::DrawRectangle(), cPixmapMemory::DrawScaledImage(), cPixmapMemory::DrawScaledImage(), cPixmapMemory::DrawSlope(), cPixmapMemory::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Pan(), cPixmapMemory::Render(), cPixmapMemory::Scroll(), SetAlpha(), SetDrawPortPoint(), SetLayer(), SetTile(), and SetViewPort().
|
protected |
Marks the given point of the draw port of this pixmap as dirty.
Point is combined with the existing dirtyDrawPort rectangle. The coordinates of Point are relative to the pixmap's draw port. If Point is within the currently visible view port of this pixmap, MarkViewPortDirty() is called with the appropriate value.
Definition at line 1008 of file osd.c.
References cRect::Combine(), cRect::Contains(), dirtyDrawPort, drawPort, MarkViewPortDirty(), cRect::Point(), cPoint::Shifted(), tile, and viewPort.
|
protected |
Marks the given rectangle of the draw port of this pixmap as dirty.
Rect is combined with the existing dirtyDrawPort rectangle. The coordinates of Rect are relative to the pixmap's draw port. If Rect extends into the currently visible view port of this pixmap, MarkViewPortDirty() is called with the appropriate value.
Definition at line 999 of file osd.c.
References cRect::Combine(), dirtyDrawPort, drawPort, cRect::Intersected(), MarkViewPortDirty(), cRect::Point(), cRect::Shifted(), tile, and viewPort.
Referenced by cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawBlendedPixel(), cPixmapMemory::DrawEllipse(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), cPixmapMemory::DrawRectangle(), cPixmapMemory::DrawSlope(), cPixmapMemory::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Render(), and cPixmapMemory::Scroll().
|
protected |
Marks the given point of the view port of this pixmap as dirty.
Point is combined with the existing dirtyViewPort rectangle. The coordinates of Point are given in absolute OSD values.
Definition at line 993 of file osd.c.
References cRect::Combine(), cRect::Contains(), dirtyViewPort, layer, and viewPort.
|
protected |
Marks the given rectangle of the view port of this pixmap as dirty.
Rect is combined with the existing dirtyViewPort rectangle. The coordinates of Rect are given in absolute OSD values.
Definition at line 987 of file osd.c.
References cRect::Combine(), dirtyViewPort, cRect::Intersected(), layer, and viewPort.
Referenced by MarkDrawPortDirty(), MarkDrawPortDirty(), SetAlpha(), SetDrawPortPoint(), SetLayer(), SetTile(), and SetViewPort().
|
pure 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.
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action().
|
pure 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.
Implemented in cPixmapMemory.
Referenced by DrawPixmap(), and cOsd::RenderPixmaps().
|
pure 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.
Implemented in cPixmapMemory.
|
virtual |
Sets the alpha value of this pixmap to the given value.
Alpha is limited to the range 0 (fully transparent) to 255 (fully opaque). If a derived class reimplements this function, it needs to call the base class function.
Definition at line 1046 of file osd.c.
References Alpha(), alpha, ALPHA_OPAQUE, ALPHA_TRANSPARENT, constrain(), Lock(), MarkViewPortDirty(), Unlock(), and viewPort.
Referenced by cTrueColorDemo::Action(), and cTrueColorDemo::CreateTextPixmap().
|
protected |
Resets the "dirty" rectangles of this pixmap.
Definition at line 1019 of file osd.c.
References dirtyDrawPort, and dirtyViewPort.
|
virtual |
Sets the pixmap's draw port to the given Point.
Only the origin point of the draw port can be modified, its size is fixed. By default, setting a new draw port point results in marking the relevant part of the view port as "dirty". If Dirty is set to false, the view port will not be marked as dirty. This is mainly used to implement the Pan() function. If a derived class reimplements this function, it needs to call the base class function.
Definition at line 1085 of file osd.c.
References drawPort, Lock(), MarkViewPortDirty(), cRect::Point(), cRect::SetPoint(), cRect::Shifted(), tile, Unlock(), and viewPort.
Referenced by cTrueColorDemo::Action(), and cPixmapMemory::Scroll().
|
virtual |
Sets the layer of this pixmap to the given value.
If the new layer is greater than zero, the pixmap will be visible. If it is less than zero, it will be invisible. A value of 0 will be silently ignored. If a derived class reimplements this function, it needs to call the base class function.
Definition at line 1024 of file osd.c.
References esyslog, Layer(), layer, Lock(), MarkViewPortDirty(), MAXPIXMAPLAYERS, Unlock(), and viewPort.
Referenced by cTrueColorDemo::Action(), and cTrueColorDemo::ProcessKey().
|
virtual |
Sets the tile property of this pixmap to the given value.
If Tile is true, the pixmaps data will be repeated horizontally and vertically if necessary to fill the entire view port. If a derived class reimplements this function, it needs to call the base class function.
Definition at line 1057 of file osd.c.
References drawPort, cRect::Height(), Lock(), MarkViewPortDirty(), cRect::Point(), Tile(), tile, Unlock(), viewPort, and cRect::Width().
Referenced by cTrueColorDemo::Action().
|
virtual |
Sets the pixmap's view port to the given Rect.
If a derived class reimplements this function, it needs to call the base class function.
Definition at line 1068 of file osd.c.
References drawPort, Lock(), MarkViewPortDirty(), cRect::Point(), cRect::Shifted(), tile, Unlock(), and viewPort.
Referenced by cTrueColorDemo::Action().
|
inline |
|
inlinestatic |
Definition at line 540 of file osd.h.
References mutex, and cMutex::Unlock().
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawBlendedPixel(), cPixmapMemory::DrawEllipse(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), cPixmapMemory::DrawRectangle(), cPixmapMemory::DrawScaledImage(), cPixmapMemory::DrawScaledImage(), cPixmapMemory::DrawSlope(), cPixmapMemory::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Pan(), cPixmapMemory::Render(), cPixmapMemory::Scroll(), SetAlpha(), SetDrawPortPoint(), SetLayer(), SetTile(), and SetViewPort().
|
inline |
Returns the pixmap's view port, which is relative to the OSD's origin.
Since this function returns a reference to a data member, the caller must use Lock()/Unlock() to make sure the data doesn't change while it is used.
Definition at line 544 of file osd.h.
References viewPort.
Referenced by cTrueColorDemo::Action(), cPixmap(), cOsd::DestroyPixmap(), DrawPixmap(), cOsd::RenderPixmaps(), and cOsd::RestoreRegion().
|
friend |
|
private |
|
private |
Definition at line 470 of file osd.h.
Referenced by DirtyDrawPort(), MarkDrawPortDirty(), MarkDrawPortDirty(), and SetClean().
|
private |
Definition at line 469 of file osd.h.
Referenced by DirtyViewPort(), MarkViewPortDirty(), MarkViewPortDirty(), and SetClean().
|
private |
Definition at line 468 of file osd.h.
Referenced by cPixmap(), DrawPort(), MarkDrawPortDirty(), MarkDrawPortDirty(), SetDrawPortPoint(), SetTile(), and SetViewPort().
|
private |
Definition at line 464 of file osd.h.
Referenced by cPixmap(), cPixmap(), Layer(), MarkViewPortDirty(), MarkViewPortDirty(), and SetLayer().
|
staticprivate |
|
private |
Definition at line 466 of file osd.h.
Referenced by cPixmap(), cPixmap(), MarkDrawPortDirty(), MarkDrawPortDirty(), SetDrawPortPoint(), SetTile(), SetViewPort(), and Tile().
|
private |
Definition at line 467 of file osd.h.
Referenced by cPixmap(), MarkDrawPortDirty(), MarkDrawPortDirty(), MarkViewPortDirty(), MarkViewPortDirty(), SetAlpha(), SetDrawPortPoint(), SetLayer(), SetTile(), SetViewPort(), and ViewPort().