|
|
@@ -262,17 +262,37 @@ public class DomainOrderService {
|
|
|
// ImageUtils.Fit.COVER), 40);
|
|
|
// g.drawImage(avatarImg, 334, 136, null);
|
|
|
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
- Font topFont = font1.deriveFont(Font.PLAIN, 240f);
|
|
|
|
|
|
- Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
- ImageUtils.drawCenteredString(g, domainName, new Rectangle(0, 243, shareImg
|
|
|
- .getWidth(), 86), topFont);
|
|
|
- ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 462, shareImg
|
|
|
- .getWidth(), 86), topFont);
|
|
|
- g.setColor(new Color(255, 255, 255));
|
|
|
- ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 612, shareImg
|
|
|
- .getWidth(), 12), downFont);
|
|
|
+ int domainLength = domainName.length();
|
|
|
+ if (domainLength > 5 & domainLength < 10) {
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 200f);
|
|
|
+ Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
+ int subIndex = domainLength / 2;
|
|
|
+ String str1 = domainName.substring(0, subIndex + 1);
|
|
|
+ String str2 = domainName.substring(subIndex + 1, domainLength);
|
|
|
+ ImageUtils.drawCenteredString(g, str1, new Rectangle(0, 180, shareImg
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
+ ImageUtils.drawCenteredString(g, str2, new Rectangle(0, 350, shareImg
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 520, shareImg
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 650, shareImg
|
|
|
+ .getWidth(), 12), downFont);
|
|
|
+ }
|
|
|
+ if (domainLength < 5) {
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
+ Font topFont = font1.deriveFont(Font.PLAIN, 240f);
|
|
|
+ Font downFont = font2.deriveFont(Font.BOLD, 36f);
|
|
|
+ ImageUtils.drawCenteredString(g, domainName, new Rectangle(0, 243, shareImg
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
+ ImageUtils.drawCenteredString(g, ".NFT", new Rectangle(0, 462, shareImg
|
|
|
+ .getWidth(), 86), topFont);
|
|
|
+ g.setColor(new Color(255, 255, 255));
|
|
|
+ ImageUtils.drawCenteredString(g, domain, new Rectangle(0, 612, shareImg
|
|
|
+ .getWidth(), 12), downFont);
|
|
|
+ }
|
|
|
|
|
|
//二维码
|
|
|
// QRCodeWriter qrCodeWriter = new QRCodeWriter();
|