drawImageメソッドの使い方
import com.sun.image.codec.jpeg.JPEGImageDecoder;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.image.codec.jpeg.JPEGCodec;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.*;
public class EdgeDetection extends Object {
public static void main(String[] args) {
BufferedImage in_bi = null;
BufferedImage out_bi =
new BufferedImage(134, 181, 1);
Graphics2D outg2 = out_bi.createGraphics();
Shape s = new Line2D.Float(10.0f, 50.0f,
90.0f, 150.0f);
outg2.drawImage(s, 0, 0, 0);
JPEGImageEncoder ie = null;
try {
ie = JPEGCodec.createJPEGEncoder(new FileOutputStream(args[0]));
} catch(FileNotFoundException e) {
System.err.println("ファイルが見つかりません [write]");
System.err.println("Edge_" + args[0]);
System.exit(253);
}
try {
ie.encode(out_bi);
} catch(IOException e) {
System.err.println("書き込みに失敗しました");
System.exit(252);
}
}
}
-------------------------------------------------------------
このようなソースを作成してコンパイルを行ったのですが、35行目の
drawImageでエラーが発生します。見直したところ
drawImageの引数に間違いがあるとも思えないのですが、
他に何かエラーになるような個所があるのでしょうか?
開発キットはJDK1.3です。宜しくお願いします。