Merge pull request #3747 from fun-li/v5-dev

QrCodeUtil添加二维码logo支持配置圆角
This commit is contained in:
Golden Looly 2024-09-23 17:01:48 +08:00 committed by GitHub
commit cf7f57e66d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View File

@ -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//
);

View File

@ -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的符号形状
*