mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Add test for Raster#getAverageColor(compoundPath).
This commit is contained in:
parent
e3760afecd
commit
a87c9e9a7f
1 changed files with 23 additions and 1 deletions
|
@ -131,4 +131,26 @@ test('Raster#getAverageColor(path)', function() {
|
|||
var raster = paper.project.activeLayer.rasterize();
|
||||
path.scale(0.9);
|
||||
compareRgbColors(raster.getAverageColor(path), new RgbColor(1, 0, 0));
|
||||
});
|
||||
});
|
||||
|
||||
test('Raster#getAverageColor(path) with compound path', function() {
|
||||
new Path.Rectangle({
|
||||
point: [0, 0],
|
||||
size: [100, 100],
|
||||
fillColor: new RgbColor(0, 1, 0)
|
||||
});
|
||||
var path = new Path.Circle({
|
||||
center: [50, 50],
|
||||
radius: 25
|
||||
});
|
||||
var path2 = new Path.Circle({
|
||||
center: [50, 50],
|
||||
radius: 10
|
||||
})
|
||||
var compoundPath = new CompoundPath(path, path2);
|
||||
compoundPath.fillColor = new RgbColor(1, 0, 0);
|
||||
var raster = paper.project.activeLayer.rasterize();
|
||||
path.scale(0.9);
|
||||
path2.scale(1.1);
|
||||
compareRgbColors(raster.getAverageColor(compoundPath), new RgbColor(1, 0, 0));
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue