mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Rounded Corners for color buttons (Closes Ticket 1475)
This commit is contained in:
parent
c5af8c8017
commit
3e5aec2117
1
HISTORY
1
HISTORY
@ -93,3 +93,4 @@ Version 1.1.0
|
||||
- Fixed Bug 1484
|
||||
- Added Event Short Text (if available) to RecName (Closes Ticket 1490)
|
||||
- Fixed OSD Background Color (Closes Ticket 1474)
|
||||
- Rounded Corners for color buttons (Closes Ticket 1475)
|
||||
|
12
footer.c
12
footer.c
@ -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);
|
||||
footer->DrawRectangle(cRect(left, buttonY, geoManager.buttonWidth, geoManager.buttonHeight), borderColor);
|
||||
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) {
|
||||
cImage *button = imgCache.GetOsdElement(buttonType);
|
||||
if (button) {
|
||||
@ -109,7 +114,12 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, eOs
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
|
@ -18,13 +18,13 @@ clrTimeline1Blending = 00000000
|
||||
clrTimeline2 = FF000000
|
||||
clrTimeline2Blending = 00000000
|
||||
clrButtonRed = FFBB0000
|
||||
clrButtonRedBorder = FFBB0000
|
||||
clrButtonRedBorder = FF000000
|
||||
clrButtonGreen = FF00BB00
|
||||
clrButtonGreenBorder = FF00BB00
|
||||
clrButtonGreenBorder = FF000000
|
||||
clrButtonYellow = FFBBBB00
|
||||
clrButtonYellowBorder = FFBBBB00
|
||||
clrButtonYellowBorder = FF000000
|
||||
clrButtonBlue = FF0000BB
|
||||
clrButtonBlueBorder = FF0000BB
|
||||
clrButtonBlueBorder = FF000000
|
||||
clrRecMenuBackground = AA000000
|
||||
clrRecMenuTimerConflictBackground = FFCCCCCC
|
||||
clrRecMenuTimerConflictBar = FF222222
|
||||
|
18
tools.c
18
tools.c
@ -5,6 +5,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <vdr/osd.h>
|
||||
|
||||
#include "tools.h"
|
||||
|
||||
@ -51,6 +52,23 @@ std::string StrToLowerCase(std::string str) {
|
||||
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
|
||||
****************************************************************************************/
|
||||
|
1
tools.h
1
tools.h
@ -7,6 +7,7 @@
|
||||
|
||||
std::string CutText(std::string text, int width, const cFont *font);
|
||||
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 {
|
||||
std::vector<std::string> flds;
|
||||
|
Loading…
Reference in New Issue
Block a user