绿满眶商城微信小程序-uniapp
xiangpei
2025-05-09 c3e6cdbb29580e77444541c7953aca33581a4267
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;
    }
};