aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-07-12 03:53:15 -0700
committerTectu <joel@unormal.org>2012-07-12 03:53:15 -0700
commit64d0175166ffcadf9f769b119236ebee6610d590 (patch)
treec78059d0fc63ba87303f8212b6d99bd62e7ce9b6
parent51f6f8411147dc117b17aa0e49713c02cc836cad (diff)
parent75fc51104a991e45f565a07eecd19e50b4cbd251 (diff)
downloaduGFX-64d0175166ffcadf9f769b119236ebee6610d590.tar.gz
uGFX-64d0175166ffcadf9f769b119236ebee6610d590.tar.bz2
uGFX-64d0175166ffcadf9f769b119236ebee6610d590.zip
Merge pull request #12 from dxli/master
added a filled option to lcdDrawEllipse
-rw-r--r--glcd.c15
-rw-r--r--glcd.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/glcd.c b/glcd.c
index 683f8a3a..51c62828 100644
--- a/glcd.c
+++ b/glcd.c
@@ -319,16 +319,21 @@ void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint
} while(a <= b);
}
-void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint16_t color) {
+void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint16_t color, uint8_t filled) {
int dx = 0, dy = b; /* im I. Quadranten von links oben nach rechts unten */
long a2 = a*a, b2 = b*b;
long err = b2-(2*b-1)*a2, e2; /* Fehler im 1. Schritt */
do {
- lcdDrawPixel(x+dx, y+dy, color); /* I. Quadrant */
- lcdDrawPixel(x-dx, y+dy, color); /* II. Quadrant */
- lcdDrawPixel(x-dx, y-dy, color); /* III. Quadrant */
- lcdDrawPixel(x+dx, y-dy, color); /* IV. Quadrant */
+ if(filled){
+ lcdDrawLine(x-dx,y+dy,x+dx,y+dy, color);
+ lcdDrawLine(x-dx,y-dy,x+dx,y-dy, color);
+ }else{
+ lcdDrawPixel(x+dx, y+dy, color); /* I. Quadrant */
+ lcdDrawPixel(x-dx, y+dy, color); /* II. Quadrant */
+ lcdDrawPixel(x-dx, y-dy, color); /* III. Quadrant */
+ lcdDrawPixel(x+dx, y-dy, color); /* IV. Quadrant */
+ }
e2 = 2*err;
if(e2 < (2*dx+1)*b2) {
diff --git a/glcd.h b/glcd.h
index bb587253..e4a5d509 100644
--- a/glcd.h
+++ b/glcd.h
@@ -67,7 +67,7 @@ void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t co
void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color);
void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const char* str, font_t font, uint16_t fontColor, uint16_t bkColor);
void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color);
-void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint16_t color);
+void lcdDrawEllipse(uint16_t x, uint16_t y, uint16_t a, uint16_t b, uint16_t color, uint8_t filled);
/* Text Rendering Functions */
int lcdDrawChar(uint16_t cx, uint16_t cy, char c, font_t font, uint16_t color, uint16_t bkcolor, bool_t tpText);