Set BufferedImage to be a color in Java

前端 未结 5 949
既然无缘
既然无缘 2021-01-07 19:52

I need to create a rectangular BufferedImage with a specified background color, draw some pattern on the background and save it to file. I don\'t know how to cr

5条回答
  •  执笔经年
    2021-01-07 20:10

    Probably something like:

    BufferedImage image = new BufferedImage(...);
    Graphics2D g2d = image.createGraphics();
    g2d.setColor(...);
    g2d.fillRect(...);
    

提交回复
热议问题