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 2013-01-17: Version 0.0.2
- Changed color buttons to nOpacity style - 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){ cDetailView::~cDetailView(void){
delete header; delete header;
osdManager.releasePixmap(headerLogo);
osdManager.releasePixmap(content); osdManager.releasePixmap(content);
osdManager.releasePixmap(scrollBar); osdManager.releasePixmap(scrollBar);
osdManager.releasePixmap(footer); 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 = new cStyledPixmap(osdManager.requestPixmap(5, cRect(borderWidth, borderWidth, tvguideConfig.osdWidth - 2*borderWidth, headerHeight), cRect::Null, "detailViewHeader"), "detailViewHeader");
header->SetAlpha(0); 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)); 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), 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))); cRect(0,0, tvguideConfig.osdWidth - 2*borderWidth - scrollBarWidth, max(heightContent, tvguideConfig.osdHeight-2*borderWidth-headerHeight)));
@ -51,7 +55,7 @@ void cDetailView::createPixmaps() {
} }
void cDetailView::drawHeader() { void cDetailView::drawHeader() {
header->drawBackground(); header->drawBackground();
header->drawBoldBorder(); header->drawBoldBorder();
int lineHeight = tvguideConfig.FontDetailHeader->Height(); int lineHeight = tvguideConfig.FontDetailHeader->Height();
@ -63,7 +67,7 @@ void cDetailView::drawHeader() {
} else { } else {
if (imgLoader.LoadLogo(grid->column->getChannel()->Name())) { if (imgLoader.LoadLogo(grid->column->getChannel()->Name())) {
cImage logo = imgLoader.GetImage(); cImage logo = imgLoader.GetImage();
header->DrawImage(cPoint(20, 20), logo); headerLogo->DrawImage(cPoint(20, 20), logo);
} }
offset += tvguideConfig.logoHeight; offset += tvguideConfig.logoHeight;
} }
@ -172,6 +176,7 @@ void cDetailView::Action(void) {
double t = min(double(Now - Start) / FadeTime, 1.0); double t = min(double(Now - Start) / FadeTime, 1.0);
int Alpha = t * ALPHA_OPAQUE; int Alpha = t * ALPHA_OPAQUE;
header->SetAlpha(Alpha); header->SetAlpha(Alpha);
headerLogo->SetAlpha(Alpha);
content->SetAlpha(Alpha); content->SetAlpha(Alpha);
scrollBar->SetAlpha(Alpha); scrollBar->SetAlpha(Alpha);
footer->SetAlpha(Alpha); footer->SetAlpha(Alpha);

View File

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

View File

@ -44,7 +44,9 @@ bool cImageLoader::LoadEPGImage(int eventID) {
return true; 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 Back = Argb2Color(back);
Color Blend = Argb2Color(blend); Color Blend = Argb2Color(blend);
Image tmp(Geometry(width, height), 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); Image tmp2(Geometry(width, height), Back);
tmp.composite(tmp2, 0, 0, OverlayCompositeOp); tmp.composite(tmp2, 0, 0, OverlayCompositeOp);
buffer = tmp; buffer = tmp;
} return true;
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;
} }
cImage cImageLoader::GetImage() { cImage cImageLoader::GetImage() {

View File

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

View File

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

View File

@ -22,11 +22,13 @@ void cStyledPixmap::setPixmap(cPixmap *pixmap) {
} }
void cStyledPixmap::drawBackground() { void cStyledPixmap::drawBackground() {
if (!tvguideConfig.useBlending) { if (tvguideConfig.useBlending == 1){
pixmap->Fill(color);
} else {
drawBlendedBackground(); drawBlendedBackground();
} } else if (tvguideConfig.useBlending == 2){
drawSparsedBackground();
} else {
pixmap->Fill(color);
}
} }
void cStyledPixmap::drawBlendedBackground() { void cStyledPixmap::drawBlendedBackground() {
@ -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() { void cStyledPixmap::drawBorder() {
int width = pixmap->ViewPort().Width(); int width = pixmap->ViewPort().Width();
int height = pixmap->ViewPort().Height(); int height = pixmap->ViewPort().Height();

View File

@ -19,6 +19,7 @@ public:
virtual ~cStyledPixmap(void); virtual ~cStyledPixmap(void);
void drawBackground(); void drawBackground();
void drawBlendedBackground(); void drawBlendedBackground();
void drawSparsedBackground();
void drawBorder(); void drawBorder();
void drawBoldBorder(); void drawBoldBorder();
void drawDefaultBorder(int width, int height); 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 *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) {
cImage *image = new cImage(cSize(width, height)); cImage *image = NULL;
image->Fill(clrBgr); if (tvguideConfig.useBlending == 1) {
if (tvguideConfig.useBlending) { image = new cImage(cSize(width, height));
image->Fill(clrBgr);
int stepY = 0.5*height / 64; int stepY = 0.5*height / 64;
int alpha = 0x00; int alpha = 0x00;
tColor clr; tColor clr;
@ -95,7 +96,15 @@ cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, t
} }
alpha += 0x04; 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; return image;
} }