SASC
DVBSoftCAM

cBitmap Class Reference

#include <osd.h>

Inheritance diagram for cBitmap:

List of all members.

Public Member Functions

 cBitmap (int Width, int Height, int Bpp, int X0=0, int Y0=0)
 cBitmap (const char *FileName)
 Creates a bitmap and loads an XPM image from the given file.
 cBitmap (const char *const Xpm[])
 Creates a bitmap from the given XPM data.
virtual ~cBitmap ()
int X0 (void) const
int Y0 (void) const
int Width (void) const
int Height (void) const
void SetSize (int Width, int Height)
bool Contains (int x, int y) const
 Returns true if this bitmap contains the point (x, y).
bool Covers (int x1, int y1, int x2, int y2) const
bool Intersects (int x1, int y1, int x2, int y2) const
bool Dirty (int &x1, int &y1, int &x2, int &y2)
void Clean (void)
 Marks the dirty area as clean.
bool LoadXpm (const char *FileName)
bool SetXpm (const char *const Xpm[], bool IgnoreNone=false)
void SetIndex (int x, int y, tIndex Index)
void DrawPixel (int x, int y, tColor Color)
void DrawBitmap (int x, int y, const cBitmap &Bitmap, tColor ColorFg=0, tColor ColorBg=0, bool ReplacePalette=false, bool Overlay=false)
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)
void DrawRectangle (int x1, int y1, int x2, int y2, tColor Color)
void DrawEllipse (int x1, int y1, int x2, int y2, tColor Color, int Quadrants=0)
void DrawSlope (int x1, int y1, int x2, int y2, tColor Color, int Type)
const tIndex * Data (int x, int y)
 Returns the address of the index byte at the given coordinates.
tColor GetColor (int x, int y)
 Returns the color at the given coordinates.

Detailed Description

Definition at line 128 of file osd.h.


Constructor & Destructor Documentation

cBitmap::cBitmap ( int  Width,
int  Height,
int  Bpp,
int  X0 = 0,
int  Y0 = 0 
)

Creates a bitmap with the given Width, Height and color depth (Bpp). X0 and Y0 define the offset at which this bitmap will be located on the OSD. All coordinates given in the other functions will be relative to this offset (unless specified otherwise).

cBitmap::cBitmap ( const char *  FileName)

Creates a bitmap and loads an XPM image from the given file.

cBitmap::cBitmap ( const char *const  Xpm[])

Creates a bitmap from the given XPM data.

virtual cBitmap::~cBitmap ( ) [virtual]

Member Function Documentation

void cBitmap::Clean ( void  )

Marks the dirty area as clean.

bool cBitmap::Contains ( int  x,
int  y 
) const

Returns true if this bitmap contains the point (x, y).

bool cBitmap::Covers ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Returns true if the rectangle defined by the given coordinates completely covers this bitmap.

const tIndex* cBitmap::Data ( int  x,
int  y 
)

Returns the address of the index byte at the given coordinates.

Referenced by GetColor().

bool cBitmap::Dirty ( int &  x1,
int &  y1,
int &  x2,
int &  y2 
)

Tells whether there is a dirty area and returns the bounding rectangle of that area (relative to the bitmaps origin).

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

Sets the pixels in this bitmap 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.

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

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..-8 draws the inverted part of the given quadrant(s) If Quadrants is not 0, the coordinates are those of the actual area, not the full circle!

void cBitmap::DrawPixel ( int  x,
int  y,
tColor  Color 
)

Sets the pixel at the given coordinates to the given Color, which is a full 32 bit ARGB value. If the coordinates are outside the bitmap area, no pixel will be set.

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

Draws a filled rectangle defined by the upper left (x1, y1) and lower right (x2, y2) corners with the given Color. If the rectangle covers the entire bitmap area, the color palette will be reset, so that new colors can be used for drawing.

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

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

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

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.

tColor cBitmap::GetColor ( int  x,
int  y 
) [inline]

Returns the color at the given coordinates.

Definition at line 232 of file osd.h.

References cPalette::Color(), and Data().

int cBitmap::Height ( void  ) const [inline]

Definition at line 148 of file osd.h.

{ return height; }
bool cBitmap::Intersects ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Returns true if the rectangle defined by the given coordinates intersects with this bitmap.

bool cBitmap::LoadXpm ( const char *  FileName)

Calls SetXpm() with the data from the file FileName. Returns true if the operation was successful.

void cBitmap::SetIndex ( int  x,
int  y,
tIndex  Index 
)

Sets the index at the given coordinates to Index. Coordinates are relative to the bitmap's origin.

void cBitmap::SetSize ( int  Width,
int  Height 
)

Sets the size of this bitmap to the given values. Any previous contents of the bitmap will be lost. If Width and Height are the same as the current values, nothing will happen and the bitmap remains unchanged.

bool cBitmap::SetXpm ( const char *const  Xpm[],
bool  IgnoreNone = false 
)

Sets this bitmap to the given XPM data. Any previous bitmap or palette data will be overwritten with the new data. If IgnoreNone is true, a "none" color entry will be ignored. Only set IgnoreNone to true if you know that there is a "none" color entry in the XPM data and that this entry is not used! If SetXpm() is called with IgnoreNone set to false and the XPM data contains an unused "none" entry, it will be automatically called again with IgnoreNone set to true. Returns true if the operation was successful.

int cBitmap::Width ( void  ) const [inline]

Definition at line 147 of file osd.h.

Referenced by cSkinDisplayReplay::cProgressBar::Pos().

{ return width; }
int cBitmap::X0 ( void  ) const [inline]

Definition at line 145 of file osd.h.

{ return x0; }
int cBitmap::Y0 ( void  ) const [inline]

Definition at line 146 of file osd.h.

{ return y0; }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines