我需要通过简单地设置每个点的颜色来创建2D图像文件,然后在特定坐标处输出文本。
您能为此推荐最简单的库并提供示例吗?
答案 0 :(得分:1)
见http://java.sun.com/javase/technologies/desktop/media/2D/
即http://download.oracle.com/javase/1.4.2/docs/guide/2d/spec.html
即http://download.oracle.com/javase/1.4.2/docs/api/java/awt/image/WritableRaster.html
示例:
static final int X = 380, Y = 250;
static BufferedImage img = new BufferedImage(X, Y, BufferedImage.TYPE_INT_RGB);
static public void main(String[] args){
WritableRaster wr = img.getRaster();
int[] a = new int[3]; // 96 bit pixels
a[0] = ...
a[1] = ...
a[2] = ...
wr.setPixel(20, 20, a);
}