diff --git a/HISTORY b/HISTORY index 31bbfb4..3e346c4 100644 --- a/HISTORY +++ b/HISTORY @@ -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 diff --git a/detailview.c b/detailview.c index 2c791e4..e70b3fa 100644 --- a/detailview.c +++ b/detailview.c @@ -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))); @@ -51,7 +55,7 @@ void cDetailView::createPixmaps() { } void cDetailView::drawHeader() { - header->drawBackground(); + header->drawBackground(); header->drawBoldBorder(); int lineHeight = tvguideConfig.FontDetailHeader->Height(); @@ -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); diff --git a/detailview.h b/detailview.h index c938eb2..79808cb 100644 --- a/detailview.h +++ b/detailview.h @@ -9,6 +9,7 @@ class cDetailView : public cThread { private: cEpgGrid *grid; cStyledPixmap *header; + cPixmap *headerLogo; cPixmap *content; cPixmap *scrollBar; cPixmap *footer; diff --git a/imageloader.c b/imageloader.c index 6221cac..9c9dff3 100644 --- a/imageloader.c +++ b/imageloader.c @@ -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() { diff --git a/imageloader.h b/imageloader.h index 355c21e..23faf65 100644 --- a/imageloader.h +++ b/imageloader.h @@ -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); diff --git a/setup.c b/setup.c index 57d2168..a8e57d6 100644 --- a/setup.c +++ b/setup.c @@ -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)); diff --git a/setup.h b/setup.h index 91fad7f..ba81d8f 100644 --- a/setup.h +++ b/setup.h @@ -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); diff --git a/styledpixmap.c b/styledpixmap.c index 2569f53..1669501 100644 --- a/styledpixmap.c +++ b/styledpixmap.c @@ -22,11 +22,13 @@ 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); + } } 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() { int width = pixmap->ViewPort().Width(); int height = pixmap->ViewPort().Height(); diff --git a/styledpixmap.h b/styledpixmap.h index a751032..147d6a0 100644 --- a/styledpixmap.h +++ b/styledpixmap.h @@ -19,6 +19,7 @@ public: virtual ~cStyledPixmap(void); void drawBackground(); void drawBlendedBackground(); + void drawSparsedBackground(); void drawBorder(); void drawBoldBorder(); void drawDefaultBorder(int width, int height); diff --git a/themes/tvguide-nOpacity.theme b/themes/tvguide-nOpacity.theme new file mode 100644 index 0000000..a441abe --- /dev/null +++ b/themes/tvguide-nOpacity.theme @@ -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 diff --git a/timeline.c b/timeline.c index e2275fd..be3199a 100644 --- a/timeline.c +++ b/timeline.c @@ -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)); - image->Fill(clrBgr); - if (tvguideConfig.useBlending) { + cImage *image = NULL; + if (tvguideConfig.useBlending == 1) { + image = new cImage(cSize(width, height)); + image->Fill(clrBgr); int stepY = 0.5*height / 64; int alpha = 0x00; tColor clr; @@ -95,7 +96,15 @@ 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; }