ASP获取字符串长度的自定义函数
2008-02-13 17:43
411 查看
第一步:创建一个Java Bean用来生成jpg文件
源程序如下:
//生成图片的 Java Bean
//作者:崔冠宇
//日期:2001-08-24
import java.io.*;
import java.util.*;
import com.sun.image.codec.jpeg.*;
import java.awt.image.*;
import java.awt.*;
public class ChartGraphics {
BufferedImage image;
public void createImage(String fileLocation) {
try {
FileOutputStream fos = new FileOutputStream(fileLocation);
BufferedOutputStream bos = new BufferedOutputStream(fos);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
encoder.encode(image);
bos.close();
} catch(Exception e) {
System.out.println(e);
}
}
public void graphicsGeneration(int h1,int h2,int h3,int h4,int h5) {
final int X=10;
int imageWidth = 300;//图片的宽度
int imageHeight = 300;//图片的高度
int columnWidth=30;//柱的宽度
int columnHeight=200;//柱的最大高度
ChartGraphics chartGraphics = new ChartGraphics();
chartGraphics.image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphics = chartGraphics.image.getGraphics();
graphics.setColor(Color.white);
graphics.fillRect(0,0,imageWidth,imageHeight);
graphics.setColor(Color.red);
graphics.drawRect(X+1*columnWidth, columnHeight-h1, columnWidth, h1);
graphics.drawRect(X+2*columnWidth, columnHeight-h2, columnWidth, h2);
graphics.drawRect(X+3*columnWidth, columnHeight-h3, columnWidth, h3);
graphics.drawRect(X+4*columnWidth, columnHeight-h4, columnWidth, h4);
graphics.drawRect(X+5*columnWidth, columnHeight-h5, columnWidth, h5);
chartGraphics.createImage( "D:\\temp\\chart.jpg ");
}
}
引自:http://topic.csdn.net/t/20031030/15/2410774.html
源程序如下:
//生成图片的 Java Bean
//作者:崔冠宇
//日期:2001-08-24
import java.io.*;
import java.util.*;
import com.sun.image.codec.jpeg.*;
import java.awt.image.*;
import java.awt.*;
public class ChartGraphics {
BufferedImage image;
public void createImage(String fileLocation) {
try {
FileOutputStream fos = new FileOutputStream(fileLocation);
BufferedOutputStream bos = new BufferedOutputStream(fos);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
encoder.encode(image);
bos.close();
} catch(Exception e) {
System.out.println(e);
}
}
public void graphicsGeneration(int h1,int h2,int h3,int h4,int h5) {
final int X=10;
int imageWidth = 300;//图片的宽度
int imageHeight = 300;//图片的高度
int columnWidth=30;//柱的宽度
int columnHeight=200;//柱的最大高度
ChartGraphics chartGraphics = new ChartGraphics();
chartGraphics.image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphics = chartGraphics.image.getGraphics();
graphics.setColor(Color.white);
graphics.fillRect(0,0,imageWidth,imageHeight);
graphics.setColor(Color.red);
graphics.drawRect(X+1*columnWidth, columnHeight-h1, columnWidth, h1);
graphics.drawRect(X+2*columnWidth, columnHeight-h2, columnWidth, h2);
graphics.drawRect(X+3*columnWidth, columnHeight-h3, columnWidth, h3);
graphics.drawRect(X+4*columnWidth, columnHeight-h4, columnWidth, h4);
graphics.drawRect(X+5*columnWidth, columnHeight-h5, columnWidth, h5);
chartGraphics.createImage( "D:\\temp\\chart.jpg ");
}
}
引自:http://topic.csdn.net/t/20031030/15/2410774.html
相关文章推荐
- ASP获取字符串长度的自定义函数
- ASP获取字符串长度的自定义函数
- Lua中获取utf8字符串长度的方法和自定义函数
- ASP UTF-8编码下字符串截取和获取长度函数
- 自定义PHP中获取字符串长度函数
- asp 获取字符串长度函数
- MySQL CHAR_LENGTH 获取字符串长度函数
- javaScript中自定义sort中的比较函数,用于比较字符串长度,数值大小
- oracle获取字符串长度函数length()和hengthb()
- ABAP自定义截取字符串长度函数
- C#算法函数:获取一个字符串中的最大长度的数字
- oracle获取字符串长度函数length()和hengthb()
- ASP.NET通过自定义函数实现对字符串的大小写切换功能
- mysql获取字符串长度函数(CHAR_LENGTH)
- oracle获取字符串长度函数length()和hengthb()
- 编写函数,获取两段字符串的最长公共子串的长度
- oracle获取字符串长度函数length()和lengthb()
- PHP生成自定义长度随机字符串的函数分享
- PHP截取字符串,获取长度,获取字符位置的函数 中文字符截取