function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

/**
 * @class qrenderer.graphic.Pattern
 * 
 * Pattern
 * 
 * 图案
 * 
 * @docauthor 大漠穷秋 <damoqiongqiu@126.com>
 */
var Pattern =
/*#__PURE__*/
function () {
  /**
   * @method  constructor Pattern
   * @param {*} image 
   * @param {*} repeat 
   */
  function Pattern(image, repeat) {
    _classCallCheck(this, Pattern);

    // Should do nothing more in this constructor. Because gradient can be
    // declard by `color: {image: ...}`, where this constructor will not be called.
    this.image = image;
    this.repeat = repeat;
    this.type = 'pattern';
    /**
     * @property {String} type
     */

    this.type = 'pattern';
  }

  _createClass(Pattern, [{
    key: "getCanvasPattern",
    value: function getCanvasPattern(ctx) {
      return ctx.createPattern(this.image, this.repeat || 'repeat');
    }
  }]);

  return Pattern;
}();

var _default = Pattern;
module.exports = _default;