6.5.3.3.5 Alpha Blending

The general alpha blending equations are:

  1. Cd = Fs * Cs’ + Fd * Cd’
  2. Ad = Fs * As’’ + Fd * Ad’’

Where

  • Cs’ is the source color component (adjusted for NPM if necessary)
  • Cd’ is the destination color component (adjusted for NPM if necessary)
  • As’’ is the modified source alpha component
  • Ad’’ is the modified destination alpha component
  • Fs is fraction of the source that contributes to the final value
  • Fd is fraction of the destination that contributes to the final value

The blending is done in four logical stages (not real implementation stages):

  1. Transparent/opaque conversion

    The incoming alpha (source or destination independently) can be inverted if needed to match the internal alpha rule. Internally, an alpha of 0 means transparent, while an alpha of “0xFF” means opaque. External content might follow the opposite rule. The output of the block is either As (Ad for destination) or 1-As (1-Ad for destination).

  2. Global value substitution

    A global alpha value from a register can be used to substitute or scaled the incoming alpha. An incoming alpha As can pass-through, be directly substituted by Ags (global alpha) or scaled by the global alpha value (As * Ags). The source and destination have distinct global alpha values.

  3. Blending factor generation

    The blending factors are generated (refer to table below). Each alpha can take the values 0, 1, A or 1-A depending on the blending mode.

  4. Final blending

    This final stage implements the operations described by equations (1) and (2),

The different stages are illustrated in the following figure.

Figure 6-50. Alpha Blender for One Pixel

The fractions take the values described in the following table, depending on the blending mode.

Table 6-85. Blending Modes Fractions
Blending ModeFsFd
Clear00
SRC10
DST01
SRC_OVER11 – As’’
DST_OVER1 – Ad’’1
SRC_INAd’’0
DST_IN0As’’
SRC_OUT1 – Ad’’0
DST_OUT01 – As’’
SRC_ATOPAd’’1 – As’’
DST_ATOP1 – Ad’’As’’
XOR1 – Ad’’1 – As’’

The register fields that control the blending modes are:

  • 1 bit for transparent/opaque conversion for source alpha
  • 1 bit for transparent/opaque conversion for destination alpha
  • 2 bits for source alpha modifications, to specify the 3 cases (As, Ags, As*Ags)
  • 2 bits for destination alpha modifications, to specify the 3 cases (Ad, Agd, Ad*Agd)
  • 4 bits to select between the 12 blending modes
  • 8 bits for global source alpha
  • 8 bits for global destination alpha

Alpha blending is supported on bit blit and filter blit primitives.