我已经实现了uiBezier路径实现来绘制绘画笔画,就像这样
{
UIGraphicsBeginImageContext(self.tempDrawImage.bounds.size);
for ( NSDictionary *dict in pathsArray )
{
UIBezierPath *p ;
@try {
p = (UIBezierPath*)[dict objectForKey:@"path"];
}
@catch (NSException *exception) {
continue;
}
p.lineWidth = [[dict objectForKey:@"size"]floatValue];
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy);
[[UIColor colorWithRed:[[dict objectForKey:@"red"]floatValue]
green:[[dict objectForKey:@"green"]floatValue]
blue:[[dict objectForKey:@"blue"]floatValue]
alpha:[[dict objectForKey:@"alpha"]floatValue]] setStroke];
[p stroke];
}
[[UIColor colorWithRed:red green:green blue:blue alpha:opacity] setStroke];
if(isEraser) //When eraser selected, change color as clear
{
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeClear);
}
else
{
CGContextSetBlendMode(UIGraphicsGetCurrentContext(), kCGBlendModeCopy);
}
[bzierPath stroke];
self.tempDrawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
但我需要获取Bezier路径或PathsArray- Dict格式 from the existing image
是否可能..?
我需要将它用作我的应用程序的一部分。
我为照片编辑做了一个应用程序,
在原始图像中制作绘画笔画,在此我维护了Undo Redi Stack,
完成涂漆后,然后做了删除/切割涂装的操作,然后做同样的事情..所有这些操作都应该在撤消重做堆栈..