This commit is contained in:
Looly 2024-03-18 16:27:10 +08:00
parent de6eb1deea
commit 6b95a60c4b
2 changed files with 26 additions and 1 deletions

View File

@ -74,6 +74,11 @@ public class QrConfig {
* 二维码中的Logo * 二维码中的Logo
*/ */
protected Image img; protected Image img;
/**
* 二维码logo圆角弧度0~1为长宽占比
*/
protected double imgRound = 0.3;
/** /**
* 二维码中的Logo缩放的比例系数如5表示长宽最小值的1/5 * 二维码中的Logo缩放的比例系数如5表示长宽最小值的1/5
*/ */
@ -385,6 +390,26 @@ public class QrConfig {
return this; return this;
} }
/**
* 获取二维码logo圆角弧度0~1为长宽占比
* @return 二维码logo圆角弧度0~1为长宽占比
* @since 6.0.0
*/
public double getImgRound() {
return imgRound;
}
/**
* 设置二维码logo圆角弧度0~1为长宽占比
* @param imgRound 二维码logo圆角弧度0~1为长宽占比
* @return this
* @since 6.0.0
*/
public QrConfig setImgRound(final double imgRound) {
this.imgRound = imgRound;
return this;
}
/** /**
* 获取二维码中的Logo缩放的比例系数如5表示长宽最小值的1/5 * 获取二维码中的Logo缩放的比例系数如5表示长宽最小值的1/5
* *

View File

@ -87,7 +87,7 @@ public class QrImage extends BufferedImage {
} }
Img.from(this).pressImage(// Img.from(this).pressImage(//
Img.from(logoImg).round(0.3).getImg(), // 圆角 Img.from(logoImg).round(config.imgRound).getImg(), // 圆角
new Rectangle(imgWidth, imgHeight), // 位置 new Rectangle(imgWidth, imgHeight), // 位置
1//不透明 1//不透明
); );