如何用png-brush和UIBezierPath擦除一块UIImageView
我有两个UIImageView,第一个上面第二个。 我想用画笔擦除第一张图片(画笔是带有软边的png图片),使第二张图片可见。
我这样做了:
1) touchesMoved和[self setNeedsDisplayInRect:[self brushRectForPoint:touch_location]];
2)at (void)drawRect:(CGRect)rect我打电话[_brush drawAtPoint:touch_location blendMode:kCGBlendModeDestinationOut alpha:1];
它工作正常,但触摸频率移动不够,如果用户移动手指太快,那么我得到很多短线(或甚至点),而不是一个长线。
我发现UIBezierPath的信息和例子,但作者只是通过path绘制线条:
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextAddPath(context, path); CGContextSetLineCap(context, kCGLineCapRound); CGContextSetLineWidth(context, self.lineWidth); CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); CGContextStrokePath(context);
如何用UIBezierPath绘制我的PNG画笔?
我需要这样的东西
非常感谢!
有一个开源项目,这将是有用的你.. iOS-Scratch-N-See 。 类ImageMaskView
将是有趣的研究。
希望有所帮助!