为什么将DES同步设置为我的画布上的false会改变颜色?
我在乱七八糟的 noreflow noreferrer“>对于我的WebGL应用程序,我注意到设置desnynchronized
与alpha
一起执行alpha
在执行getContext()
时,例如:
const canvasContext = canvasElem.getContext("webgl2", {
alpha: false,
desynchronized: true
});
更改颜色与我设置的颜色完全一样。
也就是说,如果我尝试使用颜色##ff0000
绘制,它将完全绘制。对我来说,将alpha
设置为false会发生这种情况,这是有意义的,因为它可以防止与页面的背景融合(或帆布后面的其他任何内容),而是设置alpha
。一个人似乎并没有引起这种效果。
相反,您必须拥有两者才能使画布颜色与页面背景融合在一起。我很好奇为什么这是。
I was messing around with the available canvas context flags for my WebGL application, and I noticed that setting desynchronized
to true along with alpha
to false when performing getContext()
, like this:
const canvasContext = canvasElem.getContext("webgl2", {
alpha: false,
desynchronized: true
});
Changes the colors to be exactly as I set them.
That is, if I try to draw with the color #FF0000
, it will draw exactly that. It makes sense to me why this would occur with setting alpha
to false, because it prevents blending with the page's background (or whatever else is behind the canvas), but setting alpha
alone doesn't seem to cause this effect.
Rather, you must have both in order for the canvas colors to not blend with the background of the page. I'm curious why this is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论