为什么将DES同步设置为我的画布上的false会改变颜色?

发布于 2025-01-24 13:35:30 字数 701 浏览 4 评论 0原文

我在乱七八糟的 noreflow noreferrer“>对于我的WebGL应用程序,我注意到设置desnynchronizedalpha一起执行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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文