mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-10 03:54:54 -06:00
Added implementation for Painter::DrawArc.
git-svn-id: svn://ultimatepp.org/upp/trunk@1456 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b89b94e30a
commit
53af28a208
1 changed files with 12 additions and 0 deletions
|
|
@ -128,6 +128,18 @@ void Painter::DrawPolyPolyPolygonOp(const Point *vertices, int vertex_count,
|
|||
|
||||
void Painter::DrawArcOp(const Rect& rc, Point start, Point end, int width, Color color)
|
||||
{
|
||||
if(rc.Width() <= 0 || rc.Height() <= 0)
|
||||
return;
|
||||
Sizef radius = Sizef(rc.Size()) / 2.0;
|
||||
Pointf center = Pointf(rc.TopLeft()) + radius;
|
||||
double ang1 = Bearing((Pointf(start) - center) / radius);
|
||||
double ang2 = Bearing((Pointf(end) - center) / radius);
|
||||
double sweep = ang1 - ang2;
|
||||
if(sweep <= 0)
|
||||
sweep += 2 * M_PI;
|
||||
Move(center.x + radius.cx * cos(ang1), center.y + radius.cy * sin(ang1));
|
||||
Arc(center, radius.cx, radius.cy, ang1, -sweep);
|
||||
Stroke(max(width, 0), color);
|
||||
}
|
||||
|
||||
void Painter::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue