var TextCanvasRenderer = function (renderer, src, interpolationPercentage, camera) { if (src.renderMask !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id))) { return; } var ctx = renderer.currentContext; // Blend Mode if (renderer.currentBlendMode !== src.blendMode) { renderer.currentBlendMode = src.blendMode; ctx.globalCompositeOperation = renderer.blendModes[src.blendMode]; } // Alpha if (renderer.currentAlpha !== src.alpha) { renderer.currentAlpha = src.alpha; ctx.globalAlpha = src.alpha; } // Smoothing if (renderer.currentScaleMode !== src.scaleMode) { renderer.currentScaleMode = src.scaleMode; } var canvas = src.canvas; ctx.save(); ctx.translate(src.x - camera.scrollX * src.scrollFactorX, src.y - camera.scrollY * src.scrollFactorY); ctx.rotate(src.rotation); ctx.scale(src.scaleX, src.scaleY); ctx.translate(canvas.width * (src.flipX ? 1 : 0), canvas.height * (src.flipY ? 1 : 0)); ctx.scale(src.flipX ? -1 : 1, src.flipY ? -1 : 1); ctx.drawImage(canvas, 0, 0, canvas.width, canvas.height, -src.displayOriginX, -src.displayOriginY, canvas.width, canvas.height); ctx.restore(); }; module.exports = TextCanvasRenderer;