Blend Enumeration
XNA Game Studio 3.0
Defines color blending factors.
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
| Member name | Description | |
|---|---|---|
| Zero | Each component of the color is multiplied by (0, 0, 0, 0). | |
| One | Each component of the color is multiplied by (1, 1, 1, 1). | |
| SourceColor | Each component of the color is multiplied by the source color. This can be represented as (Rs, Gs, Bs, As), where R, G, B, and A respectively stand for the red, green, blue, and alpha source values. | |
| InverseSourceColor | Each component of the color is multiplied by the inverse of the source color. This can be represented as (1 − Rs, 1 − Gs, 1 − Bs, 1 − As) where R, G, B, and A respectively stand for the red, green, blue, and alpha destination values. | |
| SourceAlpha | Each component of the color is multiplied by the alpha value of the source. This can be represented as (As, As, As, As), where As is the alpha source value. | |
| InverseSourceAlpha | Each component of the color is multiplied by the inverse of the alpha value of the source. This can be represented as (1 − As, 1 − As, 1 − As, 1 − As), where As is the alpha destination value. | |
| DestinationAlpha | Each component of the color is multiplied by the alpha value of the destination. This can be represented as (Ad, Ad, Ad, Ad), where Ad is the destination alpha value. | |
| InverseDestinationAlpha | Each component of the color is multiplied by the inverse of the alpha value of the destination. This can be represented as (1 − Ad, 1 − Ad, 1 − Ad, 1 − Ad), where Ad is the alpha destination value. | |
| DestinationColor | Each component color is multiplied by the destination color. This can be represented as (Rd, Gd, Bd, Ad), where R, G, B, and A respectively stand for red, green, blue, and alpha destination values. | |
| InverseDestinationColor | Each component of the color is multiplied by the inverse of the destination color. This can be represented as (1 − Rd, 1 − Gd, 1 − Bd, 1 − Ad), where Rd, Gd, Bd, and Ad respectively stand for the red, green, blue, and alpha destination values. | |
| SourceAlphaSaturation | Each component of the color is multiplied by either the alpha of the source color, or the inverse of the alpha of the source color, whichever is greater. This can be represented as (f, f, f, 1), where f = min(A, 1 − Ad). | |
| BothInverseSourceAlpha | (Win32 only) Each component of the source color is multiplied by the inverse of the alpha of the source color, and each component of the destination color is multiplied by the alpha of the source color. This can be represented as (1 − As, 1 − As, 1 − As, 1 − As), with a destination blend factor of (As, As, As, As); the destination blend selection is overridden. This blend mode is supported only for the SourceBlend render state. | |
| BlendFactor | Each component of the color is multiplied by a constant set in BlendFactor. | |
| InverseBlendFactor | Each component of the color is multiplied by the inverse of a constant set in BlendFactor. This blend mode is supported only if SupportsBlendFactor is true in the SourceBlendCapabilities or DestinationBlendCapabilities properties. | |
| BothSourceAlpha | This mode is obsolete. The same effect can be achieved by setting the source and destination blend factors to SourceAlpha and InverseSourceAlpha in separate calls. |
The alpha value of a color controls its transparency. Enabling alpha blending with AlphaBlendEnable allows colors, materials, and textures on a surface to be blended with transparency onto another surface.
Alpha blending is determined by the SourceBlend and DestinationBlend properties. With the default BlendFunction, the source pixel times the SourceBlend is added to the destination pixel (the pixel on the back buffer) times the DestinationBlend to produce a color that is a blend of the two pixel colors. The BlendFunction determines the operation used on the outcome of the source blend and destination blend components.