我有一个非常简单的图像生成程序,它只是在BufferedImage上绘制了一个圆角矩形,然后将图像保存到文件中。
try
{
BufferedImage image = new BufferedImage(40, 40, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
g2.setPaint(Color.blue);
g2.fillRoundRect(0, 0, 39, 39, 6, 6);
File file = new File("C:\\test.png");
ImageIO.write(image, "png", file);
}
catch( IOException e )
{
e.printStackTrace();
}
每当我使用drawRoundRect绘制矩形时,一切都按预期工作:
![enter image description here](https://istack.dev59.com/Yyd5z.webp)
![enter image description here](https://istack.dev59.com/5kpTu.webp)
谢谢,
B.J.