|
|
@ -126,6 +126,14 @@ Canvas.prototype.getContext = function(contextId){ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Add `color` stop at the given `offset`. |
|
|
|
* |
|
|
|
* @param {Number} offset |
|
|
|
* @param {String} color |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|
|
|
|
|
CanvasGradient.prototype.addColorStop = function(offset, color){ |
|
|
|
var rgba; |
|
|
|
if (rgba = parseColor(color)) { |
|
|
@ -138,17 +146,49 @@ CanvasGradient.prototype.addColorStop = function(offset, color){ |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Create a linear gradient at the given point `(x0, y0)` and `(x1, y1)`. |
|
|
|
* |
|
|
|
* @param {Number} x0 |
|
|
|
* @param {Number} y0 |
|
|
|
* @param {Number} x1 |
|
|
|
* @param {Number} y1 |
|
|
|
* @return {CanvasGradient} |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|
|
|
|
|
Context2d.prototype.createLinearGradient = function(x0, y0, x1, y1){ |
|
|
|
return new CanvasGradient(x0, y0, x1, y1); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Create a radial gradient at the given point `(x0, y0)` and `(x1, y1)` |
|
|
|
* and radius `r0` and `r1`. |
|
|
|
* |
|
|
|
* @param {Number} x0 |
|
|
|
* @param {Number} y0 |
|
|
|
* @param {Number} r0 |
|
|
|
* @param {Number} x1 |
|
|
|
* @param {Number} y1 |
|
|
|
* @param {Number} r1 |
|
|
|
* @return {CanvasGradient} |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|
|
|
|
|
Context2d.prototype.createRadialGradient = function(x0, y0, r0, x1, y1, r1){ |
|
|
|
return new CanvasGradient(x0, y0, r0, x1, y1, r1); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* Reset transform matrix to identity, then apply the given args. |
|
|
|
* |
|
|
|
* @param {...} |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|
|
|
|
|
Context2d.prototype.setTransform = function(){ |
|
|
|
this.resetTransform(); |
|
|
|
return this.transform.apply(this, arguments); |
|
|
|
this.transform.apply(this, arguments); |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|