Enabling a filter on a display object that had a blend mode set would cause the object to become invisible. The two cannot be combined, so when you set a filter on a display object it now automatically resets the blend mode to NORMAL. The same does not happen in reverse however, so if you've got a filter set and then change the blend mode it will still break. Be careful to capture this yourself (thanks @wayfu #1994)

This commit is contained in:
photonstorm 2015-08-24 12:26:02 +01:00
parent 5056eedb58
commit 0cce3f8287
3 changed files with 15 additions and 2 deletions

View file

@ -308,6 +308,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
* TilingSprite._renderCanvas wasn't correctly allowing for pixel rounding (thanks @ximop #2022)
* Cache.addSpriteSheet didn't include default values for the `frameMax`, `margin` and `spacing` arguments (thanks @vladkens #2017 #2018)
* Tilemap.shuffle was calling the deprecated Phaser.Utils.shuffle, which has now moved to Phaser.ArrayUtils.shuffle.
* Enabling a filter on a display object that had a blend mode set would cause the object to become invisible. The two cannot be combined, so when you set a filter on a display object it now automatically resets the blend mode to `NORMAL`. The same does not happen in reverse however, so if you've got a filter set and then change the blend mode it will still break. Be careful to capture this yourself (thanks @wayfu #1994)
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).

View file

@ -327,8 +327,13 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'mask', {
/**
* Sets the filters for the displayObject.
* * IMPORTANT: This is a webGL only feature and will be ignored by the canvas renderer.
* To remove filters simply set this property to 'null'
* IMPORTANT: This is a webGL only feature and will be ignored by the Canvas renderer.
*
* To remove filters simply set this property to 'null'.
*
* You cannot have a filter and a blend mode active at the same time. Setting a filter will reset
* this objects blend mode to NORMAL.
*
* @property filters
* @type Array(Filter)
*/
@ -360,6 +365,11 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', {
}
this._filters = value;
if (this.blendMode)
{
this.blendMode = PIXI.blendModes.NORMAL;
}
}
});

View file

@ -87,6 +87,8 @@ PIXI.Sprite = function(texture)
/**
* The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
*
* Warning: You cannot have a blend mode and a filter active on the same Sprite. Doing so will render the sprite invisible.
*
* @property blendMode
* @type Number
* @default PIXI.blendModes.NORMAL;