My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
#import <AppKit/NSFont.h>

@class NSAffineTransform;

typedef enum {
NSMoveToBezierPathElement,
NSLineToBezierPathElement,
NSCurveToBezierPathElement,
NSClosePathBezierPathElement,
} NSBezierPathElement;

typedef enum {
NSMiterLineJoinStyle,
NSRoundLineJoinStyle,
NSBevelLineJoinStyle,
} NSLineJoinStyle;

typedef enum {
NSButtLineCapStyle,
NSRoundLineCapStyle,
NSSquareLineCapStyle,
} NSLineCapStyle;

typedef enum {
NSNonZeroWindingRule,
NSEvenOddWindingRule,
} NSWindingRule;

@interface NSBezierPath : NSObject <NSCopying> {
NSUInteger _capacityOfElements;
NSUInteger _numberOfElements;
NSUInteger _capacityOfPoints;
NSUInteger _numberOfPoints;
uint8_t *_elements;
CGPoint *_points;

float _lineWidth;
float _miterLimit;
float _flatness;
NSWindingRule _windingRule;
NSLineCapStyle _lineCapStyle;
NSLineJoinStyle _lineJoinStyle;
int _dashCount;
float *_dashes;
float _dashPhase;
unsigned _cachesPath:1;
unsigned _lineWidthIsDefault:1;
unsigned _miterLimitIsDefault:1;
unsigned _flatnessIsDefault:1;
unsigned _windingRuleIsDefault:1;
unsigned _lineCapStyleIsDefault:1;
unsigned _lineJoinStyleIsDefault:1;
}

+(NSBezierPath *)bezierPath;
+(NSBezierPath *)bezierPathWithOvalInRect:(NSRect)rect;
+(NSBezierPath *)bezierPathWithRect:(NSRect)rect;
+(NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect xRadius:(CGFloat)xRadius yRadius:(CGFloat)yRadius;


+(float)defaultLineWidth;
+(float)defaultMiterLimit;
+(float)defaultFlatness;
+(NSWindingRule)defaultWindingRule;
+(NSLineCapStyle)defaultLineCapStyle;
+(NSLineJoinStyle)defaultLineJoinStyle;

+(void)setDefaultLineWidth:(float)width;
+(void)setDefaultMiterLimit:(float)limit;
+(void)setDefaultFlatness:(float)flatness;
+(void)setDefaultWindingRule:(NSWindingRule)rule;
+(void)setDefaultLineCapStyle:(NSLineCapStyle)style;
+(void)setDefaultLineJoinStyle:(NSLineJoinStyle)style;

+(void)fillRect:(NSRect)rect;
+(void)strokeRect:(NSRect)rect;
+(void)strokeLineFromPoint:(NSPoint)point toPoint:(NSPoint)point;
+(void)drawPackedGlyphs:(const char *)packed atPoint:(NSPoint)point;
+(void)clipRect:(NSRect)rect;

-(float)lineWidth;
-(float)miterLimit;
-(float)flatness;
-(NSWindingRule)windingRule;
-(NSLineCapStyle)lineCapStyle;
-(NSLineJoinStyle)lineJoinStyle;

-(void)getLineDash:(float *)dashes count:(int *)count phase:(float *)phase;

-(BOOL)cachesBezierPath;

-(int)elementCount;
-(NSBezierPathElement)elementAtIndex:(int)index;
-(NSBezierPathElement)elementAtIndex:(int)index associatedPoints:(NSPoint *)points;

-(void)setLineWidth:(float)width;
-(void)setMiterLimit:(float)limit;
-(void)setFlatness:(float)flatness;
-(void)setWindingRule:(NSWindingRule)rule;
-(void)setLineCapStyle:(NSLineCapStyle)style;
-(void)setLineJoinStyle:(NSLineJoinStyle)style;
-(void)setLineDash:(const float *)dashes count:(int)count phase:(float)phase;
-(void)setCachesBezierPath:(BOOL)flag;

-(BOOL)isEmpty;
-(NSRect)bounds;
-(NSRect)controlPointBounds;
-(BOOL)containsPoint:(NSPoint)point;
-(NSPoint)currentPoint;

-(void)moveToPoint:(NSPoint)point;
-(void)lineToPoint:(NSPoint)point;
-(void)curveToPoint:(NSPoint)point controlPoint1:(NSPoint)cp1 controlPoint2:(NSPoint)cp2;
-(void)closePath;
-(void)relativeMoveToPoint:(NSPoint)point;
-(void)relativeLineToPoint:(NSPoint)point;
-(void)relativeCurveToPoint:(NSPoint)point controlPoint1:(NSPoint)cp1 controlPoint2:(NSPoint)cp2;

-(void)appendBezierPathWithPoints:(NSPoint *)points count:(unsigned)count;
-(void)appendBezierPathWithRect:(NSRect)rect;
-(void)appendBezierPathWithOvalInRect:(NSRect)rect;
-(void)appendBezierPathWithArcFromPoint:(NSPoint)point toPoint:(NSPoint)toPoint radius:(float)radius;
-(void)appendBezierPathWithRoundedRect:(NSRect)rect xRadius:(CGFloat)radius yRadius:(CGFloat)yRadius;
-(void)appendBezierPathWithArcWithCenter:(NSPoint)center radius:(float)radius startAngle:(float)startAngle endAngle:(float)endAngle;
-(void)appendBezierPathWithArcWithCenter:(NSPoint)center radius:(float)radius startAngle:(float)startAngle endAngle:(float)endAngle clockwise:(BOOL)clockwise;
-(void)appendBezierPathWithGlyph:(NSGlyph)glyph inFont:(NSFont *)font;
-(void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs count:(unsigned)count inFont:(NSFont *)font;
-(void)appendBezierPathWithPackedGlyphs:(const char *)packed;
-(void)appendBezierPath:(NSBezierPath *)other;

-(void)transformUsingAffineTransform:(NSAffineTransform *)matrix;
-(void)removeAllPoints;
-(void)setAssociatedPoints:(NSPoint *)points atIndex:(int)index;

-(NSBezierPath *)bezierPathByFlatteningPath;
-(NSBezierPath *)bezierPathByReversingPath;

-(void)stroke;
-(void)fill;

-(void)addClip;
-(void)setClip;

@end

Change log

2e39bca6a421 by cocotron on Jun 16, 2009   Diff
 Issue #303  fix, missing method in
NSBezierPath header
Go to: 
Project members, sign in to write a code review

Older revisions

2d6b368bf021 by cocotron on Jun 4, 2009   Diff
- split CoreGraphics out into it's own
framework project. AppKit still embeds
CoreGraphics but it is also built
standalone on Foundation. (don't link
against both)
...
509c9004abcd by cocotron on Mar 25, 2009   Diff
- nil and Nil defined as 0 instead of
((Class)0) and ((id)0)
- FoundationErrors.h added
- NSFileManager string constants added
- CGColorSpaceRetain added
...
6022f02f24d2 by rolf.anroni on Jul 4, 2008   Diff
corrected spelling of NSBezierPath
relativeLineToPoint
All revisions of this file

File info

Size: 5934 bytes, 152 lines
Powered by Google Project Hosting