Harley-xk / MaLiang

iOS painting and drawing library based on Metal. 神笔马良有一支神笔(基于 Metal 的涂鸦绘图库)
MIT License
1.47k stars 208 forks source link

Glowing brush is not smooth for zig-zag line #132

Open HeraBlockchain opened 2 years ago

HeraBlockchain commented 2 years ago

When drawing a zig-zag line using glowing brush, it was not smooth enough.

If I modify "makeLine" method like this way in "GlowingBrush.swift", it will give a smooth glowing line

    public override func makeLine(from: CGPoint, to: CGPoint, force: CGFloat? = nil, uniqueColor: Bool = false) -> [MLLine] {
        let shadowLines = super.makeLine(from: from, to: to, force: force)
        var coreLines: [MLLine] = []
        let lines = subBrush.makeLine(from: from, to: to, force: force, uniqueColor: true)
        pendingCoreLines.append(contentsOf: lines)
        coreLines.append(contentsOf: pendingCoreLines)
        return shadowLines + coreLines
    }
Screenshot_2022-07-03_at_1_35_57_PM