mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c91cbe2175
4 changed files with 11 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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]);
|
||||
});
|
Loading…
Reference in a new issue