mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -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.convert(this._colorType)
|
||||||
: rgbColor;
|
: rgbColor;
|
||||||
} else {
|
} else {
|
||||||
var components = isArray ? arg : arguments;
|
var components = isArray ? arg
|
||||||
|
: Array.prototype.slice.call(arguments);
|
||||||
if (!this._colorType) {
|
if (!this._colorType) {
|
||||||
// Called on the abstract Color class. Guess color type
|
// Called on the abstract Color class. Guess color type
|
||||||
// from arg
|
// from arg
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -71,6 +71,7 @@ var CompoundPath = this.CompoundPath = PathItem.extend({
|
||||||
ctx.strokeStyle = strokeColor.getCanvasStyle(ctx);
|
ctx.strokeStyle = strokeColor.getCanvasStyle(ctx);
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
|
param.compound = false;
|
||||||
}
|
}
|
||||||
}, new function() { // Injection scope for PostScript-like drawing functions
|
}, new function() { // Injection scope for PostScript-like drawing functions
|
||||||
function getCurrentPath(that) {
|
function getCurrentPath(that) {
|
||||||
|
|
|
@ -154,3 +154,8 @@ test('Setting HSBColor#gray', function() {
|
||||||
color.gray = 0.5;
|
color.gray = 0.5;
|
||||||
compareHSBColors(color, [0, 0, 0.5, 1]);
|
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