SourceTermAnalysisSystem_vue/node_modules/@antv/x6/es/registry/background/flip-x.js
2026-05-15 10:22:44 +08:00

18 lines
518 B
JavaScript

export const flipX = function (img) {
// d b
// d b
const canvas = document.createElement('canvas');
const width = img.width;
const height = img.height;
canvas.width = width * 2;
canvas.height = height;
const ctx = canvas.getContext('2d');
// left image
ctx.drawImage(img, 0, 0, width, height);
// flipped right image
ctx.translate(2 * width, 0);
ctx.scale(-1, 1);
ctx.drawImage(img, 0, 0, width, height);
return canvas;
};
//# sourceMappingURL=flip-x.js.map