Graphics2D画一个自定义背景颜色的背景

  1. int width=256;
  2.  
    int height=256;
  3.  
    //创建BufferedImage对象 定义长宽及背景图
  4. BufferedImage bi =  new BufferedImage(1039,479,BufferedImage.TYPE_INT_RGB);
     
     

    Graphics2D graphics = originImage.createGraphics();

    //设置背景颜色
    graphics.setPaint (bgColor);

    覆盖背景
    graphics.fillRect ( 0, 0, 1039, 479);

     

posted @ 2021-08-25 09:22  教练我想打篮球  阅读(1057)  评论(0编辑  收藏  举报