【问题标题】:How to create an image with rounded corners in Java?如何在 Java 中创建带圆角的图像?
【发布时间】:2015-07-11 22:34:35
【问题描述】:

当我用圆角绘制 BufferedImage 时

BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
graphics.setColor(Color.WHITE);
graphics.fill(new RoundRectangle2D.Float(0, 0, 60, 60, 20, 20));

输出图像为:

如何接收没有黑角的图像?

【问题讨论】:

    标签: java bufferedimage graphics2d


    【解决方案1】:

    BufferedImage.TYPE_INT_RGB 更改为BufferedImage.TYPE_INT_ARGB 以创建透明图像

    【讨论】:

      猜你喜欢
      • 2010-12-18
      • 2015-05-26
      • 2023-04-08
      • 1970-01-01
      • 2010-12-13
      • 1970-01-01
      • 1970-01-01
      • 2011-11-28
      • 1970-01-01
      相关资源
      最近更新 更多