OLD | NEW |
1 // | 1 // |
2 // NSBezierPath+MCAdditions.m | 2 // NSBezierPath+MCAdditions.m |
3 // | 3 // |
4 // Created by Sean Patrick O'Brien on 4/1/08. | 4 // Created by Sean Patrick O'Brien on 4/1/08. |
5 // Copyright 2008 MolokoCacao. All rights reserved. | 5 // Copyright 2008 MolokoCacao. All rights reserved. |
6 // | 6 // |
7 | 7 |
8 #import "NSBezierPath+MCAdditions.h" | 8 #import "NSBezierPath+MCAdditions.h" |
9 | 9 |
10 #import "third_party/GTM/AppKit/GTMNSBezierPath+CGPath.h" | 10 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+CGPath.h" |
11 | 11 |
12 // remove/comment out this line of you don't want to use undocumented functions | 12 // remove/comment out this line of you don't want to use undocumented functions |
13 #define MCBEZIER_USE_PRIVATE_FUNCTION | 13 #define MCBEZIER_USE_PRIVATE_FUNCTION |
14 | 14 |
15 #ifdef MCBEZIER_USE_PRIVATE_FUNCTION | 15 #ifdef MCBEZIER_USE_PRIVATE_FUNCTION |
16 extern CGPathRef CGContextCopyPath(CGContextRef context); | 16 extern CGPathRef CGContextCopyPath(CGContextRef context); |
17 #endif | 17 #endif |
18 | 18 |
19 static void CGPathCallback(void *info, const CGPathElement *element) | 19 static void CGPathCallback(void *info, const CGPathElement *element) |
20 { | 20 { |
21 NSBezierPath *path = info; | 21 NSBezierPath *path = info; |
22 CGPoint *points = element->points; | 22 CGPoint *points = element->points; |
23 » | 23 |
24 switch (element->type) { | 24 switch (element->type) { |
25 case kCGPathElementMoveToPoint: | 25 case kCGPathElementMoveToPoint: |
26 { | 26 { |
27 [path moveToPoint:NSMakePoint(points[0].x, points[0].y)]
; | 27 [path moveToPoint:NSMakePoint(points[0].x, points[0].y)]
; |
28 break; | 28 break; |
29 } | 29 } |
30 case kCGPathElementAddLineToPoint: | 30 case kCGPathElementAddLineToPoint: |
31 { | 31 { |
32 [path lineToPoint:NSMakePoint(points[0].x, points[0].y)]
; | 32 [path lineToPoint:NSMakePoint(points[0].x, points[0].y)]
; |
33 break; | 33 break; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 /* Stroke the path. */ | 182 /* Stroke the path. */ |
183 [self stroke]; | 183 [self stroke]; |
184 | 184 |
185 /* Restore the previous graphics context. */ | 185 /* Restore the previous graphics context. */ |
186 [thisContext restoreGraphicsState]; | 186 [thisContext restoreGraphicsState]; |
187 [self setLineWidth:lineWidth]; | 187 [self setLineWidth:lineWidth]; |
188 } | 188 } |
189 | 189 |
190 @end | 190 @end |
OLD | NEW |