Adobe® AIR® API Reference for HTML Developers
Home  |  Hide Classes List |  Index  |  Appendixes

Language Reference only       
Context3DBlendFactor 
window.runtime propertywindow.runtime.flash.display3D.Context3DBlendFactor
InheritanceContext3DBlendFactor Inheritance Object

Runtime Versions:  3

Defines the values to use for specifying the source and destination blend factors.

A blend factor represents a particular four-value vector that is multiplied with the source or destination color in the blending formula. The blending formula is:

result = source × sourceFactor + destination × destinationFactor

In the formula, the source color is the output color of the pixel shader program. The destination color is the color that currently exists in the color buffer, as set by previous clear and draw operations.

For example, if the source color is (.6, .6, .6, .4) and the source blend factor is Context3DBlendFactor.ONE_MINUS_SOURCE_ALPHA, then the source part of the blending equation is calculated as:

(.6, .6, .6, .4) × (1-0.4, 1-0.4, 1-0.4, 1-0.4) = (.36, .36, .36, .24)

The final calculation is clamped to the range [0,1].

Examples

The following examples demonstrate the blending math using source color = (.6,.4,.2,.4), destination color = (.8,.8,.8,.5), and various blend factors.

PurposeSource factorDestination factorBlend formulaResult
No blendingONEZERO(.6,.4,.2,.4) * ( 1, 1, 1, 1) + (.8,.8,.8,.5) * ( 0, 0, 0, 0)( .6, .4, .2, .4)
AlphaSOURCE_ALPHAONE_MINUS_SOURCE_ALPHA(.6,.4,.2,.4) * (.4,.4,.4,.4) + (.8,.8,.8,.5) * (.6,.6,.6,.6)(.72,.64,.56,.46)
AdditiveONEONE(.6,.4,.2,.4) * ( 1, 1, 1, 1) + (.8,.8,.8,.5) * ( 1, 1, 1, 1)( 1, 1, 1, .9)
MultiplyDESTINATION_COLORZERO(.6,.4,.2,.4) * (.8,.8,.8,.5) + (.8,.8,.8,.5) * ( 0, 0, 0, 0)(.48,.32,.16, .2)
ScreenONEONE_MINUS_SOURCE_COLOR(.6,.4,.2,.4) * ( 1, 1, 1, 1) + (.8,.8,.8,.5) * (.4,.6,.8,.6)(.92,.88,.68, .7)

Note that not all combinations of blend factors are useful and that you can sometimes achieve the same effect in different ways.

See also



Properties
 PropertyDefined By
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Public Methods
 MethodDefined By
 Inherited
hasOwnProperty(name:String):Boolean
Indicates whether an object has a specified property defined.
Object
 Inherited
isPrototypeOf(theClass:Object):Boolean
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
toLocaleString():String
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
toString():String
Returns the string representation of the specified object.
Object
 Inherited
valueOf():Object
Returns the primitive value of the specified object.
Object
Constants
 ConstantDefined By
  DESTINATION_ALPHA : String = "destinationAlpha"
[static] The blend factor is (Da,Da,Da,Da), where Da is the alpha component of the fragment color computed by the pixel program.
Context3DBlendFactor
  DESTINATION_COLOR : String = "destinationColor"
[static] The blend factor is (Dr,Dg,Db,Da), where Dr/g/b/a is the corresponding component of the current color in the color buffer.
Context3DBlendFactor
  ONE : String = "one"
[static] The blend factor is (1,1,1,1).
Context3DBlendFactor
  ONE_MINUS_DESTINATION_ALPHA : String = "oneMinusDestinationAlpha"
[static] The blend factor is (1-Da,1-Da,1-Da,1-Da), where Da is the alpha component of the current color in the color buffer.
Context3DBlendFactor
  ONE_MINUS_DESTINATION_COLOR : String = "oneMinusDestinationColor"
[static] The blend factor is (1-Dr,1-Dg,1-Db,1-Da), where Dr/g/b/a is the corresponding component of the current color in the color buffer.
Context3DBlendFactor
  ONE_MINUS_SOURCE_ALPHA : String = "oneMinusSourceAlpha"
[static] The blend factor is (1-Sa,1-Sa,1-Sa,1-Sa), where Sa is the alpha component of the fragment color computed by the pixel program.
Context3DBlendFactor
  ONE_MINUS_SOURCE_COLOR : String = "oneMinusSourceColor"
[static] The blend factor is (1-Sr,1-Sg,1-Sb,1-Sa), where Sr/g/b/a is the corresponding component of the fragment color computed by the pixel program.
Context3DBlendFactor
  SOURCE_ALPHA : String = "sourceAlpha"
[static] The blend factor is (Sa,Sa,Sa,Sa), where Sa is the alpha component of the fragment color computed by the pixel program.
Context3DBlendFactor
  SOURCE_COLOR : String = "sourceColor"
[static] The blend factor is (Sr,Sg,Sb,Sa), where Sr/g/b/a is the corresponding component of the fragment color computed by the pixel program.
Context3DBlendFactor
  ZERO : String = "zero"
[static] The blend factor is (0,0,0,0).
Context3DBlendFactor
Constant Detail

DESTINATION_ALPHA

Constant
public static const DESTINATION_ALPHA:String = "destinationAlpha"

Runtime Versions:  3

The blend factor is (Da,Da,Da,Da), where Da is the alpha component of the fragment color computed by the pixel program.

DESTINATION_COLOR

Constant 
public static const DESTINATION_COLOR:String = "destinationColor"

Runtime Versions:  3

The blend factor is (Dr,Dg,Db,Da), where Dr/g/b/a is the corresponding component of the current color in the color buffer.

ONE

Constant 
public static const ONE:String = "one"

Runtime Versions:  3

The blend factor is (1,1,1,1).

ONE_MINUS_DESTINATION_ALPHA

Constant 
public static const ONE_MINUS_DESTINATION_ALPHA:String = "oneMinusDestinationAlpha"

Runtime Versions:  3

The blend factor is (1-Da,1-Da,1-Da,1-Da), where Da is the alpha component of the current color in the color buffer.

ONE_MINUS_DESTINATION_COLOR

Constant 
public static const ONE_MINUS_DESTINATION_COLOR:String = "oneMinusDestinationColor"

Runtime Versions:  3

The blend factor is (1-Dr,1-Dg,1-Db,1-Da), where Dr/g/b/a is the corresponding component of the current color in the color buffer.

ONE_MINUS_SOURCE_ALPHA

Constant 
public static const ONE_MINUS_SOURCE_ALPHA:String = "oneMinusSourceAlpha"

Runtime Versions:  3

The blend factor is (1-Sa,1-Sa,1-Sa,1-Sa), where Sa is the alpha component of the fragment color computed by the pixel program.

ONE_MINUS_SOURCE_COLOR

Constant 
public static const ONE_MINUS_SOURCE_COLOR:String = "oneMinusSourceColor"

Runtime Versions:  3

The blend factor is (1-Sr,1-Sg,1-Sb,1-Sa), where Sr/g/b/a is the corresponding component of the fragment color computed by the pixel program.

SOURCE_ALPHA

Constant 
public static const SOURCE_ALPHA:String = "sourceAlpha"

Runtime Versions:  3

The blend factor is (Sa,Sa,Sa,Sa), where Sa is the alpha component of the fragment color computed by the pixel program.

SOURCE_COLOR

Constant 
public static const SOURCE_COLOR:String = "sourceColor"

Runtime Versions:  3

The blend factor is (Sr,Sg,Sb,Sa), where Sr/g/b/a is the corresponding component of the fragment color computed by the pixel program.

ZERO

Constant 
public static const ZERO:String = "zero"

Runtime Versions:  3

The blend factor is (0,0,0,0).