Browse Source

Prepping fillStyle for grads

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

4
lib/canvas.js

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

Loading…
Cancel
Save