主要代码:
BufferedImage image = new BufferedImage(400, 120, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g2d = image.createGraphics();
g2d.setColor(Color.BLUE);
//g2d.fillRoundRect(0, 0, 400, 120, 40, 40);
BasicStroke stroke = new BasicStroke(4);
g2d.setStroke(stroke);
g2d.drawRoundRect(0, 0, 400, 120, 40, 40);
g2d.dispose();
g2d = (Graphics2D) g;
Image imgScale = image.getScaledInstance(100, 30, Image.SCALE_AREA_AVERAGING);
g2d.drawImage(imgScale, 0, 0, null);
2022-03-22 16:57:05
5KB
java
1