How to use the fabric.fabric.Image function in fabric

To help you get started, we’ve selected a few fabric examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FelixHenninger / lab.js / packages / builder / src / components / ComponentOptions / components / Content / Canvas / components / fabric / index.js View on Github external
fabric.util.loadImage(object.src, function(img, error) {
    // Substitute empty image in case of error
    const image = new fabric.Image(
      error ? new Image() : img,
      object
    )
    image.crossOrigin = "anonymous"

    // Pretend that we were successful in any case
    callback(image)
  })
}
github nhn / tui.image-editor / test / icon.spec.js View on Github external
beforeEach(() => {
        mockImage = new fabric.Image();
        graphics.setCanvasImage('mockImage', mockImage);
    });
github nhn / tui.image-editor / test / shape.spec.js View on Github external
beforeEach(() => {
        mockImage = new fabric.Image();
        graphics.setCanvasImage('mockImage', mockImage);

        fEvent = {
            e: {}
        };
    });
github nhn / tui.image-editor / test / rotation.spec.js View on Github external
beforeEach(() => {
        mockImage = new fabric.Image();
        graphics.setCanvasImage('mockImage', mockImage);
    });
github nhn / tui.image-editor / test / flip.spec.js View on Github external
beforeEach(() => {
        mockImage = new fabric.Image();
        graphics.setCanvasImage('mockImage', mockImage);
    });
github nhn / tui.image-editor / test / command.spec.js View on Github external
beforeEach(() => {
        graphics = new Graphics(document.createElement('canvas'));
        invoker = new Invoker();
        mockImage = new fabric.Image();

        graphics.setCanvasImage('', mockImage);
        canvas = graphics.getCanvas();
    });
github FelixHenninger / lab.js / packages / builder / src / components / ComponentOptions / components / Content / Canvas / components / fabric / index.js View on Github external
this.context.store,
              this.context.id,
              placeholderMatch[1]
            ).file.content
          }
          const img = await new Promise((resolve, reject) => {
            const image = new Image()

            image.addEventListener('load', () => resolve(image))
            image.addEventListener('error', e => reject(e))

            image.crossOrigin = "anonymous"
            image.src = options.src
          })

          return new fabric.Image(img, {
            ...defaults,
            ...options,
          })
        case 'aoi':
          return new fabric.Aoi({
            width: 50, height: 50,
            ...defaults,
          })
        default:
          return undefined
      }
    })()
github tbolis / react-sketch / src / SketchField.jsx View on Github external
    img.onload = () => canvas.setBackgroundImage(new fabric.Image(img),
      () => canvas.renderAll(), options);
    img.src = dataUrl