zoukankan      html  css  js  c++  java
  • 输出自绘制图片

        <%
            /* 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());
            
        %>




  • 相关阅读:
    MVC5+EF6 入门完整教程11--细说MVC中仓储模式的应用
    MVC5+EF6 入门完整教程十
    MVC5+EF6 入门完整教程九
    MVC5+EF6 入门完整教程八
    MVC5+EF6 入门完整教程七
    MVC5+EF6 入门完整教程六
    MVC5+EF6 入门完整教程五
    MVC5+EF6 入门完整教程四
    MVC5 + EF6 完整入门教程三
    从前端的UI开始
  • 原文地址:https://www.cnblogs.com/zDanica/p/5471640.html
Copyright © 2011-2022 走看看