A class that provides constant values for visual blend mode effects.

A blend mode is always defined by two 'Context3DBlendFactor' values. 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.

Beware that blending factors produce different output depending on the texture type. Textures may contain 'premultiplied alpha' (pma), which means that their RGB values were multiplied with their alpha value (to save processing time). Textures based on 'BitmapData' objects have premultiplied alpha values, while ATF textures haven't. For this reason, a blending mode may have different factors depending on the pma value.

@see openfl.display3D.Context3DBlendFactor

### Hierarchy

- BlendMode

## Index

### Constructors

- constructor

### Properties

- destinationFactor
- name
- sourceFactor
- ADD
- AUTO
- BELOW
- ERASE
- MASK
- MULTIPLY
- NONE
- NORMAL
- SCREEN

### Methods

- activate
- get_destinationFactor
- get_name
- get_sourceFactor
- toString
- get
- getByFactors
- register

## Constructors

### constructor

- new BlendMode(name: string, sourceFactor: Context3DBlendFactor, destinationFactor: Context3DBlendFactor): BlendMode

- - Defined in lib/starling/display/BlendMode.d.ts:36

  Creates a new BlendMode instance. Don't call this method directly; instead, register a new blend mode using `BlendMode.register`.

  #### Parameters

  - ##### name: string

  - ##### sourceFactor: Context3DBlendFactor

  - ##### destinationFactor: Context3DBlendFactor

  #### Returns BlendMode

## Properties

### destinationFactor

destinationFactor: string

- Defined in lib/starling/display/BlendMode.d.ts:96

The destination blend factor of this blend mode.

### name

name: string

- Defined in lib/starling/display/BlendMode.d.ts:100

Returns the name of the blend mode.

### sourceFactor

sourceFactor: string

- Defined in lib/starling/display/BlendMode.d.ts:92

The source blend factor of this blend mode.

### Static ADD

ADD: string

- Defined in lib/starling/display/BlendMode.d.ts:51

Adds the values of the colors of the display object to the colors of its background.

### Static AUTO

AUTO: string

- Defined in lib/starling/display/BlendMode.d.ts:42

Inherits the blend mode from this display object's parent.

### Static BELOW

BELOW: string

- Defined in lib/starling/display/BlendMode.d.ts:68

Draws under/below existing objects; useful especially on RenderTextures.

### Static ERASE

ERASE: string

- Defined in lib/starling/display/BlendMode.d.ts:61

Erases the background when drawn on a RenderTexture.

### Static MASK

MASK: string

- Defined in lib/starling/display/BlendMode.d.ts:65

When used on a RenderTexture, the drawn object will act as a mask for the current content, i.e. the source alpha overwrites the destination alpha.

### Static MULTIPLY

MULTIPLY: string

- Defined in lib/starling/display/BlendMode.d.ts:54

Multiplies the values of the display object colors with the the background color.

### Static NONE

NONE: string

- Defined in lib/starling/display/BlendMode.d.ts:45

Deactivates blending, i.e. disabling any transparency.

### Static NORMAL

NORMAL: string

- Defined in lib/starling/display/BlendMode.d.ts:48

The display object appears in front of the background.

### Static SCREEN

SCREEN: string

- Defined in lib/starling/display/BlendMode.d.ts:58

Multiplies the complement (inverse) of the display object color with the complement of the background color, resulting in a bleaching effect.

## Methods

### activate

- activate(): void

- - Defined in lib/starling/display/BlendMode.d.ts:86

  Sets the appropriate blend factors for source and destination on the current context.

  #### Returns void

### Protected get_destinationFactor

- get_destinationFactor(): string

- - Defined in lib/starling/display/BlendMode.d.ts:97

  #### Returns string

### Protected get_name

- get_name(): string

- - Defined in lib/starling/display/BlendMode.d.ts:101

  #### Returns string

### Protected get_sourceFactor

- get_sourceFactor(): string

- - Defined in lib/starling/display/BlendMode.d.ts:93

  #### Returns string

### toString

- toString(): string

- - Defined in lib/starling/display/BlendMode.d.ts:89

  Returns the name of the blend mode.

  #### Returns string

### Static get

- get(modeName: string): BlendMode

- - Defined in lib/starling/display/BlendMode.d.ts:74

  Returns the blend mode with the given name. Throws an ArgumentError if the mode does not exist.

  #### Parameters

  - ##### modeName: string

  #### Returns BlendMode

### Static getByFactors

- getByFactors(srcFactor: Context3DBlendFactor, dstFactor: Context3DBlendFactor): Null<BlendMode>

- - Defined in lib/starling/display/BlendMode.d.ts:78

  Returns allready registered blend mode by given blend mode factors. Returns null if not exist.

  #### Parameters

  - ##### srcFactor: Context3DBlendFactor

  - ##### dstFactor: Context3DBlendFactor

  #### Returns Null<BlendMode>

### Static register

- register(name: string, srcFactor: Context3DBlendFactor, dstFactor: Context3DBlendFactor): BlendMode

- - Defined in lib/starling/display/BlendMode.d.ts:81

  Registers a blending mode under a certain name.

  #### Parameters

  - ##### name: string

  - ##### srcFactor: Context3DBlendFactor

  - ##### dstFactor: Context3DBlendFactor

  #### Returns BlendMode

Generated using TypeDoc