ebarellar/LFColoringBook

LastDrawnPoint in Stroke class draw twice

Closed this issue · 1 comments

I found that it was drawn twice in the drawSinceLastIn func. It's look like this when I use a translucent stroke color. I thought of a solution is not to draw from the last point, but to redraw the entire stroke path every time. I think to use context saveGState and restoreGState to impletement.

截屏2021-05-25 下午6 35 38

The drawing engine was never expected to support opacity, drawing only the newest points is done to increase performance. I should have disabled the opacity selection in the color picker

Drawing the whole stroke in a temporary layer, or better yet, change the blending mode and keep the same routine of drawing only the points needed might work. But I've only made it work by allowing a maximum opacity in each stroke

I know some brushes in Photoshop, Procreate, behave that way, but I suspect that users might expect the more common "accumulation" to happen, the translucency is lost the more you paint over it. I've only made it work with this approach
https://losingfight.com/blog/2007/08/18/how-to-implement-a-basic-bitmap-brush/

In Core Graphics, I don't like the redrawing performance I have gotten, I have actually implemented something semi-decent in Metal for one of my apps (Drawing Proportions), but I'm not using it here lol. I pretend this project to remain more "didactic", using Metal will just make it more confusing. I might open source that drawing engine some day...