"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Renderer = (function () { function Renderer() { } Renderer.prototype.rasterize = function (target, markerImage, done) { var canvas = document.createElement('canvas'); canvas.width = markerImage.width.baseVal.value; canvas.height = markerImage.height.baseVal.value; var data = markerImage.outerHTML; var ctx = canvas.getContext('2d'); if (!ctx) { throw new Error('Invalid ctx'); } ctx.drawImage(target, 0, 0, canvas.width, canvas.height); var DOMURL = window.URL; var img = new Image(canvas.width, canvas.height); img.setAttribute('crossOrigin', 'anonymous'); var blob = new Blob([data], { type: 'image/svg+xml' }); var url = DOMURL.createObjectURL(blob); img.onload = function () { ctx.drawImage(img, 0, 0); DOMURL.revokeObjectURL(url); done(canvas.toDataURL('image/png')); }; img.src = url; }; return Renderer; }()); exports.Renderer = Renderer;