diff --git a/src/color/Color.js b/src/color/Color.js index 187ed759..f51f5470 100644 --- a/src/color/Color.js +++ b/src/color/Color.js @@ -91,7 +91,8 @@ var Color = this.Color = Base.extend(new function() { ? rgbColor.convert(this._colorType) : rgbColor; } else { - var components = isArray ? arg : arguments; + var components = isArray ? arg + : Array.prototype.slice.call(arguments); if (!this._colorType) { // Called on the abstract Color class. Guess color type // from arg diff --git a/src/item/Raster.js b/src/item/Raster.js index e8cf58c9..8c5e7fd3 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -247,7 +247,7 @@ var Raster = this.Raster = Item.extend({ var image; if (object) { var bounds, path; - if (object instanceof Path) { + if (object instanceof PathItem) { // TODO: what if the path is smaller than 1 px? // TODO: how about rounding of bounds.size? // TODO: test with compound paths. @@ -266,14 +266,11 @@ var Raster = this.Raster = Item.extend({ ctx.translate(delta.x, delta.y); if (path) { var style = object.getStyle(); - path.draw(ctx); + path.draw(ctx, {}); ctx.clip(); path.setStyle(style); } - var matrix = this.matrix.clone(), - transMatrix = Matrix.getTranslateInstance(delta); - matrix.preConcatenate(transMatrix); - matrix.applyToContext(ctx); + this.matrix.applyToContext(ctx); ctx.drawImage(this._canvas || this._image, -this._size.width / 2, -this._size.height / 2); image = canvas; diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index ea52967c..e856b874 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -71,6 +71,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend({ ctx.strokeStyle = strokeColor.getCanvasStyle(ctx); ctx.stroke(); } + param.compound = false; } }, new function() { // Injection scope for PostScript-like drawing functions function getCurrentPath(that) { diff --git a/test/tests/Color.js b/test/tests/Color.js index 32da7d1f..abf078bd 100644 --- a/test/tests/Color.js +++ b/test/tests/Color.js @@ -153,4 +153,9 @@ test('Setting HSBColor#gray', function() { var color = new HSBColor(180, 0, 0); color.gray = 0.5; compareHSBColors(color, [0, 0, 0.5, 1]); +}); + +test('Color.read(channels)', function() { + var color = Color.read([0, 0, 1]); + compareRGBColors(color, [0, 0, 1, 1]); }); \ No newline at end of file