summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY4
-rw-r--r--config.c4
-rw-r--r--footer.c72
-rw-r--r--footer.h10
-rw-r--r--imageloader.c144
-rw-r--r--imageloader.h17
-rwxr-xr-xpo/de_DE.po2
-rw-r--r--themes/tvguide-darkblue.theme17
-rw-r--r--themes/tvguide-default.theme17
-rw-r--r--tvguideosd.c17
10 files changed, 173 insertions, 131 deletions
diff --git a/HISTORY b/HISTORY
index b1cf711..31bbfb4 100644
--- a/HISTORY
+++ b/HISTORY
@@ -4,3 +4,7 @@ VDR Plugin 'tvguide' Revision History
2012-08-12: Version 0.0.1
- Initial revision.
+
+2013-01-17: Version 0.0.2
+
+- Changed color buttons to nOpacity style
diff --git a/config.c b/config.c
index 229f8aa..6d62dbe 100644
--- a/config.c
+++ b/config.c
@@ -13,7 +13,7 @@ cTvguideConfig::cTvguideConfig() {
displayTime = 160;
minuteHeight = 0;
timeColWidth = 120;
- headerHeight = 120;
+ headerHeight = 145;
footerHeight = 80;
stepMinutes = 30;
bigStepHours = 3;
@@ -21,7 +21,7 @@ cTvguideConfig::cTvguideConfig() {
jumpChannels = 5;
hideChannelLogos = 0;
logoWidth = 130;
- logoHeight = 73;
+ logoHeight = 100;
logoExtension = 0;
hideEpgImages = 0;
epgImageWidth = 315;
diff --git a/footer.c b/footer.c
index 19ee958..6b908e8 100644
--- a/footer.c
+++ b/footer.c
@@ -1,59 +1,53 @@
#include "footer.h"
cFooter::cFooter() {
- int buttonHeight= tvguideConfig.footerHeight - 20;
- textY = (buttonHeight - tvguideConfig.FontButton->Height())/2;
- int distanceX = 20;
- buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeColWidth-5*distanceX)/4;
- int startX = tvguideConfig.timeColWidth + distanceX;
- int Y = tvguideConfig.osdHeight - tvguideConfig.footerHeight + (tvguideConfig.footerHeight - buttonHeight)/2;
+ buttonBorder = 20;
+ buttonWidth = (tvguideConfig.osdWidth - tvguideConfig.timeColWidth - 5*buttonBorder)/4;
+ buttonHeight= tvguideConfig.footerHeight - 2*buttonBorder;
+ buttonY = (tvguideConfig.footerHeight - buttonHeight)/2;
- buttonRed = new cStyledPixmap(osdManager.requestPixmap(3, cRect(startX, Y, buttonWidth, buttonHeight), cRect::Null, "btnRed"), "btnRed");
- buttonGreen = new cStyledPixmap(osdManager.requestPixmap(3, cRect(startX + buttonWidth + distanceX, Y, buttonWidth, buttonHeight), cRect::Null, "btnGreen"), "btnGreen");
- buttonYellow = new cStyledPixmap(osdManager.requestPixmap(3, cRect(startX + 2*(buttonWidth + distanceX), Y, buttonWidth, buttonHeight), cRect::Null, "btnYellow"), "btnYellow");
- buttonBlue = new cStyledPixmap(osdManager.requestPixmap(3, cRect(startX + 3*(buttonWidth + distanceX), Y, buttonWidth, buttonHeight), cRect::Null, "btnBlue"), "btnBlue");
+ footer = osdManager.requestPixmap(2, cRect( tvguideConfig.timeColWidth,
+ tvguideConfig.osdHeight - tvguideConfig.footerHeight,
+ tvguideConfig.osdWidth - tvguideConfig.timeColWidth,
+ tvguideConfig.footerHeight),
+ cRect::Null, "footer");
+ footer->Fill(clrTransparent);
}
cFooter::~cFooter(void) {
- delete buttonRed;
- delete buttonGreen;
- delete buttonYellow;
- delete buttonBlue;
+ osdManager.releasePixmap(footer, "footer");;
}
void cFooter::drawRedButton() {
- buttonRed->setColor(theme.Color(clrButtonRed), theme.Color(clrButtonRedBlending));
- buttonRed->drawBackground();
- buttonRed->drawBorder();
- cString text(tr("Set Timer"));
- int width = tvguideConfig.FontButton->Width(*(text));
- buttonRed->DrawText(cPoint((buttonWidth-width)/2, textY), *(text), theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
-
+ cString text(tr("Set Timer"));
+ DrawButton(*text, theme.Color(clrButtonRed), theme.Color(clrButtonRedBorder), 0);
}
void cFooter::drawGreenButton() {
- buttonGreen->setColor(theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBlending));
- buttonGreen->drawBackground();
- buttonGreen->drawBorder();
- cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
- int width = tvguideConfig.FontButton->Width(*text);
- buttonGreen->DrawText(cPoint((buttonWidth-width)/2, textY), *text, theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
+ cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels back"));
+ DrawButton(*text, theme.Color(clrButtonGreen), theme.Color(clrButtonGreenBorder), 1);
}
void cFooter::drawYellowButton() {
- buttonYellow->setColor(theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBlending));
- buttonYellow->drawBackground();
- buttonYellow->drawBorder();
- cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
- int width = tvguideConfig.FontButton->Width(*text);
- buttonYellow->DrawText(cPoint((buttonWidth-width)/2, textY), *text, theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
+ cString text = cString::sprintf("%d %s", tvguideConfig.jumpChannels, tr("Channels forward"));
+ DrawButton(*text, theme.Color(clrButtonYellow), theme.Color(clrButtonYellowBorder), 2);
}
void cFooter::drawBlueButton() {
- buttonBlue->setColor(theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBlending));
- buttonBlue->drawBackground();
- buttonBlue->drawBorder();
- cString text(tr("Switch to Channel"));
- int width = tvguideConfig.FontButton->Width(*(text));
- buttonBlue->DrawText(cPoint((buttonWidth-width)/2, textY), *(text), theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
+ cString text(tr("Switch to Channel"));
+ DrawButton(*text, theme.Color(clrButtonBlue), theme.Color(clrButtonBlueBorder), 3);
}
+
+void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
+
+ int left = num * buttonWidth + (num + 1) * buttonBorder;
+ footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
+
+ cImageLoader imgLoader;
+ imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, buttonWidth-4, buttonHeight-4);
+ footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
+
+ int textWidth = tvguideConfig.FontButton->Width(text);
+ int textHeight = tvguideConfig.FontButton->Height();
+ footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
+} \ No newline at end of file
diff --git a/footer.h b/footer.h
index 9cf6045..805ab0a 100644
--- a/footer.h
+++ b/footer.h
@@ -5,12 +5,12 @@
class cFooter {
private:
- cStyledPixmap *buttonRed;
- cStyledPixmap *buttonGreen;
- cStyledPixmap *buttonYellow;
- cStyledPixmap *buttonBlue;
- int textY;
+ cPixmap *footer;
int buttonWidth;
+ int buttonHeight;
+ int buttonY;
+ int buttonBorder;
+ void DrawButton(const char *text, tColor color, tColor borderColor, int num);
public:
cFooter();
virtual ~cFooter(void);
diff --git a/imageloader.c b/imageloader.c
index 015f805..6221cac 100644
--- a/imageloader.c
+++ b/imageloader.c
@@ -1,5 +1,8 @@
#include "imageloader.h"
#include <math.h>
+#include <string>
+#include <dirent.h>
+#include <iostream>
using namespace Magick;
@@ -9,70 +12,103 @@ cImageLoader::cImageLoader() {
cImageLoader::~cImageLoader() {
}
-bool cImageLoader::LoadLogo(const char *logo)
-{
- try
- {
- int width = tvguideConfig.logoWidth;
- int height = tvguideConfig.logoHeight;
- cString extension;
- if (tvguideConfig.logoExtension == 0) {
+bool cImageLoader::LoadLogo(const char *logo, int width = tvguideConfig.logoWidth, int height = tvguideConfig.logoHeight) {
+ if ((width == 0)||(height==0))
+ return false;
+ std::string logoLower = logo;
+ toLowerCase(logoLower);
+ cString extension;
+ if (tvguideConfig.logoExtension == 0) {
extension = "png";
} else if (tvguideConfig.logoExtension == 1) {
extension = "jpg";
}
- cString Filename = cString::sprintf("%s%s.%s", *tvguideConfig.logoPath, logo, *extension);
- osdImage.read(*Filename);
+ if (!LoadImage(logoLower.c_str(), tvguideConfig.logoPath, extension))
+ return false;
+ if (height != 0 || width != 0) {
+ buffer.sample( Geometry(width, height));
+ }
+ return true;
+}
- if (height != 0 || width != 0) {
- osdImage.sample( Geometry(width, height));
-
- }
- return true;
- }
- catch (...)
- {
- return false;
- }
+bool cImageLoader::LoadEPGImage(int eventID) {
+ int width = tvguideConfig.epgImageWidth;
+ int height = tvguideConfig.epgImageHeight;
+ if ((width == 0)||(height==0))
+ return false;
+ if (!LoadImage(cString::sprintf("%d", eventID), tvguideConfig.epgImagePath, "jpg"))
+ return false;
+ if (height != 0 || width != 0) {
+ buffer.sample( Geometry(width, height));
+ }
+ return true;
}
-bool cImageLoader::LoadEPGImage(int eventID)
-{
- try
- {
- int width = tvguideConfig.epgImageWidth;
- int height = tvguideConfig.epgImageHeight;
- cString Filename = cString::sprintf("%s%d.jpg", *tvguideConfig.epgImagePath, eventID);
- osdImage.read(*Filename);
+void cImageLoader::DrawBackground(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,-1*(double)width,0.0,0.0,1.5*(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;
+}
- if (height != 0 || width != 0)
- osdImage.sample( Geometry(width, height));
-
- return true;
- }
- catch (...)
- {
- return false;
- }
+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() {
+ int w, h;
+ w = buffer.columns();
+ h = buffer.rows();
+ cImage image (cSize(w, h));
+ const PixelPacket *pixels = buffer.getConstPixels(0, 0, w, h);
+ for (int iy = 0; iy < h; ++iy) {
+ for (int ix = 0; ix < w; ++ix) {
+ tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24)
+ | (int(pixels->green * 255 / MaxRGB) << 8)
+ | (int(pixels->red * 255 / MaxRGB) << 16)
+ | (int(pixels->blue * 255 / MaxRGB) );
+ image.SetPixel(cPoint(ix, iy), col);
+ ++pixels;
+ }
+ }
+ return image;
+}
+
+Color cImageLoader::Argb2Color(tColor col) {
+ tIndex alpha = (col & 0xFF000000) >> 24;
+ tIndex red = (col & 0x00FF0000) >> 16;
+ tIndex green = (col & 0x0000FF00) >> 8;
+ tIndex blue = (col & 0x000000FF);
+ Color color(MaxRGB*red/255, MaxRGB*green/255, MaxRGB*blue/255, MaxRGB*(0xFF-alpha)/255);
+ return color;
+}
-cImage cImageLoader::GetImage()
-{
- int w, h;
- w = osdImage.columns();
- h = osdImage.rows();
- cImage image (cSize(w, h));
- const PixelPacket *pixels = osdImage.getConstPixels(0, 0, w, h);
- for (int iy = 0; iy < h; ++iy) {
- for (int ix = 0; ix < w; ++ix) {
- tColor col = (~int(pixels->opacity * 255 / MaxRGB) << 24)
- | (int(pixels->green * 255 / MaxRGB) << 8)
- | (int(pixels->red * 255 / MaxRGB) << 16)
- | (int(pixels->blue * 255 / MaxRGB) );
- image.SetPixel(cPoint(ix, iy), col);
- ++pixels;
+void cImageLoader::toLowerCase(std::string &str) {
+ const int length = str.length();
+ for(int i=0; i < length; ++i) {
+ str[i] = std::tolower(str[i]);
}
- }
- return image;
}
+
+bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) {
+ try {
+ cString File = cString::sprintf("%s%s.%s", *Path, *FileName, *Extension);
+ dsyslog("tvguide: trying to load: %s", *File);
+ buffer.read(*File);
+ dsyslog("tvguide: %s sucessfully loaded", *File);
+ } catch (...) {
+ return false;
+ }
+ return true;
+} \ No newline at end of file
diff --git a/imageloader.h b/imageloader.h
index c122758..355c21e 100644
--- a/imageloader.h
+++ b/imageloader.h
@@ -11,13 +11,18 @@ using namespace Magick;
class cImageLoader {
public:
- cImageLoader();
- ~cImageLoader();
- cImage GetImage();
- bool LoadLogo(const char *logo);
- bool LoadEPGImage(int eventID);
+ cImageLoader();
+ ~cImageLoader();
+ 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);
private:
- Image osdImage;
+ Image buffer;
+ Color Argb2Color(tColor col);
+ void toLowerCase(std::string &str);
+ bool LoadImage(cString FileName, cString Path, cString Extension);
};
#endif //_TVGUIDE_IMAGELOADER_H
diff --git a/po/de_DE.po b/po/de_DE.po
index bdf0cd8..0a4c8ed 100755
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2012-12-27 15:27+0100\n"
+"POT-Creation-Date: 2013-01-17 14:01+0100\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
diff --git a/themes/tvguide-darkblue.theme b/themes/tvguide-darkblue.theme
index 4040458..59db3ad 100644
--- a/themes/tvguide-darkblue.theme
+++ b/themes/tvguide-darkblue.theme
@@ -18,11 +18,12 @@ clrTimeline1 = FFFFFFFF
clrTimeline1Blending = FF828282
clrTimeline2 = FF000000
clrTimeline2Blending = FF3F3F3F
-clrButtonRed = FFD42627
-clrButtonRedBlending = FF000000
-clrButtonGreen = FF004F00
-clrButtonGreenBlending = FF000000
-clrButtonYellow = FFFFA300
-clrButtonYellowBlending = FF000000
-clrButtonBlue = FF0000FE
-clrButtonBlueBlending = FF000000
+clrButtonRed = 99BB0000
+clrButtonRedBorder = FFBB0000
+clrButtonGreen = 9900BB00
+clrButtonGreenBorder = FF00BB00
+clrButtonYellow = 99BBBB00
+clrButtonYellowBorder = FFBBBB00
+clrButtonBlue = 990000BB
+clrButtonBlueBorder = FF0000BB
+clrButtonBlend = DD000000
diff --git a/themes/tvguide-default.theme b/themes/tvguide-default.theme
index e1e5794..b9817b5 100644
--- a/themes/tvguide-default.theme
+++ b/themes/tvguide-default.theme
@@ -17,11 +17,12 @@ clrTimeline1 = FFFFFFFF
clrTimeline1Blending = FF828282
clrTimeline2 = FF000000
clrTimeline2Blending = FF3F3F3F
-clrButtonRed = FFD42627
-clrButtonRedBlending = FFE0E0E0
-clrButtonGreen = FF004F00
-clrButtonGreenBlending = FFE0E0E0
-clrButtonYellow = FFFFA300
-clrButtonYellowBlending = FFE0E0E0
-clrButtonBlue = FF0000FE
-clrButtonBlueBlending = FFE0E0E0
+clrButtonRed = 99BB0000
+clrButtonRedBorder = FFBB0000
+clrButtonGreen = 9900BB00
+clrButtonGreenBorder = FF00BB00
+clrButtonYellow = 99BBBB00
+clrButtonYellowBorder = FFBBBB00
+clrButtonBlue = 990000BB
+clrButtonBlueBorder = FF0000BB
+clrButtonBlend = DD000000
diff --git a/tvguideosd.c b/tvguideosd.c
index 8fca65a..b127fdd 100644
--- a/tvguideosd.c
+++ b/tvguideosd.c
@@ -19,14 +19,15 @@ THEME_CLR(theme, clrTimeline1, clrWhite);
THEME_CLR(theme, clrTimeline1Blending, 0xFF828282);
THEME_CLR(theme, clrTimeline2, clrBlack);
THEME_CLR(theme, clrTimeline2Blending, 0xFF3F3F3F);
-THEME_CLR(theme, clrButtonRed, 0xFFD42627);
-THEME_CLR(theme, clrButtonRedBlending, 0xFFE0E0E0);
-THEME_CLR(theme, clrButtonGreen, 0xFF004F00);
-THEME_CLR(theme, clrButtonGreenBlending, 0xFFE0E0E0);
-THEME_CLR(theme, clrButtonYellow, 0xFFffa300);
-THEME_CLR(theme, clrButtonYellowBlending, 0xFFE0E0E0);
-THEME_CLR(theme, clrButtonBlue, 0xFF0000fe);
-THEME_CLR(theme, clrButtonBlueBlending, 0xFFE0E0E0);
+THEME_CLR(theme, clrButtonRed, 0x99BB0000);
+THEME_CLR(theme, clrButtonRedBorder, 0xFFBB0000);
+THEME_CLR(theme, clrButtonGreen, 0x9900BB00);
+THEME_CLR(theme, clrButtonGreenBorder, 0xFF00BB00);
+THEME_CLR(theme, clrButtonYellow, 0x99BBBB00);
+THEME_CLR(theme, clrButtonYellowBorder, 0xFFBBBB00);
+THEME_CLR(theme, clrButtonBlue, 0x990000BB);
+THEME_CLR(theme, clrButtonBlueBorder, 0xFF0000BB);
+THEME_CLR(theme, clrButtonBlend, 0xDD000000);
#include "config.c"
cTvguideConfig tvguideConfig;