mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-28 22:08:54 -04:00
Fix bugs in Raster#getAverageColor.
This commit is contained in:
parent
2c36f3a62e
commit
3f8f539aeb
1 changed files with 3 additions and 6 deletions
|
@ -247,7 +247,7 @@ var Raster = this.Raster = Item.extend({
|
||||||
var image;
|
var image;
|
||||||
if (object) {
|
if (object) {
|
||||||
var bounds, path;
|
var bounds, path;
|
||||||
if (object instanceof Path) {
|
if (object instanceof PathItem) {
|
||||||
// TODO: what if the path is smaller than 1 px?
|
// TODO: what if the path is smaller than 1 px?
|
||||||
// TODO: how about rounding of bounds.size?
|
// TODO: how about rounding of bounds.size?
|
||||||
// TODO: test with compound paths.
|
// TODO: test with compound paths.
|
||||||
|
@ -266,14 +266,11 @@ var Raster = this.Raster = Item.extend({
|
||||||
ctx.translate(delta.x, delta.y);
|
ctx.translate(delta.x, delta.y);
|
||||||
if (path) {
|
if (path) {
|
||||||
var style = object.getStyle();
|
var style = object.getStyle();
|
||||||
path.draw(ctx);
|
path.draw(ctx, {});
|
||||||
ctx.clip();
|
ctx.clip();
|
||||||
path.setStyle(style);
|
path.setStyle(style);
|
||||||
}
|
}
|
||||||
var matrix = this.matrix.clone(),
|
this.matrix.applyToContext(ctx);
|
||||||
transMatrix = Matrix.getTranslateInstance(delta);
|
|
||||||
matrix.preConcatenate(transMatrix);
|
|
||||||
matrix.applyToContext(ctx);
|
|
||||||
ctx.drawImage(this._canvas || this._image,
|
ctx.drawImage(this._canvas || this._image,
|
||||||
-this._size.width / 2, -this._size.height / 2);
|
-this._size.width / 2, -this._size.height / 2);
|
||||||
image = canvas;
|
image = canvas;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue