PIXI.filters.MultiColorReplaceFilter

class MultiColorReplaceFilter extends PIXI.Filter

Filter for replacing a color with another color. Similar to ColorReplaceFilter, but support multiple colors.
originalfilter


  // replaces pure red with pure blue, and replaces pure green with pure white
  someSprite.filters = [new MultiColorReplaceFilter(
    [
      [0xFF0000, 0x0000FF],
      [0x00FF00, 0xFFFFFF]
    ],
    0.001
  )];

  You also could use [R, G, B] as the color
  someOtherSprite.filters = [new MultiColorReplaceFilter(
    [
      [ [1,0,0], [0,0,1] ],
      [ [0,1,0], [1,1,1] ]
    ],
    0.001
  )];
See:

Constructor


new PIXI.filters.MultiColorReplaceFilter(replacements: Array<Array>, epsilon: number, maxColors: number) → {}
Parameters:
Name Type Attributes Default Description
replacements Array<Array>

The collection of replacement items. Each item is color-pair (an array length is 2). In the pair, the first value is original color , the second value is target color.

epsilon number

<optional>

0.05

Tolerance of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

maxColors number

<optional>

The maximum number of replacements filter is able to use. Because the fragment is only compiled once, this cannot be changed after construction. If omitted, the default value is the length of replacements.

Summary


Properties from MultiColorReplaceFilter

number
epsilon = 0.05
number
maxColors
Array<Array>
replacements

The source and target colors for replacement. See constructor for information on the format.

Methods from MultiColorReplaceFilter

void
refresh()

Properties inherited from Filter

boolean
autoFit = true
PIXI.BLEND_MODES
blendMode = PIXI.BLEND_MODES.NORMAL
boolean
enabled

If enabled is true the filter is applied, if false it will not.

boolean
legacy
PIXI.MSAA_QUALITY
multisample

The samples of the filter.

number
padding
number
resolution
PIXI.State
state

The WebGL state the filter requires to render.

Properties inherited from Shader

PIXI.Program
program

Program that the shader uses.

Dict<any>
uniforms

Methods inherited from Filter

void
apply(filterManager: PIXI.FilterSystem, input: PIXI.RenderTexture, output: PIXI.RenderTexture, clearMode: PIXI.CLEAR_MODES, _currentState: object)

Public Properties


epsilon MultiColorReplaceFilter.ts:146
epsilon: number = 0.05

Tolerance of the floating-point comparison between colors (lower = more exact, higher = more inclusive)

maxColors MultiColorReplaceFilter.ts:136
maxColors: number

The maximum number of color replacements supported by this filter. Can be changed only during construction.

replacements MultiColorReplaceFilter.ts:64
replacements: Array<Array>

The source and target colors for replacement. See constructor for information on the format.

Public Methods


refresh MultiColorReplaceFilter.ts:127
refresh() → {void}

Should be called after changing any of the contents of the replacements. This is a convenience method for resetting the replacements.

Returns:
Type Description
void

Powered by webdoc!