rgb_premult - chung-leong/qb GitHub Wiki

rgb_premult - Perform pre-multiplication on RGBA values

float[4] rgb_premult( float[4] $pixel )

rgb_premult() multiplies the red, blue, and green values of a pixel by its alpha value.

rgb_demult() performs the reverse operation.

Parameters:

pixel - The RGBA values to convert. It can be a single four-element array or an array of such arrays.

Return Value:

An array containing the pre-multiplied RGBA values. The return value will have the same length as pixel.

Version

1.4 and above.