demos/Collage/fabric.js
function() {
      var source = this.getSource(),
          average = parseInt((source[0] * 0.3 + source[1] * 0.59 + source[2] * 0.11).toFixed(0), 10),
          currentAlpha = source[3];
      this.setSource([average, average, average, currentAlpha]);
      return this;
    }
function() {
      var source = this.getSource(),
          average = parseInt((source[0] * 0.3 + source[1] * 0.59 + source[2] * 0.11).toFixed(0), 10),
          currentAlpha = source[3];
      this.setSource([average, average, average, currentAlpha]);
      return this;
    }
function ( ) { var source = this . getSource ( ) , average = parseInt ( ( source [ 0 ] * 0.3 + source [ 1 ] * 0.59 + source [ 2 ] * 0.11 ) . toFixed ( 0 ) , 10 ) , currentAlpha = source [ 3 ] ; this . setSource ( [ average , average , average , currentAlpha ] ) ; return this ; }
Transforms color to its grayscale representation
@method toGrayscale
@return {fabric.Color} thisArg
Transforms color to its grayscale representation