Skip to content

Function: compositeStraightRGBA() ​

ts
function compositeStraightRGBA(
   destination, 
   source, 
   blendMode?, 
   opacity?
): StraightRGBA;

Defined in: utils/rgbaCompositing.ts:99

Composite one straight-alpha source color over a straight-alpha destination.

normal and multiply use the W3C separable-blend/source-over equation. additive uses Porter-Duff plus-lighter: premultiplied source and destination channels and alpha are added and clamped. Layer opacity scales source alpha exactly once; it never scales straight RGB channels.

The returned tuple is straight alpha. Three.js NormalBlending subsequently writes its premultiplied equivalent to a transparent framebuffer or blends it source-over an opaque canvas clear color.

Parameters ​

destination ​

StraightRGBA

source ​

StraightRGBA

blendMode? ​

BlendMode = 'normal'

opacity? ​

number = 1

Returns ​

StraightRGBA

Released under the MIT License.