com.sun.image.codec.jpeg.*就在rt.jar中啊。
net.xdevelop.util.ParamUtil没听说过,估计是举例的人自己定制的。
其实用com.sun.image.codec.jpeg.*即可实现简单的图文输出。
net.xdevelop.util.ParamUtil没听说过,估计是举例的人自己定制的。
其实用com.sun.image.codec.jpeg.*即可实现简单的图文输出。
解决方案 »
- 如何为myelcipse自带的tomcat设置欢迎页面。
- httpunit实现下载
- 后退出现网页过期究竟是怎么实现的
- 客户端远程调用ejb3问题
- 我想要用xdoclet生成ejb的教程?谁有?
- java 数据库时间处理:求助
- 急死人了,spring3.2.4+mybatis3.2.2事务管理无效?
- 请教Tomcat 4.1+eclipse2.1.3+lomboz的配置问题
- 100分求jsp調用session ejb的例子,急...
- 郁闷散分!!!!!
- !急啊 立刻给分!weblogic.ant.taskdefs.ejb.DDInit生成xml时出错信息!什么原因?
- 请教j2ee下浏览器窗口如何实现票据打印?
/*
* iSee Software License, Version 1.0
*
* Copyright (c) 2002 iSee Studio. All rights reserved.
*
* 爱思时代科技版权所有
*
*/
package isee.utility ;import com.sun.image.codec.jpeg.JPEGCodec ;
import com.sun.image.codec.jpeg.JPEGImageEncoder ;//import java.awt.image.geom.*;
//import java.awt.AlphaComposite;
import java.awt.Color ;
import java.awt.Font ;
import java.awt.Graphics2D ;
import java.awt.RenderingHints ;
import java.awt.image.BufferedImage ;import java.io.OutputStream ;/**
* <p>
*
* Title: </p> <p>
*
* Description: </p> <p>
*
* Copyright: Copyright (c) 2002</p> <p>
*
* Company: </p>
*
*@author unascribed
*@created 2002年8月7日
*@version 1.0
*/
public class ImageUtility
{
//~ Constructors .......................................................... //~ Methods ............................................................... /**
* 方法描述。
*
*@param out Description of the Parameter
*@param text Description of the Parameter
*/
public final static void writeTextImage ( OutputStream out , String text )
throws java.io.IOException
{
int height = 16 ;
int fontSize = 12 ;
int width = text.length () * ( fontSize - 3 ) + 1 ;
BufferedImage image = new BufferedImage ( width , height ,
BufferedImage.TYPE_INT_RGB ) ;
Graphics2D g2D = ( Graphics2D ) image.getGraphics () ;
g2D.setRenderingHint ( RenderingHints.KEY_ANTIALIASING ,
RenderingHints.VALUE_ANTIALIAS_ON ) ; // Clear image with transparent alpha by drawing a rectangle
// g2D.setComposite( AlphaComposite.getInstance( AlphaComposite.CLEAR,
// 0.0f ) );
//Rectangle2D.Double rect = new Rectangle2D.Double( 0, 0, width, height );
//g2D.fill( rect );
g2D.setColor ( Color.white ) ;
g2D.fillRect ( 0 , 0 , width , height ) ;
g2D.setColor ( Color.black ) ;
g2D.setFont ( new Font ( "SansSerif" , Font.BOLD , fontSize ) ) ; int left = 2 ; //( width - fontSize * text.length() / 2 ) / 2;
g2D.drawString ( text , left , 12 ) ; JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder ( out ) ;
encoder.encode ( image ) ;
}
}