32
7+$G\KGT2CVJ %NCUU 4GHGTGPEG

UIBezierPath Class

Embed Size (px)

Citation preview

Page 1: UIBezierPath Class
Page 2: UIBezierPath Class
Page 3: UIBezierPath Class
Page 4: UIBezierPath Class
Page 5: UIBezierPath Class

UIBezierPath

UIBezierPath

moveToPoint:

Page 6: UIBezierPath Class

closePath

moveToPoint:

UIBezierPath

stroke fill stroke

fill

UIColor

addClip

+ bezierPath

UIBezierPath

+ bezierPathWithRect:

UIBezierPath

+ bezierPathWithOvalInRect:

UIBezierPath

+ bezierPathWithRoundedRect:cornerRadius:

UIBezierPath

+ bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:

UIBezierPath

+ bezierPathWithArcCenter:radius:startAngle:endAngle:clockwise:

UIBezierPath

Page 7: UIBezierPath Class

+ bezierPathWithCGPath:

UIBezierPath

– moveToPoint:

– addLineToPoint:

– addArcWithCenter:radius:startAngle:endAngle:clockwise:

– addCurveToPoint:controlPoint1:controlPoint2:

– addQuadCurveToPoint:controlPoint:

– closePath

– removeAllPoints

– appendPath:

CGPath

currentPoint

lineWidth

lineCapStyle

lineJoinStyle

Page 8: UIBezierPath Class

miterLimit

flatness

usesEvenOddFillRule

– setLineDash:count:phase:

– getLineDash:count:phase:

– fill

– fillWithBlendMode:alpha:

– stroke

– strokeWithBlendMode:alpha:

– addClip

– containsPoint:

Page 9: UIBezierPath Class

empty

bounds

– applyTransform:

@property(nonatomic, readonly) CGRect bounds

UIBezierPath.h

@property(nonatomic) CGPathRef CGPath

UIBezierPath

Page 10: UIBezierPath Class

UIBezierPath.h

@property(nonatomic, readonly) CGPoint currentPoint

CGPointZero

@property empty

UIBezierPath.h

@property(readonly, getter=isEmpty) BOOL empty

moveToPoint:

UIBezierPath.h

Page 11: UIBezierPath Class

@property(nonatomic) CGFloat flatness

0.6

UIBezierPath.h

@property(nonatomic) CGLineCap lineCapStyle

kCGLineCapButt

UIBezierPath.h

Page 12: UIBezierPath Class

@property(nonatomic) CGLineJoin lineJoinStyle

kCGLineJoinMiter

UIBezierPath.h

@property(nonatomic) CGFloat lineWidth

UIBezierPath.h

Page 13: UIBezierPath Class

@property(nonatomic) CGFloat miterLimit

kCGLineJoinMiter

UIBezierPath.h

@property(nonatomic) BOOL usesEvenOddFillRule

YES NO

NO

UIBezierPath.h

Page 14: UIBezierPath Class

UIBezierPath

+ (UIBezierPath *)bezierPath

UIBezierPath.h

UIBezierPath

+ (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius

startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise

center

radius

startAngle

endAngle

clockwise

Page 15: UIBezierPath Class

0 π clockwise

YES

clockwise NO

32

0, 2

2

UIBezierPath.h

UIBezierPath

+ (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath

CGPath

nil

Page 16: UIBezierPath Class

UIBezierPath.h

UIBezierPath

+ (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect

rect

rect

UIBezierPath.h

UIBezierPath

+ (UIBezierPath *)bezierPathWithRect:(CGRect)rect

rect

Page 17: UIBezierPath Class

rect

UIBezierPath.h

UIBezierPath

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect

byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii

rect

corners

cornerRadii

UIBezierPath.h

Page 18: UIBezierPath Class

UIBezierPath

+ (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect

cornerRadius:(CGFloat)cornerRadius

rect

cornerRadius

0

UIBezierPath.h

- (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius

startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise

center

radius

Page 19: UIBezierPath Class

startAngle

endAngle

clockwise

0 π

clockwise YES

clockwise NO

UIBezierPath.h

- (void)addClip

CGContextSaveGState

CGContextRestoreGState

usesEvenOddFillRule

Page 20: UIBezierPath Class

UIBezierPath.h

- (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1

controlPoint2:(CGPoint)controlPoint2

endPoint

controlPoint1

controlPoint2

endPoint

Start point Control point 2

Endpoint

Control point 1

Page 21: UIBezierPath Class

moveToPoint:

point

UIBezierPath.h

- (void)addLineToPoint:(CGPoint)point

point

point

point

moveToPoint:

UIBezierPath.h

- (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint

endPoint

Page 22: UIBezierPath Class

controlPoint

endPoint

A Current point

B Control point

C Endpoint A Current point

B Control point

C Endpoint

moveToPoint:

point

UIBezierPath.h

- (void)appendPath:(UIBezierPath *)bezierPath

bezierPath

Page 23: UIBezierPath Class

bezierPath

bezierPath

UIBezierPath.h

- (void)applyTransform:(CGAffineTransform)transform

transform

UIBezierPath.h

- (void)closePath

Page 24: UIBezierPath Class

UIBezierPath.h

- (BOOL)containsPoint:(CGPoint)point

point

YES NO

usesEvenOddFillRule

closePath

UIBezierPath.h

- (void)fill

Page 25: UIBezierPath Class

UIBezierPath.h

- (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha

blendMode

alpha

0.0

1.0 0.0 1.0

Page 26: UIBezierPath Class

UIBezierPath.h

- (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase

pattern

nil

count

nil

pattern

phase

nil

pattern

pattern count

UIBezierPath.h

Page 27: UIBezierPath Class

- (void)moveToPoint:(CGPoint)point

point

point

UIBezierPath.h

- (void)removeAllPoints

UIBezierPath.h

- (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count

phase:(CGFloat)phase

Page 28: UIBezierPath Class

pattern

count

pattern

phase

6

UIBezierPath.h

- (void)stroke

UIBezierPath.h

Page 29: UIBezierPath Class

- (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha

blendMode

alpha

0.0

1.0 0.0 1.0

UIBezierPath.h

Page 30: UIBezierPath Class

enum {

UIRectCornerTopLeft = 1 << 0,

UIRectCornerTopRight = 1 << 1,

UIRectCornerBottomLeft = 1 << 2,

UIRectCornerBottomRight = 1 << 3,

UIRectCornerAllCorners = ~0

};

typedef NSUInteger UIRectCorner;

UIRectCornerTopLeft

UIBezierPath.h

UIRectCornerTopRight

UIBezierPath.h

UIRectCornerBottomLeft

UIBezierPath.h

UIRectCornerBottomRight

UIBezierPath.h

UIRectCornerAllCorners

UIBezierPath.h

Page 31: UIBezierPath Class
Page 32: UIBezierPath Class