2017-06-12 96 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