mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added cOsd::MaxPixmapSize()
This commit is contained in:
parent
a429eefbe7
commit
735fb20ac6
8
HISTORY
8
HISTORY
@ -8595,3 +8595,11 @@ Video Disk Recorder Revision History
|
|||||||
- Fixed leading/trailing/multiple blanks in the translation files.
|
- Fixed leading/trailing/multiple blanks in the translation files.
|
||||||
- Bumped all version numbers to 2.2.0.
|
- Bumped all version numbers to 2.2.0.
|
||||||
- Official release.
|
- Official release.
|
||||||
|
|
||||||
|
2015-03-08: Version 2.3.1
|
||||||
|
|
||||||
|
- The new function cOsd::MaxPixmapSize() can be called to determine the maximum size
|
||||||
|
a cPixmap may have on the current OSD. The 'osddemo' example has been modified
|
||||||
|
accordingly. Plugin authors may want to use this function in case they use pixmaps
|
||||||
|
that are larger than the full OSD size. The default implementation sets this limit
|
||||||
|
to 2048x2048 pixel.
|
||||||
|
@ -72,3 +72,7 @@ VDR Plugin 'osddemo' Revision History
|
|||||||
2015-02-19: Version 2.2.0
|
2015-02-19: Version 2.2.0
|
||||||
|
|
||||||
- Official release.
|
- Official release.
|
||||||
|
|
||||||
|
2015-03-08: Version 2.3.1
|
||||||
|
|
||||||
|
- Now using cOsd::MaxPixmapSize().
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
*
|
*
|
||||||
* See the README file for copyright information and how to reach the author.
|
* See the README file for copyright information and how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: osddemo.c 3.4 2015/02/17 13:12:36 kls Exp $
|
* $Id: osddemo.c 4.1 2015/03/08 16:40:01 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vdr/osd.h>
|
#include <vdr/osd.h>
|
||||||
#include <vdr/plugin.h>
|
#include <vdr/plugin.h>
|
||||||
|
|
||||||
static const char *VERSION = "2.2.0";
|
static const char *VERSION = "2.3.1";
|
||||||
static const char *DESCRIPTION = "Demo of arbitrary OSD setup";
|
static const char *DESCRIPTION = "Demo of arbitrary OSD setup";
|
||||||
static const char *MAINMENUENTRY = "Osd Demo";
|
static const char *MAINMENUENTRY = "Osd Demo";
|
||||||
|
|
||||||
@ -427,16 +427,20 @@ void cTrueColorDemo::Action(void)
|
|||||||
const int Size = SmlFont->Width(Text) + 10;
|
const int Size = SmlFont->Width(Text) + 10;
|
||||||
const int NumDots = 12;
|
const int NumDots = 12;
|
||||||
const int AnimFrames = NumDots;
|
const int AnimFrames = NumDots;
|
||||||
|
int Rows = min(osd->MaxPixmapSize().Height() / Size, AnimFrames);
|
||||||
|
int Cols = (AnimFrames + Rows - 1) / Rows;
|
||||||
// Temporarily using pixmap layer 0 to have the text alpha blended:
|
// Temporarily using pixmap layer 0 to have the text alpha blended:
|
||||||
AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size, Size * AnimFrames));
|
AnimPixmap = osd->CreatePixmap(0, cRect((osd->Width() - Size) / 2, StartLine, Size, Size), cRect(0, 0, Size * Cols, Size * Rows));
|
||||||
if (AnimPixmap) {
|
if (AnimPixmap) {
|
||||||
AnimPixmap->SetAlpha(0);
|
AnimPixmap->SetAlpha(0);
|
||||||
AnimPixmap->Clear();
|
AnimPixmap->Clear();
|
||||||
const int Diameter = Size / 5;
|
const int Diameter = Size / 5;
|
||||||
int xc = Size / 2 - Diameter / 2;
|
|
||||||
for (int Frame = 0; Frame < AnimFrames; Frame++) {
|
for (int Frame = 0; Frame < AnimFrames; Frame++) {
|
||||||
AnimPixmap->DrawEllipse(cRect(0, Frame * Size, Size, Size), 0xDDFFFFFF);
|
int x0 = Frame / Rows * Size;
|
||||||
int yc = Frame * Size + Size / 2 - Diameter / 2;
|
int y0 = Frame % Rows * Size;
|
||||||
|
AnimPixmap->DrawEllipse(cRect(x0, y0, Size, Size), 0xDDFFFFFF);
|
||||||
|
int xc = x0 + Size / 2 - Diameter / 2;
|
||||||
|
int yc = y0 + Size / 2 - Diameter / 2;
|
||||||
int Color = 0xFF;
|
int Color = 0xFF;
|
||||||
int Delta = Color / NumDots / 3;
|
int Delta = Color / NumDots / 3;
|
||||||
for (int a = 0; a < NumDots; a++) {
|
for (int a = 0; a < NumDots; a++) {
|
||||||
@ -446,7 +450,7 @@ void cTrueColorDemo::Action(void)
|
|||||||
AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color));
|
AnimPixmap->DrawEllipse(cRect(x, y, Diameter, Diameter), ArgbToColor(0xFF, Color, Color, Color));
|
||||||
Color -= Delta;
|
Color -= Delta;
|
||||||
}
|
}
|
||||||
AnimPixmap->DrawText(cPoint(0, Frame * Size), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter);
|
AnimPixmap->DrawText(cPoint(x0, y0), Text, clrBlack, clrTransparent, SmlFont, Size, Size, taCenter);
|
||||||
}
|
}
|
||||||
AnimPixmap->SetLayer(3); // now setting the actual pixmap layer
|
AnimPixmap->SetLayer(3); // now setting the actual pixmap layer
|
||||||
FadeInPixmap = AnimPixmap;
|
FadeInPixmap = AnimPixmap;
|
||||||
|
10
config.h
10
config.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: config.h 3.21 2015/02/17 13:11:00 kls Exp $
|
* $Id: config.h 4.1 2015/02/21 14:59:27 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -22,13 +22,13 @@
|
|||||||
|
|
||||||
// VDR's own version number:
|
// VDR's own version number:
|
||||||
|
|
||||||
#define VDRVERSION "2.2.0"
|
#define VDRVERSION "2.3.1"
|
||||||
#define VDRVERSNUM 20200 // Version * 10000 + Major * 100 + Minor
|
#define VDRVERSNUM 20301 // Version * 10000 + Major * 100 + Minor
|
||||||
|
|
||||||
// The plugin API's version number:
|
// The plugin API's version number:
|
||||||
|
|
||||||
#define APIVERSION "2.2.0"
|
#define APIVERSION "2.3.1"
|
||||||
#define APIVERSNUM 20200 // Version * 10000 + Major * 100 + Minor
|
#define APIVERSNUM 20301 // Version * 10000 + Major * 100 + Minor
|
||||||
|
|
||||||
// When loading plugins, VDR searches them by their APIVERSION, which
|
// When loading plugins, VDR searches them by their APIVERSION, which
|
||||||
// may be smaller than VDRVERSION in case there have been no changes to
|
// may be smaller than VDRVERSION in case there have been no changes to
|
||||||
|
8
osd.c
8
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 3.5 2015/02/11 09:48:02 kls Exp $
|
* $Id: osd.c 4.1 2015/03/08 13:54:47 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
@ -1641,6 +1641,7 @@ int cOsd::osdLeft = 0;
|
|||||||
int cOsd::osdTop = 0;
|
int cOsd::osdTop = 0;
|
||||||
int cOsd::osdWidth = 0;
|
int cOsd::osdWidth = 0;
|
||||||
int cOsd::osdHeight = 0;
|
int cOsd::osdHeight = 0;
|
||||||
|
cSize cOsd::maxPixmapSize(2048, 2048);
|
||||||
cVector<cOsd *> cOsd::Osds;
|
cVector<cOsd *> cOsd::Osds;
|
||||||
cMutex cOsd::mutex;
|
cMutex cOsd::mutex;
|
||||||
|
|
||||||
@ -1705,6 +1706,11 @@ cBitmap *cOsd::GetBitmap(int Area)
|
|||||||
return Area < numBitmaps ? (isTrueColor ? bitmaps[0] : bitmaps[Area]) : NULL;
|
return Area < numBitmaps ? (isTrueColor ? bitmaps[0] : bitmaps[Area]) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cSize &cOsd::MaxPixmapSize(void) const
|
||||||
|
{
|
||||||
|
return maxPixmapSize;
|
||||||
|
}
|
||||||
|
|
||||||
cPixmap *cOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort)
|
cPixmap *cOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort)
|
||||||
{
|
{
|
||||||
if (isTrueColor) {
|
if (isTrueColor) {
|
||||||
|
5
osd.h
5
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 3.6 2015/02/11 09:48:02 kls Exp $
|
* $Id: osd.h 4.1 2015/03/08 13:54:09 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OSD_H
|
#ifndef __OSD_H
|
||||||
@ -722,6 +722,7 @@ class cOsd {
|
|||||||
private:
|
private:
|
||||||
static int osdLeft, osdTop, osdWidth, osdHeight;
|
static int osdLeft, osdTop, osdWidth, osdHeight;
|
||||||
static cVector<cOsd *> Osds;
|
static cVector<cOsd *> Osds;
|
||||||
|
static cSize maxPixmapSize;
|
||||||
static cMutex mutex;
|
static cMutex mutex;
|
||||||
bool isTrueColor;
|
bool isTrueColor;
|
||||||
cBitmap *savedBitmap;
|
cBitmap *savedBitmap;
|
||||||
@ -820,6 +821,8 @@ public:
|
|||||||
///< in order to preset the bitmap's palette won't crash.
|
///< in order to preset the bitmap's palette won't crash.
|
||||||
///< Use of this function outside of derived classes is deprecated and it
|
///< Use of this function outside of derived classes is deprecated and it
|
||||||
///< may be made 'protected' in a future version.
|
///< may be made 'protected' in a future version.
|
||||||
|
virtual const cSize &MaxPixmapSize(void) const;
|
||||||
|
///< Returns the maximum possible size of a pixmap this OSD can create.
|
||||||
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
||||||
///< Creates a new true color pixmap on this OSD (see cPixmap for details).
|
///< Creates a new true color pixmap on this OSD (see cPixmap for details).
|
||||||
///< The caller must not delete the returned object, it will be deleted when
|
///< The caller must not delete the returned object, it will be deleted when
|
||||||
|
Loading…
Reference in New Issue
Block a user