Alpha operation specification structure
See below
The gf_alpha_t structure describes an alpha operation. This structure is passed as an argument to gf_context_set_alpha and gf_layer_set_blending.
Alpha operations typically involve two multipliers, M1 (applied to the source value) and M2 (applied to the destination value). These multipliers can come from:
For more information, see Layer alpha blending and Alpha and chroma in the Working with Layers, Surfaces, and Contexts chapter.
This structure contains at least the following members:
If neither M1 or M2 come from the alpha map (that is, neither GF_ALPHA_M1_MAP nor GF_ALPHA_M2_MAP is set in mode), this member is ignored.
These flags set the alpha blending operation. They are:
Alpha Blending multiplier origins:
Flag | Description |
---|---|
GF_ALPHA_M1_SRC_PIXEL_ALPHA | “M1” comes from the source pixel alpha component, for images only. For draw operations, M1 is 1. |
GF_ALPHA_M1_GLOBAL | “M1” comes from the global M1 |
GF_ALPHA_M1_MAP | “M1” comes from the Alpha map |
GF_ALPHA_M2_DST_PIXEL_ALPHA | “M2” comes from the destination pixels alpha component, for images only. For draw operations, M2 is 1. |
GF_ALPHA_M2_GLOBAL | “M2” comes from the global M2 |
GF_ALPHA_M2_MAP | “M2” comes from the alpha map |
Some combinations of multiplier origins are supported. When a combination is specified, the multiplier origin is the product of two origins. For example, GF_ALPHA_M1_SRC_PIXEL_ALPHA | GF_ALPHA_M1_GLOBAL means that “M1” comes from the source pixel alpha component multiplied by the global M1. The supported combinations are:
Alpha Blending Source Factor:
Flag | Description | OpenGL-ES Equivalent |
---|---|---|
GF_BLEND_SRC_0 | (0,0,0,0) | GL_ZERO |
GF_BLEND_SRC_M1 | (M1,M1,M1,M1) | GL_SRC_ALPHA |
GF_BLEND_SRC_1mM1 | (1-M1,1-M1,1-M1,1-M1) | GL_ONE_MINUS_SRC_ALPHA |
GF_BLEND_SRC_1mD | (1-M2,1-Rd,1-Gd,1-Bd) | GL_ONE_MINUS_DST_COLOR |
GF_BLEND_SRC_M2 | (M2,M2,M2,M2) | GL_DST_ALPHA |
GF_BLEND_SRC_D | (M2,Rd,Gd,Bd) | GL_DST_COLOR |
GF_BLEND_SRC_1 | (1,1,1,1) | GL_ONE |
GF_BLEND_SRC_1mM2 | (1-M2,1-M2,1-M2,1-M2) | GL_ONE_MINUS_DST_ALPHA |
Alpha Blending Destination Factor:
Flag | Description | OpenGL-ES Equivalent |
---|---|---|
GF_BLEND_DST_0 | (0,0,0,0) | GL_ZERO |
GF_BLEND_DST_M1 | (M1,M1,M1,M1) | GL_SRC_ALPHA |
GF_BLEND_DST_1mM1 | (1-M1,1-M1,1-M1,1-M1) | GL_ONE_MINUS_SRC_ALPHA |
GF_BLEND_DST_1mS | (1-M1,1-Rs,1-Gs,1-Bs) | GL_ONE_MINUS_SRC_COLOR |
GF_BLEND_DST_M2 | (M2,M2,M2,M2) | GL_DST_ALPHA |
GF_BLEND_DST_S | (M1,Rs,Gs,Bs) | GL_SRC_COLOR |
GF_BLEND_DST_1 | (1,1,1,1) | GL_ONE |
GF_BLEND_DST_1mM2 | (1-M2,1-M2,1-M2,1-M2) | GL_ONE_MINUS_DST_ALPHA |
QNX Graphics Framework
gf_context_set_alpha(), gf_layer_set_blending()