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