I want to get the image from the UIBezierpath
closed path(See the image). I draw the image on the UIView
using drawRect
method and also draw the lines are using the drawRect
method.
How can I get the particular closed path image? Please help me. Thanks in advance.
This code used for draw the bezierpath.
UIBezierPath *aPath = [UIBezierPath bezierPath];
for (NSString *pointString in pointArray) {
if ([pointArray indexOfObject:pointString] == 0)
[aPath moveToPoint:CGPointFromString(pointString)];
else
[aPath addLineToPoint:CGPointFromString(pointString)];
}
[aPath closePath];
For Swift try this : ZImageCropper
ZImageCropper is using following things as core part:
iDev's answer is excellent, but if you need transparent background, then except
UIGraphicsBeginImageContext(view.bounds.size);
you should useBy default image context is created with opaque == YES, so you have to change it to NO.