• 输出自绘制图片


        <%
            /* Constructs a BufferedImage of one of the predefined image types. 
            The ColorSpace for the image is the default sRGB space.
            Parameters:
            width - width of the created image
            height - height of the created image
            imageType - type of the created image */
            BufferedImage bufferedImage = new BufferedImage(340,160,BufferedImage.TYPE_INT_RGB);
            Graphics g = bufferedImage.createGraphics();
            
            g.fillRect(0, 0, 400, 400);
            //设置红色
            g.setColor(new Color(255,0,0));
            g.fillArc(20, 20, 100, 100, 30, 120);
            //设置绿色
            g.setColor(new Color(0,255,0));
            g.fillArc(20, 20, 100, 100, 150, 120);
            //设置蓝色
            g.setColor(new Color(0,0,255));
            g.fillArc(20, 20, 100, 100, 270, 120);
            //设置黑色
            g.setColor(new Color(0,0,0));
            g.setFont(new Font("Arial Black",Font.PLAIN,16));        
            
            g.drawString("red:climb", 200, 60);
            g.drawString("green:swim", 200, 100);
            g.drawString("blue:jump", 200, 140);
            
            g.dispose();
            
            ImageIO.write(bufferedImage, "jpg", response.getOutputStream());
            
        %>




  • 相关阅读:
    数据同步
    闭包的内存泄漏解决办法
    No module named 'MySQLdb'
    pqi 更换pip 国内源
    BZOJ 1934 [Shoi2007]Vote 善意的投票
    BZOJ 2038 [2009国家集训队]小Z的袜子(hose)
    BZOJ 1002 [FJOI2007]轮状病毒
    BZOJ 3442 学习小组
    BZOJ 3261 最大异或和
    BZOJ 4029 [HEOI2015]定价
  • 原文地址:https://www.cnblogs.com/zDanica/p/5471640.html
Copyright © 2020-2023  润新知