|
|
@ -166,7 +166,7 @@ Context2d.prototype.setTransform = function(){ |
|
|
|
|
|
|
|
Context2d.prototype.__defineSetter__('fillStyle', function(val){ |
|
|
|
if (!val) return; |
|
|
|
if ('CanvasGradient' == val.constructor.name |
|
|
|
if ('CanvasGradient' == val.constructor.name |
|
|
|
|| 'CanvasPattern' == val.constructor.name) { |
|
|
|
this.lastFillStyle = val; |
|
|
|
this._setFillPattern(val); |
|
|
@ -194,7 +194,7 @@ Context2d.prototype.__defineGetter__('fillStyle', function(){ |
|
|
|
|
|
|
|
Context2d.prototype.__defineSetter__('strokeStyle', function(val){ |
|
|
|
if (!val) return; |
|
|
|
if ('CanvasGradient' == val.constructor.name |
|
|
|
if ('CanvasGradient' == val.constructor.name |
|
|
|
|| 'CanvasPattern' == val.constructor.name) { |
|
|
|
this.lastStrokeStyle = val; |
|
|
|
this._setStrokePattern(val); |
|
|
@ -214,15 +214,17 @@ Context2d.prototype.__defineGetter__('strokeStyle', function(){ |
|
|
|
return this.lastStrokeStyle || this.strokeColor; |
|
|
|
}); |
|
|
|
|
|
|
|
/** |
|
|
|
* Register `font` for usage. |
|
|
|
* |
|
|
|
* @param {Font} font |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|
|
|
|
|
Context2d.prototype.useFont = function(font) { |
|
|
|
if (!this._fonts) this._fonts = {}; |
|
|
|
var fonts = this._fonts; |
|
|
|
|
|
|
|
if (fonts[font.name]) |
|
|
|
return; |
|
|
|
|
|
|
|
fonts[font.name] = font; |
|
|
|
Context2d.prototype.addFont = function(font) { |
|
|
|
this._fonts = this._fonts || {}; |
|
|
|
if (this._fonts[font.name]) return; |
|
|
|
this._fonts[font.name] = font; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|