在CoreGraphics绘图中,如何避免重叠点比线的其余部分更暗? [英] In CoreGraphics drawing how can I keep the point of overlap from being darker than the rest of the line?

查看:85
本文介绍了在CoreGraphics绘图中,如何避免重叠点比线的其余部分更暗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用核心图形进行自定义手指画图.我允许用户更改线条的Alpha,并且在移动的触摸上会不断绘制新的线条.当我使Alpha低于1.0时,重叠点比该行的其余部分更暗.我知道为什么会发生这种情况,但是如何才能阻止这种情况发生?

My app uses core graphics for custom finger paint drawing. I allow the user to change the alpha of the line and a new line is continuously drawn on touches moved. When I make the alpha lower than 1.0 the point of overlap is darker than the rest of the line. I know why this occurs but how can I stop this?

推荐答案

我想您希望单个笔触不要使其自身变暗,而仍要使以前的笔触变暗(这就是大多数绘画应用程序的工作方式).

I suppose you want a single stroke not to darken itself, but still to darken previous strokes (that's how most painting apps work).

要执行此操作,您需要两个视图/缓冲区,一个用于当前背景",一个用于当前笔划.松开手指时将后者与背景合并.

For this to work, you need two views/buffers, one for the 'current background' and one for the current stroke. Merge the latter with the background when the finger is released.

在当前的笔划缓冲区中始终使用alpha 1进行绘制,但是将其显示并与较低的alpha合并.

You always draw with alpha 1 in the current stroke buffer, but you display and merge it with a lower alpha.

这篇关于在CoreGraphics绘图中,如何避免重叠点比线的其余部分更暗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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