vdr
2.2.0
|
#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 | DrawPixel (const cPoint &Point, tColor Color)=0 |
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 |
|
inlineprotectedvirtual |
Definition at line 467 of file osd.h.
References cRect::Null.
cPixmap::cPixmap | ( | void | ) |
Definition at line 960 of file osd.c.
References ALPHA_OPAQUE.
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. If no DrawPort is given, it defaults to the same size as the ViewPort, with its upper left corner set to (0, 0). 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.
Definition at line 967 of file osd.c.
References ALPHA_OPAQUE, esyslog, cRect::IsEmpty(), MAXPIXMAPLAYERS, and cRect::SetPoint().
|
inline |
Definition at line 533 of file osd.h.
Referenced by cPixmapMemory::Render().
|
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.
|
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 550 of file osd.h.
References cPalette::Color(), DrawEllipse(), DrawSlope(), Font, cRect::Null, and taDefault.
|
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.
|
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.
|
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.
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 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 1177 of file osd.c.
References cRect::Bottom(), cPixmapMemory::Copy(), DrawPort(), cRect::Height(), cRect::Intersected(), cRect::IsEmpty(), Layer(), cRect::Left(), cRect::Point(), cPixmapMemory::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 539 of file osd.h.
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::cPixmapMemory(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), DrawPixmap(), cPixmapMemory::DrawRectangle(), cFreetypeFont::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Render(), cOsd::RenderPixmaps(), and cPixmapMemory::Scroll().
Draws a filled rectangle with the given Color.
Implemented in cPixmapMemory.
Referenced by cTrueColorDemo::Action().
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 532 of file osd.h.
Referenced by cOsd::DestroyPixmap(), cPixmapMemory::DrawPixel(), DrawPixmap(), and cOsd::RenderPixmaps().
|
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 525 of file osd.h.
References cMutex::Lock().
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawEllipse(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), cPixmapMemory::DrawRectangle(), cPixmapMemory::DrawSlope(), cPixmapMemory::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Pan(), cPixmapMemory::Render(), and cPixmapMemory::Scroll().
|
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 997 of file osd.c.
References cRect::Intersected(), and cRect::Shifted().
Referenced by cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), 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 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 1006 of file osd.c.
References cPoint::Shifted().
|
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 985 of file osd.c.
References cRect::Intersected().
Referenced by cOsd::DestroyPixmap().
|
protected |
|
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 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 1044 of file osd.c.
References ALPHA_OPAQUE, ALPHA_TRANSPARENT, and constrain().
Referenced by cTrueColorDemo::Action(), and cTrueColorDemo::CreateTextPixmap().
|
protected |
|
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 1083 of file osd.c.
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 1022 of file osd.c.
References esyslog, and MAXPIXMAPLAYERS.
Referenced by cTrueColorDemo::Action().
|
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 1055 of file osd.c.
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 1066 of file osd.c.
Referenced by cTrueColorDemo::Action().
|
inline |
Definition at line 534 of file osd.h.
Referenced by DrawPixmap().
|
inlinestatic |
Definition at line 531 of file osd.h.
References cMutex::Unlock().
Referenced by cTrueColorDemo::Action(), cPixmapMemory::Clear(), cPixmapMemory::Copy(), cPixmapMemory::DrawBitmap(), cPixmapMemory::DrawEllipse(), cPixmapMemory::DrawImage(), cPixmapMemory::DrawPixel(), cPixmapMemory::DrawRectangle(), cPixmapMemory::DrawSlope(), cPixmapMemory::DrawText(), cPixmapMemory::Fill(), cPixmapMemory::Pan(), cPixmapMemory::Render(), and cPixmapMemory::Scroll().
|
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 535 of file osd.h.
Referenced by cTrueColorDemo::Action(), cOsd::DestroyPixmap(), DrawPixmap(), and cOsd::RenderPixmaps().
|
friend |
Definition at line 455 of file osd.h.
Referenced by cOsdProvider::NewOsd().
|
friend |
|
staticprivate |
Definition at line 458 of file osd.h.
Referenced by cRect::Combine(), cOsd::cOsd(), and cOsd::~cOsd().