2017-06-12 89 views
-2

我用户CGBlendModClear绘制背景视图顶部的平滑视图。osx橡皮擦滑动背景

let rep = viewToCapture.bitmapImageRepForCachingDisplayInRect(viewToCapture.bounds)! 
viewToCapture.cacheDisplayInRect(viewToCapture.bounds, toBitmapImageRep: rep)   
let img = LmImage(size: viewToCapture.bounds.size) 
img.addRepresentation(rep) 

面积橡皮擦swipped是黑色

+0

有一个问题? – SteveFest

+0

我希望快照上的橡皮擦路径是透明的 –

+0

请将它放在帖子中。 – SteveFest

回答

0

橡皮擦路径代码

CGContextSetLineCap(context, CGLineCap.Round) 
    CGContextSetBlendMode(context, .Clear) 
    CGContextSetLineWidth(context, self.strokeWeight) 
    CGContextStrokePath(context) 

CompositeView中的快照 enter image description here

我想要的结果是 enter image description here