From 42ae3ce42e51b31f69a438f5cd96baee0b36f66f Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sat, 14 May 2011 20:36:58 +0200 Subject: [PATCH 1/4] CompoundPath#draw: set param.compound to false when done drawing. --- src/path/CompoundPath.js | 1 + 1 file changed, 1 insertion(+) 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) { From 2c36f3a62ecfc8abae0fdbe361442bea74caa6c0 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 15 May 2011 14:11:35 +0200 Subject: [PATCH 2/4] Fix bug in Color#read. --- src/color/Color.js | 3 ++- test/tests/Color.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/color/Color.js b/src/color/Color.js index 187ed759..ab9c955f 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 + : arguments;//Array.prototype.slice.call(arguments); if (!this._colorType) { // Called on the abstract Color class. Guess color type // from arg 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 From 3f8f539aebb68e884b69a18a6249b51c01ccabae Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 15 May 2011 14:13:47 +0200 Subject: [PATCH 3/4] Fix bugs in Raster#getAverageColor. --- src/item/Raster.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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; From f8f6754068506543a3617424f56675a5b6895b3e Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Sun, 15 May 2011 14:26:08 +0200 Subject: [PATCH 4/4] Fix mistake in earlier commit. --- src/color/Color.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/color/Color.js b/src/color/Color.js index ab9c955f..f51f5470 100644 --- a/src/color/Color.js +++ b/src/color/Color.js @@ -92,7 +92,7 @@ var Color = this.Color = Base.extend(new function() { : rgbColor; } else { var components = isArray ? arg - : arguments;//Array.prototype.slice.call(arguments); + : Array.prototype.slice.call(arguments); if (!this._colorType) { // Called on the abstract Color class. Guess color type // from arg