diff --git a/src/shapes/Image.js b/src/shapes/Image.js index 6c8cecb5..c0da56e3 100644 --- a/src/shapes/Image.js +++ b/src/shapes/Image.js @@ -1,4 +1,5 @@ (function() { + // CONSTANTS var IMAGE = 'Image', CROP = 'crop', @@ -118,15 +119,21 @@ filter = this.getFilter(), filterCanvas, context, imageData; - filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({ - width: width, - height: height, - pixelRatio: 1 - }); + if (this.filterCanvas){ + filterCanvas = this.filterCanvas; + } + else { + filterCanvas = this.filterCanvas = new Kinetic.SceneCanvas({ + width: width, + height: height, + pixelRatio: 1 + }); + } context = filterCanvas.getContext(); try { + context.clearRect(0,0,filterCanvas.getWidth(), filterCanvas.getHeight()); this._drawImage(context, [image, 0, 0, filterCanvas.getWidth(), filterCanvas.getHeight()]); imageData = context.getImageData(0, 0, filterCanvas.getWidth(), filterCanvas.getHeight()); filter.call(this, imageData);