纹理刷(绘图应用)使用金属 [英] Texture Brush (Drawing Application ) Using Metal

查看:163
本文介绍了纹理刷(绘图应用)使用金属的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个金属支持的绘图应用程序,其中笔触在MTKView上通过纹理方块沿手指位置重复绘制。

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.

我用alpha 0.2绘制此图。当正方形重叠时,添加颜色。我怎么能用alpha 0.2绘制。

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.

推荐答案

我认为你需要将画笔方块绘制成单独的纹理,最初清除为透明,无需混合。然后使用混合将整个纹理绘制到视图中。

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.

如果您将画笔直接绘制到视图中,则它们将累积。绘制正方形1后,它是图像的一部分。金属再也无法将其与已存在的任何东西区分开来。因此,当你绘制正方形2重叠它时,它将与已经存在的东西混合,包括方形1。

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.

这篇关于纹理刷(绘图应用)使用金属的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆