I tried some code to calculate control points between start and end point of bezier path with touch move , add lines to bezier path and fill with colour to give flat pen effect like Instagram but unable to get smooth curved lines with fast finger move.
from the below code I am able to get angled lines not smooth like instagram in image
if (_bezierPath == nil || _brushType == BrushTypeNeon) {
_bezierPath = [UIBezierPath new];
}
[_bezierPath moveToPoint:(CGPoint){self.controlPoint1.x + self.startWidth/2, self.controlPoint1.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.startPoint.x + self.startWidth/2, self.startPoint.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.startPoint.x - self.startWidth/2, self.startPoint.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint1.x - self.startWidth/2, self.controlPoint1.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint1.x + self.startWidth/2, self.controlPoint1.y - self.startWidth/2}];
[_bezierPath moveToPoint:(CGPoint){self.controlPoint2.x + self.startWidth/2, self.controlPoint2.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint1.x + self.startWidth/2, self.controlPoint1.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint1.x - self.startWidth/2, self.controlPoint1.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint2.x - self.startWidth/2, self.controlPoint2.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint2.x + self.startWidth/2, self.controlPoint2.y - self.startWidth/2}];
[_bezierPath moveToPoint:(CGPoint){self.endPoint.x + self.startWidth/2, self.endPoint.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint2.x + self.startWidth/2, self.controlPoint2.y - self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.controlPoint2.x - self.startWidth/2, self.controlPoint2.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.endPoint.x - self.startWidth/2, self.endPoint.y + self.startWidth/2}];
[_bezierPath addLineToPoint:(CGPoint){self.endPoint.x + self.startWidth/2, self.endPoint.y - self.startWidth/2}];
_bezierPath.lineCapStyle = kCGLineCapRound;
_bezierPath.lineJoinStyle = kCGLineJoinRound;
_bezierPath.lineWidth = self.startWidth;
_bezierPath.flatness = 0.3;
[self.strokeColor set];
[_bezierPath fillWithBlendMode:kCGBlendModeNormal alpha:1.f];
I expect a smooth curved flat nib pen effect like instagram with touch move.like this
thanks for attention please mention if any suggestion or sample code :)