-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNSBezierPath+Segment.m
38 lines (33 loc) · 1.4 KB
/
NSBezierPath+Segment.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Copyright (C) 1996 Dave Vasilevsky
* This file is licensed under the GNU General Public License,
* see the file Copying.txt for details. */
#import "NSBezierPath+Segment.h"
#import "FLPolar.h"
@implementation NSBezierPath (Segment)
+ (NSBezierPath*) circleSegmentWithCenter: (NSPoint)center
startAngle: (float)a1
endAngle: (float)a2
smallRadius: (float)r1
bigRadius: (float)r2
{
NSBezierPath *bp = [NSBezierPath bezierPath];
[bp moveToPoint: [FLPolar pointWithPolarCenter: center
radius: r1
angle: a1]];
[bp appendBezierPathWithArcWithCenter: center
radius: r1
startAngle: a1
endAngle: a2
clockwise: NO];
[bp lineToPoint: [FLPolar pointWithPolarCenter: center
radius: r2
angle: a2]];
[bp appendBezierPathWithArcWithCenter: center
radius: r2
startAngle: a2
endAngle: a1
clockwise: YES];
[bp closePath];
return bp;
}
@end