简体   繁体   English

Korge:位图“预乘”变量有什么作用?

[英]Korge: What does the bitmap `premultiplied` variable do?

In the Bitmap documentation, I noticed that there was this premultiplied variable in the bitmap.在位图文档中,我注意到位图中有这个premultiplied变量。 What does it mean and what does it do?它是什么意思,它有什么作用?

在此处输入图像描述

That property indicates how the Bitmap RGB (red, green, blue) components of each pixel are stored based on the alpha component.该属性指示如何根据 alpha 分量存储每个像素的位图 RGB(红、绿、蓝)分量。 This is typically named premultiplied alpha.这通常称为预乘 alpha。

premultiplied=true means that the RGB components are stored after being multiplied by the alpha component. premultiplied=true表示 RGB 分量乘以 alpha 分量后存储。 For example:例如:

StoredRGBA=R*A,G*A,B*A,A

while premultiplied=false :premultiplied=false

StoredRGBA=R,G,B,A

So this refers to how the storage should be interpreted regarding to the real components of each pixel.因此,这是指应如何根据每个像素的实际分量来解释存储。

Premultiplied alpha allows to perform blending operations much faster and in OpenGL it is typically required when the render buffer also has alpha.预乘 alpha 允许更快地执行混合操作,并且在 OpenGL 中,当渲染缓冲区也具有 alpha 时通常需要它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM