日期:2014-05-17 浏览次数:20669 次
<%@ page contentType="image/jpeg" %>
<%@ page import="java.awt.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.awt.image.*" %>
<%@ page import="java.awt.geom.*" %>
<%@ page import="com.sun.image.codec.jpeg.*" %>
<% int width=260,height=260;
BufferedImage image=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
Graphics g=image.getGraphics();
g.setColor(Color.white);
g.fillRect(0,0,width,height);
Graphics2D g_2d=(Graphics2D)g;
Ellipse2D ellipse=new Ellipse2D.Double(40,80,100,40);
g_2d.setColor(Color.blue);
AffineTransform trans=new AffineTransform();
for(int i=1;i<=12;i++){
trans.rotate(30.0*Math.PI/180,90,100);
g_2d.setTransform(trans);
g_2d.draw(ellipse);
}
g.dispose();
OutputStream outClient=response.getOutputStream();
JPEGImageEncoder encoder=JEPGCodec.createJPEGEncoder(outClient);
encoder.encode(image);
%>