Rounded Corners for color buttons (Closes Ticket 1475)

This commit is contained in:
louis 2013-12-27 17:06:49 +01:00
parent c5af8c8017
commit 3e5aec2117
5 changed files with 35 additions and 5 deletions

View File

@ -93,3 +93,4 @@ Version 1.1.0
- Fixed Bug 1484 - Fixed Bug 1484
- Added Event Short Text (if available) to RecName (Closes Ticket 1490) - Added Event Short Text (if available) to RecName (Closes Ticket 1490)
- Fixed OSD Background Color (Closes Ticket 1474) - Fixed OSD Background Color (Closes Ticket 1474)
- Rounded Corners for color buttons (Closes Ticket 1475)

View File

@ -102,6 +102,11 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOs
imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.buttonHeight-4); imgLoader.DrawBackground(theme.Color(clrButtonBlend), color, geoManager.buttonWidth-4, geoManager.buttonHeight-4);
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage()); footer->DrawImage(cPoint(left+2, buttonY+2), imgLoader.GetImage());
if (tvguideConfig.roundedCorners) {
int borderRadius = 12;
int borderWidth = 2;
DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor);
}
} else if (tvguideConfig.style == eStyleGraphical) { } else if (tvguideConfig.style == eStyleGraphical) {
cImage *button = imgCache.GetOsdElement(buttonType); cImage *button = imgCache.GetOsdElement(buttonType);
if (button) { if (button) {
@ -109,7 +114,12 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOs
} }
} else { } else {
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor); footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
footer->DrawRectangle(cRect(left+2, buttonY+2, geoManager.buttonWidth-4, geoManager.buttonHeight-4), color); footer->DrawRectangle(cRect(left+1, buttonY+1, geoManager.buttonWidth-2, geoManager.buttonHeight-2), color);
if (tvguideConfig.roundedCorners) {
int borderRadius = 12;
int borderWidth = 1;
DrawRoundedCorners(footer, left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight, borderRadius, borderWidth, borderColor);
}
} }
int textWidth = fontManager.FontButton->Width(text); int textWidth = fontManager.FontButton->Width(text);

View File

@ -18,13 +18,13 @@ clrTimeline1Blending = 00000000
clrTimeline2 = FF000000 clrTimeline2 = FF000000
clrTimeline2Blending = 00000000 clrTimeline2Blending = 00000000
clrButtonRed = FFBB0000 clrButtonRed = FFBB0000
clrButtonRedBorder = FFBB0000 clrButtonRedBorder = FF000000
clrButtonGreen = FF00BB00 clrButtonGreen = FF00BB00
clrButtonGreenBorder = FF00BB00 clrButtonGreenBorder = FF000000
clrButtonYellow = FFBBBB00 clrButtonYellow = FFBBBB00
clrButtonYellowBorder = FFBBBB00 clrButtonYellowBorder = FF000000
clrButtonBlue = FF0000BB clrButtonBlue = FF0000BB
clrButtonBlueBorder = FF0000BB clrButtonBlueBorder = FF000000
clrRecMenuBackground = AA000000 clrRecMenuBackground = AA000000
clrRecMenuTimerConflictBackground = FFCCCCCC clrRecMenuTimerConflictBackground = FFCCCCCC
clrRecMenuTimerConflictBar = FF222222 clrRecMenuTimerConflictBar = FF222222

18
tools.c
View File

@ -5,6 +5,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <vdr/osd.h>
#include "tools.h" #include "tools.h"
@ -51,6 +52,23 @@ std::string StrToLowerCase(std::string str) {
return lowerCase; return lowerCase;
} }
void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor) {
if( height > 2*radius) {
p->DrawEllipse(cRect(posX, posY, radius, radius), borderColor, -2);
p->DrawEllipse(cRect(posX - borderWidth, posY - borderWidth, radius, radius), clrTransparent, -2);
p->DrawEllipse(cRect(posX+width - radius, posY, radius, radius), borderColor, -1);
p->DrawEllipse(cRect(posX+width - radius + borderWidth, posY - borderWidth, radius, radius), clrTransparent, -1);
p->DrawEllipse(cRect(posX, posY + height - radius, radius, radius), borderColor, -3);
p->DrawEllipse(cRect(posX - borderWidth, posY + height - radius + borderWidth, radius, radius), clrTransparent, -3);
p->DrawEllipse(cRect(posX + width - radius, posY + height - radius, radius, radius), borderColor, -4);
p->DrawEllipse(cRect(posX + width - radius + borderWidth, posY + height - radius + borderWidth, radius, radius), clrTransparent, -4);
}
}
/**************************************************************************************** /****************************************************************************************
* SPLTSTRING * SPLTSTRING
****************************************************************************************/ ****************************************************************************************/

View File

@ -7,6 +7,7 @@
std::string CutText(std::string text, int width, const cFont *font); std::string CutText(std::string text, int width, const cFont *font);
std::string StrToLowerCase(std::string str); std::string StrToLowerCase(std::string str);
void DrawRoundedCorners(cPixmap *p, int posX, int posY, int width, int height, int radius, int borderWidth, tColor borderColor);
class splitstring : public std::string { class splitstring : public std::string {
std::vector<std::string> flds; std::vector<std::string> flds;