|
@@ -201,7 +201,7 @@ public class UploadServiceImpl implements UploadService {
|
|
|
int qrCodeX = (backgroundImage.getWidth() - qrCodeImage.getWidth()) / 2;
|
|
|
int qrCodeY = (backgroundImage.getHeight() - qrCodeImage.getHeight()) / 2 + 25;
|
|
|
// 文字距离图片顶部的距离,可以根据需要调整
|
|
|
- int textY = 30;
|
|
|
+ int textY = 35;
|
|
|
// 创建新图片,使用背景图片的尺寸
|
|
|
BufferedImage finalImage = new BufferedImage(backgroundImage.getWidth(), backgroundImage.getHeight(), BufferedImage.TYPE_INT_RGB);
|
|
|
// 获取Graphics2D对象进行绘制
|
|
@@ -215,7 +215,7 @@ public class UploadServiceImpl implements UploadService {
|
|
|
// 绘制二维码
|
|
|
g2d.drawImage(qrCodeImage, qrCodeX, qrCodeY, null);
|
|
|
// 设置字体和颜色 字体大小可根据需要调整
|
|
|
- g2d.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
|
|
+ g2d.setFont(new Font("思源宋体", Font.BOLD, 20));
|
|
|
g2d.setColor(Color.WHITE);
|
|
|
// 绘制文字 如果抬头或者底部字数大于14,需要手动计算换行
|
|
|
if (title.length() > 14) {
|
|
@@ -272,7 +272,7 @@ public class UploadServiceImpl implements UploadService {
|
|
|
int qrCodeX = (backgroundImage.getWidth() - qrCodeImage.getWidth()) / 2;
|
|
|
int qrCodeY = (backgroundImage.getHeight() - qrCodeImage.getHeight()) / 2 + 58;
|
|
|
// 文字距离图片顶部的距离,可以根据需要调整
|
|
|
- int textY = 30;
|
|
|
+ int textY = 35;
|
|
|
// 创建新图片,使用背景图片的尺寸
|
|
|
BufferedImage finalImage = new BufferedImage(backgroundImage.getWidth(), backgroundImage.getHeight(), BufferedImage.TYPE_INT_RGB);
|
|
|
// 获取Graphics2D对象进行绘制
|
|
@@ -286,14 +286,14 @@ public class UploadServiceImpl implements UploadService {
|
|
|
// 绘制二维码
|
|
|
g2d.drawImage(qrCodeImage, qrCodeX, qrCodeY, null);
|
|
|
// 设置字体和颜色 字体大小可根据需要调整
|
|
|
- g2d.setFont(new Font("微软雅黑", Font.BOLD, 20));
|
|
|
+ g2d.setFont(new Font("思源宋体", Font.BOLD, 20));
|
|
|
g2d.setColor(Color.WHITE);
|
|
|
// 计算文字的X坐标,使其居中显示
|
|
|
FontMetrics metrics = g2d.getFontMetrics();
|
|
|
int textX = (finalImage.getWidth() - metrics.stringWidth(text)) / 2;
|
|
|
g2d.drawString(text, textX, textY);
|
|
|
// 设置字体和颜色 字体大小可根据需要调整
|
|
|
- g2d.setFont(new Font("微软雅黑", Font.BOLD, 14));
|
|
|
+ g2d.setFont(new Font("思源宋体", Font.BOLD, 14));
|
|
|
Color customColor = new Color(27, 163, 240);
|
|
|
g2d.setColor(customColor);
|
|
|
int textB = (finalImage.getWidth() - metrics.stringWidth(bot)) / 2 + 33;
|