Vic*_*r.V 6 drawing brush paint ios uigraphicscontext
我正在开发具有画笔工具的应用程序。我需要像 Instagram 一样创建画笔
.
目前我正在使用阴影来创建这种发光效果。但是我不能设置这样的阴影效果。
let startPoint = convertToOutput(firstPoint), endPoint = convertToOutput(secondPoint)
UIGraphicsBeginImageContextWithOptions(self.outputCanvasSize, false, 1.0)
let context = UIGraphicsGetCurrentContext()
context?.setFillColor(color.cgColor)
context?.setStrokeColor(color.cgColor)
context?.setShadow(offset: CGSize(width:0, height: 0), blur: 20, color: color.cgColor)
context?.setLineJoin(.round)
context?.setLineCap(.round)
context?.setLineWidth(brush.radius * 2)
context?.move(to: startPoint)
context?.addLine(to: endPoint)
context?.drawPath(using: .stroke)
glowOverlayCanvas.image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
Run Code Online (Sandbox Code Playgroud)
所以我使用下一个算法绘制这样的画笔:
我有混合模式的问题,因为如果我使用 .normal,平滑效果就会消失 - alpha 通道累积(很少有圆圈交叉)
如何实现以下混合模式
Rrgb = Srgb
Ra = MAX(Da, Sa)
| 归档时间: |
|
| 查看次数: |
551 次 |
| 最近记录: |