applyTo(canvas) {
      const { canvasEl } = canvas;
      const context = canvasEl.getContext('2d');
      const imageData = context.getImageData(0, 0, canvasEl.width, canvasEl.height);
      const { data } = imageData;
      const { threshold } = this;
      let filterColor = fabric.Color.sourceFromHex(this.color);
      let i, len;

      if (this.x && this.y) {
        filterColor = this._getColor(imageData, this.x, this.y);
      }

      for (i = 0, len = data.length; i < len; i += 4) {
        if (
          this._isOutsideThreshold(data[i], filterColor[0], threshold) ||
          this._isOutsideThreshold(data[i + 1], filterColor[1], threshold) ||
          this._isOutsideThreshold(data[i + 2], filterColor[2], threshold)
        ) {
          continue;
        }
        data[i] = data[i + 1] = data[i + 2] = data[i + 3] = 0;
      }
      context.putImageData(imageData, 0, 0);
    }
Applies filter to canvas element
@param {Object} canvas Canvas object passed by fabric