iOS - Brush that doesn't overlay itself

拜拜、爱过 提交于 2019-12-23 22:29:23

问题


When you draw by a brush in Photoshop it doesn't overlap itself until you release mouse button and press it again.

I found these images, that let me explain myself better. Now my drawing works the right way, but i want them to work like the left one.

If it's even possible I wish It wouldn't overlay itself even after user releases finger and start drawing again, but I'll go with basic photoshop-like brush.

I guess creating brush that never overlap itself is simmilar with creating an eraser, in some way, but i maybe wrong.

I need code examples in swift/obj-c.


回答1:


I am not sure why you tagged this as iOS, but try putting on a new layer!




回答2:


The main idea to achieve this is to track a CGPath for a finger painting and redraw the whole picture every time it changes.

So you create a CGPath and store it in memory. Then when user draws something you add this path to existing one and redraw the whole new combination of paths. This allows brush to always have constant opacity and overlay itself.



来源:https://stackoverflow.com/questions/25595927/ios-brush-that-doesnt-overlay-itself

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!