package test;

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class DrawGraphics {

 /**
  * @param args
  */
 public static void main(String[] args) throws Exception{
  int width=800;
  int height=800;  
  File file = new File("e:\a.jpg");
  BufferedImage bi = new BufferedImage(width, height,
    BufferedImage.TYPE_INT_RGB);//RGB形式
  Graphics2D g2 = (Graphics2D) bi.getGraphics();
  g2.setBackground(Color.WHITE);//设置背景色
  g2.clearRect(0, 0, width, height);//通过使用当前绘图表面的背景色进行填充来清除指定的矩形。
  g2.setPaint(Color.BLUE);//设置画笔,设置Paint属性
  g2.drawOval(0, 0, 80, 80);
  ImageIO.write(bi, "jpeg", file);
  g2.dispose();
  System.out.println("test");

 }

}

相关文章:

  • 2021-09-19
  • 2021-12-21
  • 2021-08-05
  • 2021-12-12
  • 2021-11-04
  • 2022-01-14
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2021-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-05-18
  • 2021-04-21
相关资源
相似解决方案