1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| /** 绘制圆角图片原型方法 */
| export default {
| name: 'drawRoundImage',
| handle: async (canvas, ctx, url, x, y, w, h, r = 15) => {
| var _a;
| ctx.save();
| (_a = ctx.setFillStyle) === null || _a === void 0 ? void 0 : _a.call(ctx, 'transparent');
| ctx.fillStyle = 'transparent';
| ctx.fillRoundRect(x, y, w, h, r);
| ctx.clip();
| const result = await ctx.drawImage(url, x, y, w, h);
| ctx.restore();
| return result;
| }
| };
|
|