• java 画 哆啦A梦


    package Demo;
    import javax.imageio.ImageIO;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.FileOutputStream;
    import java.io.IOException;

    public class DLAM {
    public static void main(String[] args) throws IOException {
    BufferedImage str = new BufferedImage(370,450,1);
    Graphics2D g = str.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);//去锯齿
    g.setColor(Color.WHITE);
    g.fillRect(0,0,370,450);
    Color blue = new Color(0,100,255);
    g.setColor(blue);
    g.fillOval(65,60,240,230);
    g.fillRect(109,290,150,120);

    int xValues[] = {109,70,63,109};
    int yValues[] = {290,278,308,321};

    g.fillPolygon(xValues,yValues,4);

    int xValues2[] = {259,305,295,259};
    int yValues2[] = {290,308,322,321};

    g.fillPolygon(xValues2,yValues2,4);
    g.setColor(Color.WHITE);
    g.fillOval(173, 402, 20, 20);
    g.fillOval(90, 405, 90, 25);
    g.fillOval(186, 405, 90, 25);
    g.setColor(Color.BLACK);
    g.drawOval(41,271,40,40);
    g.drawOval(292, 305, 40, 40);
    g.drawOval(90, 405, 90, 25);
    g.drawOval(186, 405, 90, 25);
    g.setColor(Color.WHITE);
    g.fillOval(41,271,40,40);
    g.fillOval(292, 305, 40, 40);
    g.setColor(Color.BLACK);
    g.drawOval(90, 405, 90, 25);
    g.drawOval(186, 405, 90, 25);
    g.setColor(Color.WHITE);
    g.fillOval(85, 130, 200, 150);//脸白色
    g.fillOval(123, 260, 120, 112);
    g.setColor(Color.RED);
    g.fillRoundRect(103, 275, 166, 16, 15, 15);
    g.setColor(new Color(204,204,0));
    g.fillOval(169, 278, 30, 30);//铃铛
    g.setColor(Color.BLACK);
    g.drawLine(171, 285, 197, 285);
    g.drawLine(169,290,200, 290);
    g.fillOval(179, 293, 10, 10);
    g.drawLine(184, 300, 184, 307);


    g.drawArc(148, 290, 70, 70, 0, -180);//口袋
    g.drawLine(148, 325, 218, 325);
    g.setColor(Color.WHITE);
    g.fillOval(123, 100, 60, 70);
    g.fillOval(183, 100, 60, 70);
    g.setColor(Color.BLACK);
    g.drawOval(123,100,60,70);
    g.drawOval(183,100,60,70);
    g.fillOval(152, 138, 10 ,16);
    g.fillOval(202, 138, 10, 16);
    g.setColor(Color.RED);
    g.fillOval(169, 158, 27, 27);
    g.setColor(Color.BLACK);
    g.drawOval(169,158,27,27);
    g.setColor(Color.WHITE);
    g.fillOval(184, 161, 10, 13);



    g.setColor(Color.BLACK);
    g.drawArc(90, 60, 190, 190, -45,-90);//嘴巴
    g.drawLine(183, 185, 183, 250);
    g.drawLine(100,182,148, 189);
    g.drawLine(93, 200, 148, 200);
    g.drawLine(98, 217, 148, 211);

    g.drawLine(219, 189, 268, 182);
    g.drawLine(219,200, 272, 200);
    g.drawLine(219, 211, 269, 218);

    g.setFont(new Font("隶书",Font.PLAIN,24));
    g.setColor(Color.BLUE);
    g.drawString("哆啦A梦",20, 70);

    g.dispose();
    ImageIO.write(str, "jpg",new FileOutputStream("C:\Users\86176\Desktop\SDF.jpg"));
    }
    }
  • 相关阅读:
    数据结构(九)词典
    数据结构(八)高级搜索树
    电脑购买参数配置
    git命令
    Linux安装初始化
    电影TS、TC、BD版和HD版
    eclipse 自动生成json格式的toString()方法
    富文本编辑器-UEditor
    lucene教程--全文检索技术
    FileOperator 文件(夹)操作类
  • 原文地址:https://www.cnblogs.com/liuyunche/p/13827424.html
Copyright © 2020-2023  润新知