//在内存中画圆形 void CIconOperate::DrawCircle(int xc , int yc, int r ,bool isfill , DWORD c) { if(m_IconData == NULL || m_IconDir == NULL) return ; if (xc + r < 0 || xc - r >= m_IconDir->idEntries[0].bwidth || yc + r < 0 || yc - r >= m_IconDir->idEntries[0].bheight) return; int x = 0, y = r, yi, d; d = 3 - 2 * r; if (isfill) { // 如果填充(画实心圆) while (x <= y) { for (yi = x; yi <= y; yi ++) _draw_circle_8(xc, yc, x, yi, c); if (d < 0) { d = d + 4 * x + 6; } else { d = d + 4 * (x - y) + 10; y --; } x++; } } else { // 如果不填充(画空心圆) while (x <= y) { _draw_circle_8(xc, yc, x, y, c); if (d < 0) { d = d + 4 * x + 6; } else { d = d + 4 * (x - y) + 10; y --; } x ++; } } }
/****************************************************************** 函数名: gui_circle 作者: Anti_CDQ 日期: 2017-09-10 功能: 在指定位置画一个指定大小的圆(填充) 输入参数:(xc,yc) :圆中心坐标 c:填充的颜色 r:圆半径 fill:填充判断标志,1-填充,0-不填充 返回值: 无 修改记录:无 ******************************************************************/ void gui_circle(int xc, int yc,uint16_t c,int r, int fill) { int x = 0, y = r, yi, d; d = 3 - 2 * r; if (fill) // 如果填充(画实心圆) { while (x <= y) { for (yi = x; yi <= y; yi++) _draw_circle_8(xc, yc, x, yi, c); if (d < 0) { d = d + 4 * x + 6; } else { d = d + 4 * (x - y) + 10; y--; } x++; } } else // 如果不填充(画空心圆) { while (x <= y) { _draw_circle_8(xc, yc, x, y, c); if (d < 0) { d = d + 4 * x + 6; } else { d = d + 4 * (x - y) + 10; y--; } x++; } } }