0

In the Bitmap documentation, I noticed that there was this premultiplied variable in the bitmap. What does it mean and what does it do?

enter image description here

xeno
  • 33
  • 4

1 Answers1

1

That property indicates how the Bitmap RGB (red, green, blue) components of each pixel are stored based on the alpha component. This is typically named premultiplied alpha.

premultiplied=true means that the RGB components are stored after being multiplied by the alpha component. For example:

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

while 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.

soywiz
  • 438
  • 3
  • 8