Browse Source

Prepping fillStyle for grads

v1.x
Tj Holowaychuk 14 years ago
parent
commit
8e219b468a
  1. 18
      lib/canvas.js

18
lib/canvas.js

@ -145,13 +145,17 @@ Context2d.prototype.createRadialGradient = function(x0, y0, r0, x1, y1, r1){
*/ */
Context2d.prototype.__defineSetter__('fillStyle', function(val){ Context2d.prototype.__defineSetter__('fillStyle', function(val){
var rgba = exports.parseColor(val) || [0,0,0,1]; if (val instanceof CanvasGradient) {
this.lastFillStyle = rgba; return this.setSource(val);
this.setFillRGBA( } else if ('string' == typeof val) {
rgba[0] var rgba = exports.parseColor(val) || [0,0,0,1];
, rgba[1] this.lastFillStyle = rgba;
, rgba[2] this.setFillRGBA(
, rgba[3]); rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
}); });
/** /**

Loading…
Cancel
Save