wxWidgets 3.1
gcc 5.4 64bit
I draw a circle of color gradients with wxGraphicsPath,through many triangular way to draw; But the graphic of drawing has water ripples.
How to solve the problem of water ripples?
Code: Select all
wxGCDC &gdc = (wxGCDC&)dc;
wxGraphicsContext *gc = gdc.GetGraphicsContext();
wxGraphicsPath pth;
int angle = 1;
int num = 360;
int n = (int) num / angle;
for(int i=0; i< n; i+=1)
{
wxImage::RGBValue val = wxImage::HSVtoRGB(wxImage::HSVValue(float(i)/n, 1.0, 1.0));
wxColour bgcolour = wxColour(val.red, val.green, val.blue);
gc->SetBrush(wxBrush(bgcolour));
//gc->SetPen(wxPen(bgcolour));
pth = gc->CreatePath();
pth.MoveToPoint(pos.x, pos.y);
pth.AddLineToPoint(pos.x + radius*cos(i*angle*M_PI/180), pos.y+radius*sin(i*angle*M_PI/180));
pth.AddArc(wxPoint(pos.x, pos.y), radius, i*angle*M_PI/180, (i+1)*angle*M_PI/180,true);
pth.AddLineToPoint(pos.x + radius*cos((i+1)*angle*M_PI/180), pos.y+radius*sin((i+1)*angle*M_PI/180));
pth.CloseSubpath();
gc->FillPath(pth);
}