package j09;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

public class Yuan {

public static void main(String[] args) throws IOException {
BufferedImage yuan=new BufferedImage(200, 200,BufferedImage.TYPE_INT_RGB);
Graphics2D yu=(Graphics2D) yuan.getGraphics();

yu.setColor(new Color(233, 113,60));//背景色
yu.fillRect(0, 0, 200, 200);//窗口大小和位置
yu.setColor(Color.black);//下面元素的颜色
int x=100;
int y=100;
int ang=0;
int ch=50;
int cv=50;
for(int n=0;n<=136;n++) {
int xx=(int) (x-(Math.sin(ang*Math.PI/360)*cv));
int yy=(int) (y-(Math.cos(ang*Math.PI/360)*ch));
yu.fillOval(xx, yy, 5, 5);//xx,yy圆上的坐标,点的长短直径
ang+=50;
}
yu.setStroke(new BasicStroke(10));
yu.setColor(Color.gray);
int x1=150;
int y1=150;
for(x1=200;x1>0;x1--) {
y1=-x1+200;

yu.drawLine(0, 0, 100, 100);//线起点终点
}
yu.dispose();

ImageIO.write(yuan, "jpg",new File( "yuan.jpg"));

}

}

posted on 2020-06-12 20:39  今进  阅读(160)  评论(0编辑  收藏  举报



感谢留言批评