diff --git a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java b/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java index f14fc70b5..318bb6171 100755 --- a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java @@ -380,7 +380,7 @@ public class QrCodeUtil { } Img.from(image).pressImage(// - Img.from(logoImg).round(0.3).getImg(), // 圆角 + Img.from(logoImg).round(config.round).getImg(), // 圆角 new Rectangle(width, height), // 1// ); diff --git a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrConfig.java b/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrConfig.java index b01f3c70b..940c7ffd5 100755 --- a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrConfig.java +++ b/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrConfig.java @@ -53,6 +53,8 @@ public class QrConfig { protected Charset charset = CharsetUtil.CHARSET_UTF_8; /** 二维码中的Logo */ protected Image img; + /** 二维码中的Logo圆角弧度 */ + protected double round = 0.3; /** 二维码中的Logo缩放的比例系数,如5表示长宽最小值的1/5 */ protected int ratio = 6; /** @@ -343,6 +345,26 @@ public class QrConfig { return this; } + /** + * 获取二维码中的Logo圆角弧度 + * + * @return 二维码中的Logo圆角弧度 + */ + public double getRound() { + return round; + } + + /** + * 设置二维码中的Logo圆角弧度 + * + * @param round 二维码中的Logo圆角弧度 + * @return this; + */ + public QrConfig setRound(double round) { + this.round = round; + return this; + } + /** * 设置DATA_MATRIX的符号形状 *