cBitmap Class Reference

#include <osd.h>

Inheritance diagram for cBitmap:

Inheritance graph
[legend]
Collaboration diagram for cBitmap:

Collaboration graph
[legend]

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 tIndexData (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.
void ReduceBpp (const cPalette &Palette)
void ShrinkBpp (int NewBpp)

Private Attributes

tIndexbitmap
int x0
int y0
int width
int height
int dirtyX1
int dirtyY1
int dirtyX2
int dirtyY2


Detailed Description

Definition at line 132 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).

Definition at line 158 of file osd.c.

References bitmap, SetSize(), x0, and y0.

Here is the call graph for this function:

cBitmap::cBitmap ( const char *  FileName  ) 

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

Definition at line 167 of file osd.c.

References bitmap, LoadXpm(), x0, and y0.

Here is the call graph for this function:

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

Creates a bitmap from the given XPM data.

Definition at line 175 of file osd.c.

References bitmap, SetXpm(), x0, and y0.

Here is the call graph for this function:

cBitmap::~cBitmap (  )  [virtual]

Definition at line 183 of file osd.c.

References bitmap.


Member Function Documentation

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

Definition at line 149 of file osd.h.

References x0.

Referenced by cDvbOsd::Flush(), cOsd::RestoreRegion(), and cOsd::SaveRegion().

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

Definition at line 150 of file osd.h.

References y0.

Referenced by cDvbOsd::Flush(), cOsd::RestoreRegion(), and cOsd::SaveRegion().

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

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

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.

Definition at line 188 of file osd.c.

References bitmap, dirtyX1, dirtyX2, dirtyY1, dirtyY2, esyslog, height, MALLOC, and width.

Referenced by cBitmap(), cDvbSubtitleConverter::ExtractSegment(), and SetXpm().

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

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

Definition at line 211 of file osd.c.

References height, width, x0, and y0.

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.

Definition at line 218 of file osd.c.

References height, width, x0, and y0.

Referenced by DrawBitmap(), and DrawRectangle().

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.

Definition at line 227 of file osd.c.

References height, width, x0, and y0.

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

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

Definition at line 236 of file osd.c.

References dirtyX1, dirtyX2, dirtyY1, and dirtyY2.

Referenced by cDvbOsd::Flush().

void cBitmap::Clean ( void   ) 

Marks the dirty area as clean.

Definition at line 248 of file osd.c.

References dirtyX1, dirtyX2, dirtyY1, dirtyY2, height, and width.

Referenced by cDvbOsd::Flush().

bool cBitmap::LoadXpm ( const char *  FileName  ) 

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

Definition at line 256 of file osd.c.

References esyslog, MALLOC, cReadLine::Read(), SetXpm(), and skipspace().

Referenced by cBitmap().

Here is the call graph for this function:

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.

Definition at line 322 of file osd.c.

References cPalette::color, esyslog, MAXNUMCOLORS, cPalette::SetBpp(), cPalette::SetColor(), SetIndex(), SetSize(), and skipspace().

Referenced by cBitmap(), and LoadXpm().

Here is the call graph for this function:

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.

Definition at line 394 of file osd.c.

References bitmap, dirtyX1, dirtyX2, dirtyY1, dirtyY2, height, and width.

Referenced by DrawBitmap(), cSubtitleObject::DrawLine(), DrawPixel(), DrawRectangle(), cFreetypeFont::DrawText(), cSubtitleRegion::FillRegion(), cDvbSpuBitmap::getBitmap(), and SetXpm().

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.

Definition at line 409 of file osd.c.

References height, cPalette::Index(), SetIndex(), width, x0, and y0.

Here is the call graph for this function:

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.

Definition at line 417 of file osd.c.

References bitmap, Covers(), height, Height(), Intersects(), cPalette::Replace(), cPalette::Reset(), SetIndex(), cPalette::Take(), width, Width(), x0, and y0.

Referenced by cDvbSubtitleConverter::FinishPage(), and cOsd::SaveRegion().

Here is the call graph for this function:

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.

Definition at line 446 of file osd.c.

References bitmap, clrTransparent, DrawRectangle(), cFont::DrawText(), cFont::Height(), Intersects(), taBottom, taLeft, taRight, taTop, cFont::Width(), x0, and y0.

Here is the call graph for this function:

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.

Definition at line 491 of file osd.c.

References bitmap, Covers(), height, cPalette::Index(), Intersects(), max(), min(), cPalette::Reset(), SetIndex(), width, x0, and y0.

Referenced by cSkinDisplayReplay::cProgressBar::cProgressBar(), DrawEllipse(), DrawSlope(), DrawText(), and cSkinDisplayReplay::cProgressBar::Mark().

Here is the call graph for this function:

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!

Definition at line 511 of file osd.c.

References DrawRectangle(), and Intersects().

Here is the call graph for this function:

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

Definition at line 603 of file osd.c.

References DrawRectangle(), and Intersects().

Here is the call graph for this function:

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

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

Definition at line 638 of file osd.c.

References bitmap, and width.

Referenced by cDvbOsd::Flush(), and GetColor().

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

Returns the color at the given coordinates.

Definition at line 236 of file osd.h.

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

Referenced by cFreetypeFont::DrawText().

Here is the call graph for this function:

void cBitmap::ReduceBpp ( const cPalette Palette  ) 

Reduces the color depth of the bitmap to that of the given Palette. If Palette's color depth is not smaller than the bitmap's current color depth, or if it is not one of 4bpp or 2bpp, nothing happens. After reducing the color depth the current palette is replaced with the given one.

Definition at line 643 of file osd.c.

References bitmap, cPalette::Bpp(), height, cPalette::Replace(), cPalette::SetBpp(), and width.

Referenced by cDvbSubtitleConverter::FinishPage().

Here is the call graph for this function:

void cBitmap::ShrinkBpp ( int  NewBpp  ) 

Shrinks the color depth of the bitmap to NewBpp by keeping only the 2^NewBpp most frequently used colors as defined in the current palette. If NewBpp is not smaller than the bitmap's current color depth, or if it is not one of 4bpp or 2bpp, nothing happens.

Definition at line 674 of file osd.c.

References bitmap, cPalette::Colors(), height, cPalette::Index(), MAXNUMCOLORS, cPalette::Replace(), cPalette::SetBpp(), cPalette::SetColor(), and width.

Referenced by cDvbSubtitleConverter::FinishPage().

Here is the call graph for this function:


Member Data Documentation

tIndex* cBitmap::bitmap [private]

int cBitmap::x0 [private]

Definition at line 135 of file osd.h.

Referenced by cBitmap(), Contains(), Covers(), DrawBitmap(), DrawPixel(), DrawRectangle(), DrawText(), Intersects(), and X0().

int cBitmap::y0 [private]

Definition at line 135 of file osd.h.

Referenced by cBitmap(), Contains(), Covers(), DrawBitmap(), DrawPixel(), DrawRectangle(), DrawText(), Intersects(), and Y0().

int cBitmap::width [private]

int cBitmap::height [private]

int cBitmap::dirtyX1 [private]

Definition at line 137 of file osd.h.

Referenced by Clean(), Dirty(), SetIndex(), and SetSize().

int cBitmap::dirtyY1 [private]

Definition at line 137 of file osd.h.

Referenced by Clean(), Dirty(), SetIndex(), and SetSize().

int cBitmap::dirtyX2 [private]

Definition at line 137 of file osd.h.

Referenced by Clean(), Dirty(), SetIndex(), and SetSize().

int cBitmap::dirtyY2 [private]

Definition at line 137 of file osd.h.

Referenced by Clean(), Dirty(), SetIndex(), and SetSize().


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

Generated on Tue Jan 13 14:27:11 2009 for VDR by  doxygen 1.5.6