mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Implemented palette replace mode in the OSD bitmaps
This commit is contained in:
parent
121678e0ba
commit
d68b0a87ae
@ -1080,6 +1080,7 @@ Andreas Regel <andreas.regel@gmx.de>
|
|||||||
cSkins::Message()
|
cSkins::Message()
|
||||||
for reporting a problem in handling Transfer Mode for radio channels
|
for reporting a problem in handling Transfer Mode for radio channels
|
||||||
for reporting a problem with messages when a cOsdObject uses the raw OSD
|
for reporting a problem with messages when a cOsdObject uses the raw OSD
|
||||||
|
for implementing palette replace mode in the OSD bitmaps
|
||||||
|
|
||||||
Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>
|
Thomas Bergwinkl <Thomas.Bergwinkl@t-online.de>
|
||||||
for fixing the validity check for channel IDs, because some providers use TIDs
|
for fixing the validity check for channel IDs, because some providers use TIDs
|
||||||
|
3
HISTORY
3
HISTORY
@ -3630,3 +3630,6 @@ Video Disk Recorder Revision History
|
|||||||
//#define TEST_cVideoRepacker
|
//#define TEST_cVideoRepacker
|
||||||
|
|
||||||
in remux.c.
|
in remux.c.
|
||||||
|
- When drawing a bitmap to the OSD, the existing palette of the target can now be
|
||||||
|
replaced with the new one instead of adding the new entries (thanks to Andreas
|
||||||
|
Regel).
|
||||||
|
24
osd.c
24
osd.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: osd.c 1.61 2005/06/11 14:31:36 kls Exp $
|
* $Id: osd.c 1.62 2005/06/19 10:43:04 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
@ -86,6 +86,13 @@ void cPalette::Take(const cPalette &Palette, tIndexes *Indexes, tColor ColorFg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cPalette::Replace(const cPalette &Palette)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Palette.numColors; i++)
|
||||||
|
SetColor(i, Palette.color[i]);
|
||||||
|
numColors = Palette.numColors;
|
||||||
|
}
|
||||||
|
|
||||||
// --- cBitmap ---------------------------------------------------------------
|
// --- cBitmap ---------------------------------------------------------------
|
||||||
|
|
||||||
cBitmap::cBitmap(int Width, int Height, int Bpp, int X0, int Y0)
|
cBitmap::cBitmap(int Width, int Height, int Bpp, int X0, int Y0)
|
||||||
@ -337,13 +344,21 @@ void cBitmap::DrawPixel(int x, int y, tColor Color)
|
|||||||
SetIndex(x, y, Index(Color));
|
SetIndex(x, y, Index(Color));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg)
|
void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette)
|
||||||
{
|
{
|
||||||
if (bitmap && Bitmap.bitmap && Intersects(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) {
|
if (bitmap && Bitmap.bitmap && Intersects(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1)) {
|
||||||
if (Covers(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1))
|
if (Covers(x, y, x + Bitmap.Width() - 1, y + Bitmap.Height() - 1))
|
||||||
Reset();
|
Reset();
|
||||||
x -= x0;
|
x -= x0;
|
||||||
y -= y0;
|
y -= y0;
|
||||||
|
if (ReplacePalette && Covers(x + x0, y + y0, x + x0 + Bitmap.Width() - 1, y + y0 + Bitmap.Height() - 1)) {
|
||||||
|
Replace(Bitmap);
|
||||||
|
for (int ix = 0; ix < Bitmap.width; ix++) {
|
||||||
|
for (int iy = 0; iy < Bitmap.height; iy++)
|
||||||
|
SetIndex(x + ix, y + iy, Bitmap.bitmap[Bitmap.width * iy + ix]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
tIndexes Indexes;
|
tIndexes Indexes;
|
||||||
Take(Bitmap, &Indexes, ColorFg, ColorBg);
|
Take(Bitmap, &Indexes, ColorFg, ColorBg);
|
||||||
for (int ix = 0; ix < Bitmap.width; ix++) {
|
for (int ix = 0; ix < Bitmap.width; ix++) {
|
||||||
@ -352,6 +367,7 @@ void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
|
void cBitmap::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
|
||||||
{
|
{
|
||||||
@ -665,10 +681,10 @@ void cOsd::DrawPixel(int x, int y, tColor Color)
|
|||||||
bitmaps[i]->DrawPixel(x, y, Color);
|
bitmaps[i]->DrawPixel(x, y, Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg)
|
void cOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numBitmaps; i++)
|
for (int i = 0; i < numBitmaps; i++)
|
||||||
bitmaps[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg);
|
bitmaps[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg, ReplacePalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
|
void cOsd::DrawText(int x, int y, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font, int Width, int Height, int Alignment)
|
||||||
|
9
osd.h
9
osd.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: osd.h 1.48 2005/05/14 11:15:55 kls Exp $
|
* $Id: osd.h 1.49 2005/06/19 10:35:25 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OSD_H
|
#ifndef __OSD_H
|
||||||
@ -84,6 +84,9 @@ public:
|
|||||||
///< palette. If either of ColorFg or ColorBg is not zero, the first color
|
///< palette. If either of ColorFg or ColorBg is not zero, the first color
|
||||||
///< in Palette will be taken as ColorBg, and the second color will become
|
///< in Palette will be taken as ColorBg, and the second color will become
|
||||||
///< ColorFg.
|
///< ColorFg.
|
||||||
|
void Replace(const cPalette &Palette);
|
||||||
|
///< Replaces the colors of this palette with the colors from the given
|
||||||
|
///< palette.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eTextAlignment { taCenter = 0x00,
|
enum eTextAlignment { taCenter = 0x00,
|
||||||
@ -153,7 +156,7 @@ public:
|
|||||||
///< Sets the pixel at the given coordinates to the given Color, which is
|
///< Sets the pixel at the given coordinates to the given Color, which is
|
||||||
///< a full 32 bit ARGB value.
|
///< a full 32 bit ARGB value.
|
||||||
///< If the coordinates are outside the bitmap area, no pixel will be set.
|
///< If the coordinates are outside the bitmap area, no pixel will be set.
|
||||||
void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0);
|
void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false);
|
||||||
///< Sets the pixels in this bitmap with the data from the given
|
///< Sets the pixels in this bitmap with the data from the given
|
||||||
///< Bitmap, putting the upper left corner of the Bitmap at (x, y).
|
///< 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
|
///< If ColorFg or ColorBg is given, the first palette entry of the Bitmap
|
||||||
@ -274,7 +277,7 @@ public:
|
|||||||
///< If the OSD area has been divided into separate sub-areas, and the
|
///< If the OSD area has been divided into separate sub-areas, and the
|
||||||
///< given coordinates don't fall into any of these sub-areas, no pixel will
|
///< given coordinates don't fall into any of these sub-areas, no pixel will
|
||||||
///< be set.
|
///< be set.
|
||||||
virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0);
|
virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false);
|
||||||
///< Sets the pixels in the OSD with the data from the given
|
///< Sets the pixels in the OSD with the data from the given
|
||||||
///< Bitmap, putting the upper left corner of the Bitmap at (x, y).
|
///< 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
|
///< If ColorFg or ColorBg is given, the first palette entry of the Bitmap
|
||||||
|
Loading…
Reference in New Issue
Block a user