mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Added a simple example demonstrating DrawArc.
git-svn-id: svn://ultimatepp.org/upp/trunk@1455 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9069bc3b8d
commit
e1f93a754e
2 changed files with 28 additions and 0 deletions
27
examples/PainterExamples/DrawArc.cpp
Normal file
27
examples/PainterExamples/DrawArc.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "Examples.h"
|
||||
|
||||
void DrawArc(Painter& sw)
|
||||
{
|
||||
Pointf center(350, 300);
|
||||
for(int i = 0; i < 12; i++) {
|
||||
double angle = (i - 3) * M_PI / 6;
|
||||
Pointf box_center = Polar(center, 250, angle);
|
||||
Size radius(60, 20);
|
||||
Rect box(Point(box_center), Size(1, 1));
|
||||
box.Inflate(radius);
|
||||
// sw.DrawRect(box, Yellow());
|
||||
for(int j = 0; j < 12; j++) {
|
||||
double ang2 = j * M_PI / 6;
|
||||
Sizef hand = Polar(Pointf(0, 0), 1, ang2);
|
||||
Point h1(box_center + Sizef(radius) * hand);
|
||||
Point h2(box_center + Sizef(radius) * 0.7 * hand);
|
||||
sw.DrawLine(h1, h2, 1, LtBlue());
|
||||
}
|
||||
Sizef hand = Polar(Pointf(0, 0), 1, angle);
|
||||
sw.DrawArc(box, Point(box_center + radius * hand), box.TopCenter(), 0, LtRed());
|
||||
}
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("DrawArc", DrawArc);
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ file
|
|||
ThinLine.cpp,
|
||||
Shapes.cpp,
|
||||
PolyPoly.cpp,
|
||||
DrawArc.cpp,
|
||||
Big.cpp,
|
||||
Examples.lay,
|
||||
Test.iml;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue