diff --git a/src/extras/cacheAsBitmap.js b/src/extras/cacheAsBitmap.js index bf2f405..2dea5c7 100644 --- a/src/extras/cacheAsBitmap.js +++ b/src/extras/cacheAsBitmap.js @@ -137,6 +137,10 @@ return; } + // make sure alpha is set to 1 otherwise it will get rendered as invisible! + var cacheAlpha = this.alpha; + this.alpha = 1; + // first we flush anything left in the renderer (otherwise it would get rendered to the cached texture) renderer.currentRenderer.flush(); //this.filters= []; @@ -149,11 +153,8 @@ if(this._filters) { var padding = this._filters[0].padding; - bounds.x -= padding; - bounds.y -= padding; - bounds.width += padding * 2; - bounds.height += padding * 2; + bounds.pad(padding); } // for now we cache the current renderTarget that the webGL renderer is currently using. @@ -177,6 +178,7 @@ // set all properties to there original so we can render to a texture this.renderWebGL = this._cacheData.originalRenderWebGL; + renderer.render(this, renderTexture, true, m, true); // now restore the state be setting the new properties @@ -196,6 +198,7 @@ cachedSprite.transform.worldTransform = this.transform.worldTransform; cachedSprite.anchor.x = -( bounds.x / bounds.width ); cachedSprite.anchor.y = -( bounds.y / bounds.height ); + cachedSprite.alpha = cacheAlpha; this._cacheData.sprite = cachedSprite;