Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jürg Lehni 2011-05-15 14:37:34 +01:00
commit c91cbe2175
4 changed files with 11 additions and 7 deletions

View file

@ -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

View file

@ -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;

View file

@ -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) {

View file

@ -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]);
});