Added config option style nOpacity for backgrounds and theme nOpacity

This commit is contained in:
louis 2013-01-17 16:19:37 +01:00
parent c9bc7e0735
commit e895a02d97
11 changed files with 77 additions and 25 deletions

View File

@ -8,3 +8,5 @@ VDR Plugin 'tvguide' Revision History
2013-01-17: Version 0.0.2
- Changed color buttons to nOpacity style
- Changed channelheader to display transparent logos properly
- Added "style nOpacity" for backgrounds and theme nOpacity

View File

@ -16,6 +16,7 @@ cDetailView::cDetailView(cEpgGrid *grid) {
cDetailView::~cDetailView(void){
delete header;
osdManager.releasePixmap(headerLogo);
osdManager.releasePixmap(content);
osdManager.releasePixmap(scrollBar);
osdManager.releasePixmap(footer);
@ -36,6 +37,9 @@ void cDetailView::createPixmaps() {
header = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeader"), "detailViewHeader");
header->SetAlpha(0);
headerLogo = osdManager.requestPixmap(6, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeaderLogo");
headerLogo->Fill(clrTransparent);
headerLogo->SetAlpha(0);
header->setColor(theme.Color(clrHeader), theme.Color(clrHeaderBlending));
content = osdManager.requestPixmap(5, cRect(borderWidth, borderWidth + headerHeight, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, tvguideConfig.osdHeight-2*borderWidth-headerHeight),
cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight)));
@ -63,7 +67,7 @@ void cDetailView::drawHeader() {
} else {
if (imgLoader.LoadLogo(grid->column->getChannel()->Name())) {
cImage logo = imgLoader.GetImage();
header->DrawImage(cPoint(20, 20), logo);
headerLogo->DrawImage(cPoint(20, 20), logo);
}
offset += tvguideConfig.logoHeight;
}
@ -172,6 +176,7 @@ void cDetailView::Action(void) {
double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE;
header->SetAlpha(Alpha);
headerLogo->SetAlpha(Alpha);
content->SetAlpha(Alpha);
scrollBar->SetAlpha(Alpha);
footer->SetAlpha(Alpha);

View File

@ -9,6 +9,7 @@ class cDetailView : public cThread {
private:
cEpgGrid *grid;
cStyledPixmap *header;
cPixmap *headerLogo;
cPixmap *content;
cPixmap *scrollBar;
cPixmap *footer;

View File

@ -44,7 +44,9 @@ bool cImageLoader::LoadEPGImage(int eventID) {
return true;
}
void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) {
bool cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height) {
if ((width == 0) || (height == 0))
return false;
Color Back = Argb2Color(back);
Color Blend = Argb2Color(blend);
Image tmp(Geometry(width, height), Blend);
@ -53,17 +55,7 @@ void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int heig
Image tmp2(Geometry(width, height), Back);
tmp.composite(tmp2, 0, 0, OverlayCompositeOp);
buffer = tmp;
}
void cImageLoader::DrawBackground2(tColor back, tColor blend, int width, int height) {
Color Back = Argb2Color(back);
Color Blend = Argb2Color(blend);
Image tmp(Geometry(width, height), Blend);
double arguments[9] = {0.0,(double)height,0.0,-0.5*(double)width,0.0,0.0,0.75*(double)width,0.0,1.0};
tmp.sparseColor(MatteChannel, BarycentricColorInterpolate, 9, arguments);
Image tmp2(Geometry(width, height), Back);
tmp.composite(tmp2, 0, 0, OverlayCompositeOp);
buffer = tmp;
return true;
}
cImage cImageLoader::GetImage() {

View File

@ -16,8 +16,7 @@ public:
cImage GetImage();
bool LoadLogo(const char *logo, int width, int height);
bool LoadEPGImage(int eventID);
void DrawBackground(tColor back, tColor blend, int width, int height);
void DrawBackground2(tColor back, tColor blend, int width, int height);
bool DrawBackground(tColor back, tColor blend, int width, int height);
private:
Image buffer;
Color Argb2Color(tColor col);

View File

@ -135,6 +135,9 @@ cMenuSetupScreenLayout::cMenuSetupScreenLayout(cTvguideConfig* data) : cMenuSet
hideChannelLogosItems[1] = trVDR("no");
logoExtensionItems[0] = "png";
logoExtensionItems[1] = "jpg";
blendingMethods[0] = "none";
blendingMethods[1] = "classic";
blendingMethods[2] = "nOpacity style";
Set();
}
@ -143,7 +146,7 @@ void cMenuSetupScreenLayout::Set(void) {
Clear();
if (themes.NumThemes())
Add(new cMenuEditStraItem(tr("Theme"), &tmpTvguideConfig->themeIndex, themes.NumThemes(), themes.Descriptions()));
Add(new cMenuEditBoolItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending));
Add(new cMenuEditStraItem(tr("Use color gradients"), &tmpTvguideConfig->useBlending, 3, blendingMethods));
Add(new cMenuEditBoolItem(tr("Rounded Corners"), &tmpTvguideConfig->roundedCorners));
Add(new cMenuEditIntItem(tr("Width of Timeline"), &tmpTvguideConfig->timeColWidth, 50, 300));
Add(new cMenuEditIntItem(tr("Height of Header"), &tmpTvguideConfig->headerHeight, 50, 300));

View File

@ -38,6 +38,7 @@ class cMenuSetupScreenLayout : public cMenuSetupSubMenu {
cThemes themes;
const char * hideChannelLogosItems[2];
const char * logoExtensionItems[2];
const char * blendingMethods[3];
void Set(void);
public:
cMenuSetupScreenLayout(cTvguideConfig *data);

View File

@ -22,10 +22,12 @@ void cStyledPixmap::setPixmap(cPixmap *pixmap) {
}
void cStyledPixmap::drawBackground() {
if (!tvguideConfig.useBlending) {
pixmap->Fill(color);
} else {
if (tvguideConfig.useBlending == 1){
drawBlendedBackground();
} else if (tvguideConfig.useBlending == 2){
drawSparsedBackground();
} else {
pixmap->Fill(color);
}
}
@ -52,6 +54,15 @@ void cStyledPixmap::drawBlendedBackground() {
}
}
void cStyledPixmap::drawSparsedBackground() {
int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height();
cImageLoader imgLoader;
if (imgLoader.DrawBackground(colorBlending, color, width, height))
pixmap->DrawImage(cPoint(0,0), imgLoader.GetImage());
}
void cStyledPixmap::drawBorder() {
int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height();

View File

@ -19,6 +19,7 @@ public:
virtual ~cStyledPixmap(void);
void drawBackground();
void drawBlendedBackground();
void drawSparsedBackground();
void drawBorder();
void drawBoldBorder();
void drawDefaultBorder(int width, int height);

View File

@ -0,0 +1,28 @@
Description = nOpacity
clrBackground = FF000000
clrBackgroundOSD = FF000000
clrGrid1 = EE444444
clrGrid1Blending = 90000000
clrGrid2 = EE888888
clrGrid2Blending = 90000000
clrHighlight = EE0033FF
clrHighlightBlending = DD000000
clrFont = FFFFFFFF
clrFontHeader = FFFFFFFF
clrFontButtons = FFFFFFFF
clrHeader = EE444444
clrHeaderBlending = 90000000
clrBorder = DD003DF5
clrTimeline1 = BBFFFFFF
clrTimeline1Blending = 90828282
clrTimeline2 = BB000000
clrTimeline2Blending = 903F3F3F
clrButtonRed = 99BB0000
clrButtonRedBorder = FFBB0000
clrButtonGreen = 9900BB00
clrButtonGreenBorder = FF00BB00
clrButtonYellow = 99BBBB00
clrButtonYellowBorder = FFBBBB00
clrButtonBlue = 990000BB
clrButtonBlueBorder = FF0000BB
clrButtonBlend = DD000000

View File

@ -80,9 +80,10 @@ void cTimeLine::drawTimeline() {
}
cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = new cImage(cSize(width, height));
cImage *image = NULL;
if (tvguideConfig.useBlending == 1) {
image = new cImage(cSize(width, height));
image->Fill(clrBgr);
if (tvguideConfig.useBlending) {
int stepY = 0.5*height / 64;
int alpha = 0x00;
tColor clr;
@ -95,6 +96,14 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t
}
alpha += 0x04;
}
} else if (tvguideConfig.useBlending == 2) {
cImageLoader imgLoader;
if (imgLoader.DrawBackground(clrBgr, clrBlend, width, height)) {
image = new cImage(imgLoader.GetImage());
}
} else {
image = new cImage(cSize(width, height));
image->Fill(clrBgr);
}
return image;
}