Texture Brush (Drawing Application ) Using Metal

杀马特。学长 韩版系。学妹 提交于 2019-12-30 07:49:43

问题


I am trying to implement a metal-backed drawing application where brushstrokes are drawn on an MTKView by textured square repeatedly along a finger position.

I am drawing this with alpha 0.2. When the squares are overlapped the color is added. How can I draw with alpha 0.2.


回答1:


I think you need to draw the brush squares to a separate texture, initially cleared to transparent, without blending. Then draw that whole texture to your view with blending.

If you draw the brush squares directly to the view, then they will accumulate. After you draw square 1, it's part of the image. Metal can no longer distinguish it from anything else that was already there. So, when you draw square 2 overlapping it, it will blend with what's already there, including square 1.



来源:https://stackoverflow.com/questions/52051341/texture-brush-drawing-application-using-metal

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