Yang Junyao 201090191
Diff: N5110.cpp
- Revision:
- 33:d80e568a2e18
- Parent:
- 32:c9643726edca
- Child:
- 35:2d5931a66fba
--- a/N5110.cpp Thu Feb 16 15:41:00 2017 +0000 +++ b/N5110.cpp Thu Feb 16 15:58:48 2017 +0000 @@ -322,7 +322,7 @@ void N5110:: drawCircle(unsigned int const x0, unsigned int const y0, unsigned int const radius, - unsigned int const fill) + FillType const fill) { // from http://en.wikipedia.org/wiki/Midpoint_circle_algorithm int x = radius; @@ -332,7 +332,7 @@ while(x >= y) { // if transparent, just draw outline - if (fill == 0) { + if (fill == FILL_TRANSPARENT) { setPixel( x + x0, y + y0); setPixel(-x + x0, y + y0); setPixel( y + x0, x + y0); @@ -343,7 +343,7 @@ setPixel(-x + x0, -y + y0); } else { // drawing filled circle, so draw lines between points at same y value - int type = (fill==1) ? 1:0; // black or white fill + int type = (fill==FILL_BLACK) ? 1:0; // black or white fill drawLine(x+x0,y+y0,-x+x0,y+y0,type); drawLine(y+x0,x+y0,-y+x0,x+y0,type); @@ -418,15 +418,15 @@ unsigned int const y0, unsigned int const width, unsigned int const height, - unsigned int const fill) + FillType const fill) { - if (fill == 0) { // transparent, just outline + if (fill == FILL_TRANSPARENT) { // transparent, just outline drawLine(x0,y0,x0+(width-1),y0,1); // top drawLine(x0,y0+(height-1),x0+(width-1),y0+(height-1),1); // bottom drawLine(x0,y0,x0,y0+(height-1),1); // left drawLine(x0+(width-1),y0,x0+(width-1),y0+(height-1),1); // right } else { // filled rectangle - int type = (fill==1) ? 1:0; // black or white fill + int type = (fill==FILL_BLACK) ? 1:0; // black or white fill for (int y = y0; y<y0+height; y++) { // loop through rows of rectangle drawLine(x0,y,x0+(width-1),y,type); // draw line across screen }