mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
The DrawBitmap() function now has a new parameter 'Overlay' that allows a bitmap to be drawn with a transparent background
This commit is contained in:
parent
c3f5c97ead
commit
3cd87d3c47
@ -1748,6 +1748,8 @@ Jaroslaw Swierczynski <swiergot@gmail.com>
|
|||||||
Alexander Hans <cleditor@arcor.de>
|
Alexander Hans <cleditor@arcor.de>
|
||||||
for reporting a crash when pressing '0' in the "Schedule" menu on a channel that
|
for reporting a crash when pressing '0' in the "Schedule" menu on a channel that
|
||||||
doesn't have any EPG data
|
doesn't have any EPG data
|
||||||
|
for giving the DrawBitmap() function a new parameter 'Overlay' that allows a bitmap
|
||||||
|
to be drawn with a transparent background
|
||||||
|
|
||||||
Daniel Karsubka <dkar@gmx.de>
|
Daniel Karsubka <dkar@gmx.de>
|
||||||
for suggesting to write the epg.data file when VDR exits
|
for suggesting to write the epg.data file when VDR exits
|
||||||
|
2
HISTORY
2
HISTORY
@ -4410,3 +4410,5 @@ Video Disk Recorder Revision History
|
|||||||
- The 'event id' in EPG data has been extended to 32 bit, so that external tools
|
- The 'event id' in EPG data has been extended to 32 bit, so that external tools
|
||||||
can generate ids that don't collide with those from the DVB data stream
|
can generate ids that don't collide with those from the DVB data stream
|
||||||
(suggested by Matthias Schniedermeyer).
|
(suggested by Matthias Schniedermeyer).
|
||||||
|
- The DrawBitmap() function now has a new parameter 'Overlay' that allows a bitmap
|
||||||
|
to be drawn with a transparent background (thanks to Alexander Hans).
|
||||||
|
16
osd.c
16
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.66 2006/02/05 13:46:37 kls Exp $
|
* $Id: osd.c 1.67 2006/02/26 14:31:31 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
@ -344,7 +344,7 @@ 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, bool ReplacePalette)
|
void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette, bool Overlay)
|
||||||
{
|
{
|
||||||
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))
|
||||||
@ -354,20 +354,24 @@ void cBitmap::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tC
|
|||||||
if (ReplacePalette && Covers(x + x0, y + y0, x + x0 + Bitmap.Width() - 1, y + y0 + Bitmap.Height() - 1)) {
|
if (ReplacePalette && Covers(x + x0, y + y0, x + x0 + Bitmap.Width() - 1, y + y0 + Bitmap.Height() - 1)) {
|
||||||
Replace(Bitmap);
|
Replace(Bitmap);
|
||||||
for (int ix = 0; ix < Bitmap.width; ix++) {
|
for (int ix = 0; ix < Bitmap.width; ix++) {
|
||||||
for (int iy = 0; iy < Bitmap.height; iy++)
|
for (int iy = 0; iy < Bitmap.height; iy++) {
|
||||||
|
if (!Overlay || Bitmap.bitmap[Bitmap.width * iy + ix] != 0)
|
||||||
SetIndex(x + ix, y + iy, Bitmap.bitmap[Bitmap.width * iy + ix]);
|
SetIndex(x + ix, y + iy, Bitmap.bitmap[Bitmap.width * iy + ix]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
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++) {
|
||||||
for (int iy = 0; iy < Bitmap.height; iy++)
|
for (int iy = 0; iy < Bitmap.height; iy++) {
|
||||||
|
if (!Overlay || Bitmap.bitmap[Bitmap.width * iy + ix] != 0)
|
||||||
SetIndex(x + ix, y + iy, Indexes[int(Bitmap.bitmap[Bitmap.width * iy + ix])]);
|
SetIndex(x + ix, y + iy, Indexes[int(Bitmap.bitmap[Bitmap.width * iy + ix])]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -683,10 +687,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, bool ReplacePalette)
|
void cOsd::DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool ReplacePalette, bool Overlay)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < numBitmaps; i++)
|
for (int i = 0; i < numBitmaps; i++)
|
||||||
bitmaps[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg, ReplacePalette);
|
bitmaps[i]->DrawBitmap(x, y, Bitmap, ColorFg, ColorBg, ReplacePalette, Overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
10
osd.h
10
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.51 2006/02/05 13:46:37 kls Exp $
|
* $Id: osd.h 1.52 2006/02/26 14:35:19 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OSD_H
|
#ifndef __OSD_H
|
||||||
@ -157,13 +157,15 @@ 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, bool ReplacePalette = false);
|
void 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
|
///< 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
|
||||||
///< will be mapped to ColorBg and the second palette entry will be mapped to
|
///< 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
|
///< ColorFg (palette indexes are defined so that 0 is the background and
|
||||||
///< 1 is the foreground color).
|
///< 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.
|
||||||
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 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
|
///< 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
|
///< and background color and font. If Width and Height are given, the text
|
||||||
@ -278,13 +280,15 @@ 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, bool ReplacePalette = false);
|
virtual void DrawBitmap(int x, int y, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool ReplacePalette = false, bool Overlay = 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
|
||||||
///< will be mapped to ColorBg and the second palette entry will be mapped to
|
///< 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
|
///< ColorFg (palette indexes are defined so that 0 is the background and
|
||||||
///< 1 is the foreground color).
|
///< 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.
|
||||||
virtual 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);
|
virtual 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);
|
||||||
///< Draws the given string at coordinates (x, y) with the given foreground
|
///< 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
|
///< and background color and font. If Width and Height are given, the text
|
||||||
|
Loading…
Reference in New Issue
Block a user