demos/Collage/fabric.js
function(callback) {
      if (fabric.Image) {
        var i = new Image();

        /** @ignore */
        i.onload = function() {
          if (callback) {
            callback(new fabric.Image(i), orig);
          }
          i = i.onload = null;
        };

        var orig = {
          angle: this.get('angle'),
          flipX: this.get('flipX'),
          flipY: this.get('flipY')
        };

        // normalize angle
        this.set('angle', 0).set('flipX', false).set('flipY', false);
        this.toDataURL(function(dataURL) {
          i.src = dataURL;
        });
      }
      return this;
    }
function(callback) {
      if (fabric.Image) {
        var i = new Image();

        /** @ignore */
        i.onload = function() {
          if (callback) {
            callback(new fabric.Image(i), orig);
          }
          i = i.onload = null;
        };

        var orig = {
          angle: this.get('angle'),
          flipX: this.get('flipX'),
          flipY: this.get('flipY')
        };

        // normalize angle
        this.set('angle', 0).set('flipX', false).set('flipY', false);
        this.toDataURL(function(dataURL) {
          i.src = dataURL;
        });
      }
      return this;
    }
function ( callback ) { if ( fabric . Image ) { var i = new Image ( ) ; /** @ignore */ i . onload = function ( ) { if ( callback ) { callback ( new fabric . Image ( i ) , orig ) ; } i = i . onload = null ; } ; var orig = { angle : this . get ( 'angle' ) , flipX : this . get ( 'flipX' ) , flipY : this . get ( 'flipY' ) } ; // normalize angle this . set ( 'angle' , 0 ) . set ( 'flipX' , false ) . set ( 'flipY' , false ) ; this . toDataURL ( function ( dataURL ) { i . src = dataURL ; } ) ; } return this ; }
Creates an instance of fabric.Image out of an object
@method cloneAsImage
@param callback {Function} callback, invoked with an instance as a first argument
@return {fabric.Object} thisArg
@chainable
Creates an instance of fabric . Image out of an object