KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
144:ba002c4b21b3
Parent:
143:e872d65a710d
Child:
146:373d59f08357
--- a/RA8875.cpp	Sun Mar 19 22:11:04 2017 +0000
+++ b/RA8875.cpp	Sat May 06 20:14:48 2017 +0000
@@ -1406,6 +1406,31 @@
     return noerror;
 }
 
+
+RetCode_t RA8875::ThickLine(point_t p1, point_t p2, dim_t thickness, color_t color)
+{
+    if (thickness == 1) {
+        line(p1,p2, color);
+    } else {
+        int dx = abs(p2.x-p1.x), sx = p1.x<p2.x ? 1 : -1;
+        int dy = abs(p2.y-p1.y), sy = p1.y<p2.y ? 1 : -1;
+        int err = (dx>dy ? dx : -dy)/2, e2;
+        
+        for (;;) {
+            fillcircle(p1.x, p1.y, thickness/2, color);
+            if (p1.x==p2.x && p1.y==p2.y) 
+                break;
+            e2 = err;
+            if (e2 >-dx) 
+                { err -= dy; p1.x += sx; }
+            if (e2 < dy) 
+                { err += dx; p1.y += sy; }
+        }        
+    }
+    return noerror;
+}
+
+
 //
 // Rectangle functions all mostly helpers to the basic rectangle function
 //