jquery-cropbox icon indicating copy to clipboard operation
jquery-cropbox copied to clipboard

Retina support

Open gblazex opened this issue 9 years ago • 0 comments

  getDataURL: function () {
    var canvas = document.createElement('canvas'), ctx = canvas.getContext('2d');
    var pixelRatio = window.devicePixelRatio || 1;
    canvas.width  = this.options.width  * pixelRatio;
    canvas.height = this.options.height * pixelRatio;
    ctx.scale(pixelRatio, pixelRatio);
    ctx.drawImage(this.$image.get(0), this.result.cropX, this.result.cropY, 
                  this.result.cropW, this.result.cropH, 0, 0, 
                  this.options.width, this.options.height);
    return canvas.toDataURL();
  },

see: https://tristandunn.com/2014/01/24/rendering-svg-on-canvas/

gblazex avatar Dec 05 '16 16:12 gblazex