From 3e5aec21172907f897ab68abfd2e22fc57e587c0 Mon Sep 17 00:00:00 2001
From: louis <louis.braun@gmx.de>
Date: Fri, 27 Dec 2013 17:06:49 +0100
Subject: Rounded Corners for color buttons (Closes Ticket 1475)

---
 tools.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

(limited to 'tools.c')

diff --git a/tools.c b/tools.c
index 92fb4a8..d22f6b0 100644
--- a/tools.c
+++ b/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
 ****************************************************************************************/
-- 
cgit v1.2.3