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){
var rgba = exports.parseColor(val) || [0,0,0,1];
this.lastFillStyle = rgba;
this.setFillRGBA(
rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
if (val instanceof CanvasGradient) {
return this.setSource(val);
} else if ('string' == typeof val) {
var rgba = exports.parseColor(val) || [0,0,0,1];
this.lastFillStyle = rgba;
this.setFillRGBA(
rgba[0]
, rgba[1]
, rgba[2]
, rgba[3]);
}
});
/**

Loading…
Cancel
Save