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




  • 相关阅读:
    小白学开发(iOS)OC_ 使用继承来扩充类(2015-08-07)
    UI组件之TextView及其子类(三)ToggleButton和Switch
    C++智能指针--shared_ptr
    HDU 1013 Digital Roots 题解
    对touch事件传递的简单理解
    【LeetCode-面试算法经典-Java实现】【096-Unique Binary Search Trees(唯一二叉搜索树)】
    Cocos2d-x 坐标系
    hdu1518 Square
    servlet3.0新特性
    OGNL表达式
  • 原文地址:https://www.cnblogs.com/zDanica/p/5471640.html
Copyright © 2011-2022 走看看